ndi.mock.fun.stimulus_presentation - make a mock stimulus presentation document base
[STIM_PRES_DOC,SPIKETIMES] = ndi.mock.fun.stimulus_presentation(S, stimulus_element_id, parameter_struct_array, ...
independent_variables, X, R, control, noise, reps, ...)
Create a mock stimulus presentation document and spike times that approximate the
responses R as closely as possible (within the stimulus duration bounds).
If necessary, the time of each stimulus presentation is adjusted to allow a more
accurate representation of the requested firing rate.
S is the NDI session that the stimulator is a part of
STIMULUS_ELEMENT_ID is the id of a mock stimulator element.
PARAMETER_STRUCT should be a structure that has the base parameters
that are common to all of the stimuli in the group.
INDEPENDENT_VARIABLES is a cell array of strings that are the names of the parameters that
vary in the list of stimuli.
X is a vector of the values of the INDEPENDENT_VARIABLES. Each column
should have the value for each entry in INDEPENDENT_VARIABLES. NaN
can be used to indicate control stimuli (aka blank stimuli).
R is a vector of the responses to each stimulus. It should have the same
number of rows as X.
NOISE is a scalar that indicates how much noise with mean 0 and standard deviation
equal to the value of R should be added to the stimulus response on each trial.
0 indicates no noise should be added, 1 indicates that the standard deviation
of the noise to be added should be 1 * the value of the response, etc.
REPS is the number of times to repeat each stimulus.
This function takes additional arguments as NAME/VALUE pairs:
|------------------------------------|---------------------------------------------------------|
| Parameter (default) | Description |
|------------------------------------|---------------------------------------------------------|
| stim_duration (2) | Duration of each mock stimulus |
| stim_duration_min (0.2) | Minumum duration of a mock stimulus presentation |
| | (set so that firing rate can be matched) |
| interstimulus_interval(3) | Interstimulus interval |
| epochid ('mockepoch') | The name of the stimulator epoch that is created. |
|------------------------------------|---------------------------------------------------------|
Example:
stimulator_id = '12345'; % just for the example
param_struct = struct('spatial_frequency',0.5);
independent_variable = {'contrast'};
X = [ 0 ; 0.5 ; 1];
R = [ 0 ; 2 ; 4]; % spikes/sec
noise = 0;
reps = 1;
stim_pres_doc = ndi.mock.fun.stimulus_presentation(stimulator_id,param_struct,independent_variable,X,R,noise,reps);
disp(['Displaying stimulus parameters']);
for i=1:size(X,1), stim_pres_doc.document_properties.stimulus_presentation.stimuli(i).parameters, end;