HelpGettingStarted

Getting Started

Welcome to Unitret Help!


Help Info

Unitret Online Help

To view the online documentation from Unitret, select the "Online Help" option in the "Help" menu. If you are not connected to Internet, use "HTML Help" instead. It will load compiled HTML help window (file Unitret.chm, located in Unitret folder, most recent version can be downloaded from Unitret page).

HTML Help troubleshooting

What support files are required to View HTML Help?

Unitret uses file "hh.exe" (located in C:\WINNT or C:\Windows folder) to open compiled HTML Help (unitret.chm) file. If Unitret HTML Help file does not open or behave correctly, then you may need to update or install the latest HTML Help run-time files, or IE3 or greater. HTML Help run-time files are installed by running HHUpd.EXE. HTML Help itself requires that IE3 or greater be installed. IE4/5/6 is recommended. You _must_ have Internet Explorer 3 or greater installed.

HHUpd.exe is free and available from the MS Web site:
http://msdn.microsoft.com/library/en-us/htmlhelp/html/vsconHH1Start.asp

If you want to create your own compiled HTML help or modify the existing one, please refer to information below:

HH Workshop (HtmlHelp.exe) amd Run-time install (HHUpd.exe) can be downloaded from http://msdn.microsoft.com/library/en-us/htmlhelp/html/vsconHH1Start.asp.
Note: HtmlHelp.exe installs a copy of the latest HH run-time installer HHUpd.exe but does not install it. You must run HHUpd.exe yourself if you want to upgrade or install the latest HH run-time files.


HelpPreferences

Preferences

  • copy data to clipboard - numeric output of certain functions (see list of functions) will be copied to clipboard
  • system run mode for conversion - format for BrainWare -> Unitret conversion
  • save STIM together with spike file - for retrieving stimulus parameters together with saved spikes


HelpConversion

Conversion

Unitret was originally written for a specific datafile format, produced by the old system in Max Snodderly lab. When we moved to the new system, that produces several types of files that have to be converted and linked together, I decided to make the transition "transparent" for data analysis, converting new system files to the old format. The following section describes the conversion process in details. Here I just outline the steps.

The BrainWare's native *.src file format is hidden from the user. It contains spikes times, spike shapes, and stimulus parameters. Spike times and stimulus parameters should be exported from BrainWare as *.f32 binary files (see BrainWare Help | Exporting Data: Format "Spike Times as Binary"). In addition, system eyetracker2.dll creates *.etd files with eye postion records. If we are dealing with multiunit that is hard to separate in BrainWare feature space, we also export spike shapes as ASCII (*.txt) files, in order to apply our unisplit.m PCA-based clustering. The program conver.m combines all types of files into Unitret datafile format. If conver.m does not find shapes *.txt files, it omits it, assuming that we have a clear single unit.

Important note: BrainWare will export ALL spike shapes to *.txt format, not only those within an outlined cluster. Binary *.f32 files, on other hand, will include only spikes within the cluster. To avoid discrepancy (and problems during separation), make sure you include ALL spikes within the BrainWare cluster before exporting to *.f32, if you are going to use unisplit.m.


HelpConversion2Unitret

Converting BrainWare *.f32 and eyetracker *.etd to Unitret datafile

The BrainWare (BW) exports data (spikes and stimulus parameters) in binary *.f32 file NOT in chronological order - instead, it sorts it according to stimulus conditions (datasets) and repetitions:
1st dataset
    1st repetition
    2nd repetition
    ...
2nd dataset
    ...
...
If there is more than one batch/record in the file, even though the stimulus remained the same, BrainWare will consider it as a new dataset.

Eyetracker data, however, is written in chronological order:

