## f1

Compute F1 (or higher order, e.g., F2) and DC response metrics for periodic stimuli, such as drifting gratings. This works for spike data (rtype 0) and "continuous" data (rtype 1).The

amplitudeis 1 for a perfect sine function that goes from -1 to 1. Thephasewill be 0 degrees for cos(x), and -90 for sin(x). Thus, when a cosine function is shifted rightward, the phase will go from 0 to -180, and will then jump to +180 and come back to zero. The phase values are relative to the start of the data window, thus the first data point in the window is at x=0.

Note, if a data segment is analysed that has a length that is not a multiple of the cycle length, then the phase and amplitude values can be inaccurate. To limit the analysis duration, "period", thefull_cycle_flagis set to its default value of 1 (see below).

## Output types

plot- xplot output.plot_2d- 2D data file (.2d) output, to be used for a 2D matrix design, for example, plotting the response to a direction by direction matrix.

stat-appendmeans, SDs to file, each record will be:[infile] [group] [DC] [DC_SD] [F1] [F1_SD] [Phase] [Phase_SD] [n_trials] ...

stat_f1_only-appendonly file/group ID and the F1 mean to file, each record will be:[infile] [group] [F1] ...

stat_dc_only-appendonly file/group ID and the DC mean to file, each record will be:[infile] [group] [DC] ...

data- single trial DC and F1 values are written to a text file with the following format:group [group_name] n [n] [dc_1] [f1_1] ... [dc_n] [f1_n] ...## Parameters

Examples are given below.

f1_param[pname] - if defined, 'pname' must contain the TF in Hz as a var or const param. The F1 amplitude will be computed instead of DC rate. For sinusoidal modulation from 0 to 100 spk/s, F1=DC=50spk/s. For half-wave rectified modulation from 0 to 100 spk/s, F1=50spk/s, DC<50.

f_order[order] - 1 for F1, 2 for F2, etc.

full_cycle_flag[0/1] - [default 1] 1-adjust the duration of the analysis period to be as close as possible to a multiple of a full temporal cycle. NOTE: if the analysis duration ("period" in the .nda file) is not a multiple of the cycle, then additive offsets will influence the amplitude and phase values.

sem_flagstandard error on the mean - by default, this is 1, set it to 0 if you want standard deviation error bars.

xaxis_convert"ori_mirror" - Causes a mirroring of x-axis values, assuming they are in degrees of visual angle.

baseline0- Works for spike data, not yet for continuous data.

baseline1- Works for spike data, not yet for continuous data.## Example - appending statistics to an outfile

f1 group 0 stat chan gx0 start 0 period 1000 # Period will be automatically adjusted downward # to be an integer multiple of the cycle length # if "full_cycle_flag" is 1 full_cycle_flag 1 # Adjust analysis duration to multiple of the cycle f1_param tf # Name of temporal frequency parameter## Example - writing trial data to outfile

# # write data # f1 group 1 contrast data f1_param tf1