4. things you do with a @cortex object

You can:

  • access all the behavioral data (header information and behavioral encodes) contained in a CORTEX data file;
  • retrieve and analyze "spike matrices" or firing rates using @cortex member functions (see below);
  • retrieve and analyze eye movements.

You cannot:

  • modify any of the object data unless you enter a special "expert" mode (see below);
  • access spike data directly, unless you explicitly turn the whole object into a structure (see below).

Accessing behavioral information

A @cortex object is really a structure composed of a number of fields. To access data from any of the valid fields, you must use the object-dot-field notation (this is a common way to reference variables in object-based programming languages). I also refer to these fields as dot-properties. For example:

>> cobj.conds;

.returns a trial-by-trial array of condition numbers.

>> cobj.response(1:10);

.returns the response_error code of the first 10 trials.

Note that only the first 3 (lowercase) letters of the field name are relevant. Thus:

>> cobj.conds;

.and.

>> cobj.Conditions;

... are equivalent.

Properties

There are 4 "global" properties of the object:

tri -> total number of trials
nam -> the original data file name
ban -> the "cluster bank", a list of spike codes in the data file
cha -> "change mode", for experts only

Then there are 9 different fields associated with each trial
(these are the CORTEX data file header fields):

rel(trials) -> "relative" trial number
con(trials) -> condition number (the first condition is #1)
rep(trials) -> repetition number
blo(trials) -> block number (the first block is #1)
eog(trials) -> milliseconds between eye position samples
khz(trials) -> data collection sampling rate
typ(trials) -> trial type, an attribute of the condition
giv(trials) -> given response, the behavioral response provided by the subject
res(trials) -> response error, the trial outcome

Finally, each trial usually contains a variable number of "behavioral" events.

Each event is defined by a code (the number passed by the encode() function in the timing file) and a time stamp (the offset in ms from the beginning of the trial).

These are contained in the 2 matrices:

cod (trials, event_number)
tim (trials, event_number)

Example:
>> last_time_stamp = max (cobj.times (cobj.trials, :));
>> [trials, events] = cobj.codes;

Note that both cod and tim have as many rows as there are trials and as many columns as the maximum number of events encoded in a trial. Each trial (row), is padded with zeros after the last actual encode (because of this, you should NOT issue encode(0) in your timing file!)

Data are read-only

For safety reasons, unless you enter a special "change mode" (experts only!) or unless you convert the @cortex object into a regular structure, none of the data can be modified.

Example:

>> cobj.times(1, 1) = 1534;
??? Access to an object's fields is only permitted within its methods.

Analyzing spike and eye data

Spikes can be counted/averaged and eye-positions retrieved by using @cortex member functions (aka @cortex methods). The most important methods are:

cortex the class constructor, creates a @cortex object
spikematrix to retrieve trial-by-trial and ms-by-ms matrices of spikes
eyepos to retrieve X-Y coordinate pairs of eye positions over time
save to save on disk a "dump" version of the data file
trialfiringrate returns trial-by-trial firing rates
meanfiringrate same as: mean(trialfiringrate)
trialdensity returns spike density distributions
density same as: mean(density)
latency returns time intervals between pairs of events
cortview GUI-based @cortex explorer

Normally, you will not want to use these functions on the whole @cortex object, but rather on groups of trials that "belong together".

Whereas experimental conditions are usually presented in some randomized order during the session, data analysis is typically done after sorting out groups of trials belonging to the same condition. For example, if you want to compute neuronal responses from all "correct" trials of condition 5, first you need to identify those trials within the object.

>> cobj = cortex ('c:\data\dcfile');
>> ts = find (cobj.cond == 5 & cobj.resp ==0);

You will then be able to use the list of trial indices in ts to access the relevant behavioral and physiological data. Selecting trials this way in a complicated experiment can be quite tedious and error-prone. The job is made easier by @key objects.

Previous <-> Next