1st trial
2nd trial
...
This complicates the synchronization of BW and eyetracker data, especially in cases when more than one batch is saved to the file, the batches are different in size (#conditions) and/or #repetitions for each condition, and the order of presentation in the batch was random.

The conver.m routine can deal with all these difficulties using the following algorithm:
1. The eyetracker data is read to structure array etdata(ind, rep), where ind is the sequential number of row in StimulusGrid (corresponding to the number of stimulus condition if file contains only one batch), and rep is the number of repetitions for this index in the file (again, for one batch it would be the number of repetitions for "ind" stimulus condition). Note that this array can have empty members, for example (0372_001.a18):

ind/rep	1	2	3	4
1	x	x	x	x*
2	x	x	x	x*
3	x	x	x
4	x	x	x	x'
5	x
6	x
7	x
In the example above, we have 3 batches:
1st - 7 stimulus conditions (7 datasets), one rep each (first column).
2nd - 4 stimulus conditions (4 datasets), two reps for conditions 1-3 and three repetitions for condition 4 (denoted x').
3rd - 2 stimulus conditions (2 datasets), one rep for each (denoted x*).

In order to correctly assign eyetracker trial to its corresponding spike and stimulus data, we keep track of last selected rep for each ind (last_rep_taken), and select etdata trial bases on last_rep_taken and ind that is obtained from BW data(numset).stim(1):

...
nusc = length(unique(inds));		% number of unique stimulus conditions
    ...
    last_rep_taken = ones(1,nusc);

    for numset = 1:numsets,
        for sweep = 1:size(data(numset).sweep,2),
        ...
        n = data(numset).stim(1);
        s = last_rep_taken(n);
        last_rep_taken(n) = last_rep_taken(n)+1;

        etdata(n,s)...
See conver.m for more details.


HelpSetupAuto

Setup for automated (batch) operations

  • "visual control" - display/hide graphic figure (hide option is running much faster, as no resources and time are "wasted" on plotting)
  • "auto select" - select automatically (can be used in manual mode as well, instead of mouse press)
  • "save selected segments" - will save segments in "save format"
  • "save eye mov. data" - will save EM data structures to *.ems MAT file
  • "save STA" - saccade-triggered averages
  • "class. index" - currently obsolete (was used for saccades-triggered averaged PSTH classification)
  • "clear/accumulate processing" - data per one file or for all files in batch (for STA and "add spikes records")
  • "autoscroll file forward" - automatically scroll pages (trials) forward (like pressing ">>" button)


HelpSetupOrientation

Setup for orientation tuning curves

  • Hanning filter half-width @ half-height (deg, window length =4*half-width)
  • peak shift threshold - shift peak to 90 deg if abs(90-peak)>threshold (use 90 for "no shift")
Orientation tuning curves


HelpSaving2MAT

Saving data to *.MAT file

Legend:
Fig1 - left panel Fig2 - right (graphic) panel

To save trials (spikes, em, stim info) to MAT format (SEMSTIM):

- Fig2
- File | Select | Whole trial
- Auto | Setup Auto
- uncheck "visual control"
- check "auto select"
- check "save selected segments" and set "save format" to "MAT SEMSTIM"
- Ok

- Fig1
- File | Process exp. records...
- Type path to directory containing experimental records
- Select experimental records to process (use Ctrl and Shift to make multiple selections)
- Select path to existing directory where generated files should be saved
You will see the counter of processed files in Fig1. When finished, the files with same names as original experimental records files, but with extension *.semstim.mat, should be located in the directory you selected.

STIM - stimulus parameters format


HelpSTIM

STIM - stimulus parameters format

=======================================================================
Spikes - Eye Movements - Stimulus (SEMSTIM) MAT file format description
=======================================================================

-----------------------------------------------------------------------
format 1.0 (13.06.02)
-----------------------------------------------------------------------

Each file contains one structure SEMSTIM_struct -
1xN struct array with fields:
    TrialNum
    TimeBegin (see NOTE 1) 	// ms
    TimeEnd			// ms
    spikes			// Spike Arrival Times in ms
    eye_time_axis		// ms
    eye_hor			// minarc
    eye_ver			// minarc
    STIM			// See (**)

where N is the number of trials in the file. Each element of the array contains one trial.

** STIM is structure with the following fields (actual field values below are just an example):

Format: 		'1.0'
FileName: 		'0888R010.A18  '
SID: 			3			// Stimulus ID (see NOTE 2)
StabFlag: 		0			// 0 - no stab., 1 - each frame, 2 - even frames
StimulusName: 		'sweep'			// (See NOTE 2)
OneStimDuration: 	250			// ms (see NOTE 4)
TimeBetweenStim: 	0			// ms (see NOTE 4)
Tilt: 			100			// deg (0 - stimulis is horizontal: RadialBoxSize - x, PerpenBoxSize - y)
RadialBoxSize: 		118			// minarc (along preferred orientation, x @ tilt=0)
PerpenBoxSize: 		19			// minarc (perpendicular to preferred orientation, y @ tilt=0)
XStartPos: 		185			// minarc (x center of the stimulus referenced to LLC - lower left corner of monitor)
YStartPos: 		110			// minarc (y center of the stimulus referenced to LLC)
ExtentStimMotion: 	0			// minarc (see NOTE 5)
StimVelocity: 		0			// minarc/s
FgrRedInt: 		0.3020			// cd/m^2 or RGB 0-255
FgrGreenInt: 		0.3550			// cd/m^2 or RGB 0-255
FgrBlueInt: 		0.3090			// cd/m^2 or RGB 0-255
BckgrRedInt: 		0.3020			// cd/m^2 or RGB 0-255
BckgrGreenInt: 		1.0430			// cd/m^2 or RGB 0-255
BckgrBlueInt: 		0.3090			// cd/m^2 or RGB 0-255
SpatialFreq: 		3			// cpd
TempFreq: 		0			// Hz
Phase: 			135			// deg
Contrast: 		0.5000			// 0.01% (0 - 1)
StimTempType: 		3			// (See NOTE 3)
StimSpatType: 		0			// (See NOTE 3)

-----------------------------------------------------------------------
NOTES:
-----------------------------------------------------------------------

1. TimeBegin can be negative, but stimulus start will always be synchronized with time zero.

2. Table of current stimuli IDs:
===============================
StimulusName 	SID	Meaning
===============================
background	0 	Uniform background
static		1	Static bar
flash		2	Flashing bar
sweep		3	Sweeping bar
wsine		4	Drifting/Stationary windowed sine grating
csine-si	5	Counterphase (Contrast-reversal) grating (sine temporal function)
csine-sq	6	Counterphase (Contrast-reversal) grating (square temporal function)
csine-ramp	7	Counterphase (Contrast-reversal) grating (ramp temporal function)
fwsine		8	Flashing drifting/stationary windowed sine grating
wsquare		9	Drifting/Stationary windowed square grating
sqsweep		10	Inc/Dec sweeping bar
ssine		11	Sweeping split sine grating (two gratings/lobes separated by gap)
flash-n-sweep	12	Flashing and sweeping bar

3. Table of current stimulus temporal (t-t) and spatial (s-t) types.

These types were used in the old system, and are obsolete/redundant in the new system,
except for t-t 'Alternating'/'Repeating' for sweeping bars (sweep and sqsweep stimuli).
'Alternating' means sweep going forward and backward, 'Repeating' - only forward motion.

All other stimuli are unequivocally defined by SID (see NOTE 2).

* t-t *
'No motion'	0
'Alternating'	1
'Flashing'	2
'Repeating'	3

* s-t *
'Solid tilted rectangular'	0 	// bar
'Sinus'				1	// drifting sinusoidal grating window (up to year 96, now obsolete)
'Gabor'				2	// never used
'6-th deriv of Gaussian'	3	// never used
'Regular texture'		4	// never used
'Random'			5	// never used
'Wsine'				6	// sinusoidal grating drifting WITHIN the window (cf. Sinus)
'Csine-sq'			7	// counterphase (contrast-reversal) grating (square temporal function)
'Ssine'				8	// sweeping split sine grating (two gratings/lobes separated by gap)
'MAX_PAT_TYPE'			9	// never used
'Csine-si'			10	// counterphase (contrast-reversal) grating (sine temporal function)
'Csine-ramp'			11	// counterphase (contrast-reversal) grating (ramp temporal function)
'Fwsine'			12	// flashing (on-off) wsine (see Wsine)
'Wsquare'			13	// square grating drifting WITHIN the window (cf. Wsine)
'SqSweep'			14	// Inc/Dec sweeping bar (one sweep forth/back - INC, other - DEC)

4. OneStimDuration and TimeBetweenStim parameters are used for flashing stimuli: flash and fwsine.
For all other stimuli, they are redundant.

Before 17 May 2000: OneStimDuration - time stimulus is on, TimeBetweenStim - stimulus is off.
After 17 May 2000: OneStimDuration - time stimulus is off, TimeBetweenStim - stimulus is on.

5. Extent of stimulus motion is used for sweep and sqsweep stimuli.
The motion is always perpendicular to tilt and stumulus XY position is the middle point of the sweep.


HelpCopyClipboard

Copy to Clipboard

List of functions whose output is copied to clipboard (if "copy data to clipboard" is on, see Preferences)

process.m

Orientation tuning curve - 'ori_tuning':
[preferred orientation (deg), circular variance (0-1), bandwidth (deg)]

Full harmonic analysis - 'harmon_anal':
[RM RM_aligned DC SD_F1_phase max_harmonic max_harmonic_amp]

OI setup - 'OI_setup':
[INC DEC CRF OI]

Analysis setup - 'analyze':
[out1.rm out2.rm out1.dc out2.phase out1.max_harmonic out1.max_harmonic_amp]

unitret.m


HelpFullHarmonicAnalysis

Full Harmonic Analysis

File | Select... | Int. Cycles
Setup | Setup eye movements
    check "Sac. detector"
    check "Take Drifts"
File | Show Spikes
For "Align" analysis go to Setup | Spike Setup and check "Split to cycles"
Process | Full Harmonic Analysis

This will put several numbers to clipboard, first two are RM and RM_aligned.

(To close all graphic windows go to left panel Window | Close all graphic windows)


HelpOrientation

Orientation

The orientation selectivity of a cell is defined by two different measures - circular variance and bandwidth.

1) Circular variance is calculated from orientation tuning curves as follows:

CV = 1 - |R|, where R = sum(rkexp(i2thetak))/sum(rk) and rk is the response (mean firing rate in spikes/s) @ angle thetak (in radians). Angles should be spaced at equal intervals of 15 deg. If they are not, the data is interpolated and smoothed (see below), and then resampled at 15 deg intervals.

2) Bandwidth at 1/sqrt(2) is calculated as follows. The data is interpolated at 1 deg intervals and then smoothed with a Hanning window filter of a certain half-width @ half-height. Location of a peak is determined and orientations closest to the peak for which the response equals 1/sqrt(2) (70.7%) of the peak response on either side is estimated. The bandwidth is the one-half of the difference between these two angles (denoted by vertical dashed lines).

References:

Orban (1994) ...
Ringach et al. (2002) Orientation selectivity in macaque V1: diversity and laminar dependence. J Neurosci 22: 5639-5651
Schiller et al. (1976)...


Help Unisplit

Unisplit Help

For source code of klt.exe, see klt folder.

Source code for klt -- Karhunen-Loeve transform (PCA)

Written by Alexander Beylin, converted to VC++ 6.0 and modified by Igor Kagan

References:

Abeles, M. and Goldstein, M. H. Multispike train analysis. Proc. IEEE 65: 762–773, 1977.

Gur, Moshe, Alexander Beylin, and D. Max Snodderly. Physiological properties of macaque V1 neurons are correlated with extracellular spike amplitude, duration, and polarity. J. Neurophysiol. 82: 1451–1464, 1999.