Group StimsetAPIFunctions

group StimsetAPIFunctions

Code example:

Function StimsetAPIExample()

    string setName, stimsets
    variable numEpochs

    // create new stimulus set
    setName = ST_CreateStimSet("myset", CHANNEL_TYPE_DAC)

    // check that it is there
    stimsets = ST_GetStimsetList(channelType = CHANNEL_TYPE_DAC, searchString = "my*")
    printf "Stimsets %s\r", stimsets

    // inspect global stimulus parameters
    WAVE globalParams = ST_GetStimsetParameters(setName)
    print globalParams

    // use two epochs
    ST_SetStimsetParameter(setName, "Total number of epochs", var = 2)

    // and three steps/sweeps
    ST_SetStimsetParameter(setName, "Total number of steps", var = 3)

    // inspect the just set entry
    numEpochs = ST_GetStimSetParameterAsVariable(setName, "Total number of epochs")
    printf "Number of epochs: %d\r", numEpochs

    ST_SetStimsetParameter(setName, "Type of Epoch 0", var = EPOCH_TYPE_SQUARE_PULSE)
    ST_SetStimsetParameter(setName, "Type of Epoch 1", var = EPOCH_TYPE_PULSE_TRAIN)

    // get the list of possible parameters for the square pulse
    WAVE epochParams = ST_GetStimsetParameters(setName, epochType = EPOCH_TYPE_SQUARE_PULSE)
    print epochParams

    // and pulse train
    WAVE epochParams = ST_GetStimsetParameters(setName, epochType = EPOCH_TYPE_PULSE_TRAIN)
    print epochParams

    // configure square pulse
    ST_SetStimsetParameter(setName, "Duration", epochIndex = 0, var = 500)
    ST_SetStimsetParameter(setName, "Amplitude", epochIndex = 0, var = 0)

    // configure pulse train
    ST_SetStimsetParameter(setName, "Duration", epochIndex = 1, var = 1500)
    ST_SetStimsetParameter(setName, "Amplitude", epochIndex = 1, var = 1)
    ST_SetStimsetParameter(setName, "Sin/chirp/saw frequency", epochIndex = 1, var = 10)
    ST_SetStimsetParameter(setName, "Train pulse duration", epochIndex = 1, var = 20)

    // set an analysis function
    ST_SetStimsetParameter(setName, "Analysis function (generic)", str = "TestAnalysisFunction_V3")

    // add analysis parameter
    AFH_AddAnalysisParameter(setName, "myVarParam", var = 1.23456)

    // use an explicit delta list for the ITI
    ST_SetStimsetParameter(setName, "Inter trial interval op", str = "Explicit")
    ST_SetStimsetParameter(setName, "Inter trial interval ldel", str = "5;7")
End

Functions for manipulating stimulus sets

string ST_GetStimsetList(variable channelType = defaultValue, string searchString = defaultValue, string *WBstimSetList = defaultValue, string *thirdPartyStimSetList = defaultValue)

Return a sorted list of all DA/TTL stim set waves.

Parameters:
  • channelType[in] [optional, defaults to all] CHANNEL_TYPE_DAC or CHANNEL_TYPE_TTL

  • searchString[in] [optional, defaults to “*”] search string in wildcard syntax

  • WBstimSetList[out] [optional] returns the list of stim sets built with the wavebuilder

  • thirdPartyStimSetList[out] [optional] returns the list of third party stim sets not built with the wavebuilder

string ST_CreateStimSet(string baseName, variable stimulusType, variable setNumber = defaultValue, variable saveAsBuiltin = defaultValue)

Create a new stimset with one square pulse epoch with 1ms duration.

Parameters:
  • baseName – user choosable part of the stimset name

  • stimulusType – one of CHANNEL_TYPE_DAC or CHANNEL_TYPE_TTL

  • setNumber – [optional, defaults to 0] stimset number, allows for convenient alphabetic increasing names used in indexing

  • saveAsBuiltin – [optional, defaults to false] allows to create builtin stimsets when enabled

variable ST_RemoveStimSet(string setName)

Remove the given stimulus set and update all relevant GUIs.

wave ST_GetStimsetParameters(string setName, variable epochType = defaultValue)

Returns the available stimsets parameters.

Return the epoch-independent parameters when epochType is not present.

variable ST_GetStimsetParameterAsVariable(string setName, string entry, variable epochIndex = defaultValue)

Return the given stimset numeric parameter.

Parameters:
  • setName – name of the stimset

  • entry – name of the parameter, can be global or epoch

  • epochIndex – [optional, when not given this sets global parameters] epoch index (0-based)

string ST_GetStimsetParameterAsString(string setName, string entry, variable epochIndex = defaultValue)

Return the given stimset string parameter.

Parameters:
  • setName – name of the stimset

  • entry – name of the parameter, can be global or epoch

  • epochIndex – [optional, when not given this sets global parameters] epoch index (0-based)

variable ST_SetStimsetParameter(string setName, string entry, variable epochIndex = defaultValue, variable var = defaultValue, string str = defaultValue)

Set the given stimset parameter.

If you use this function in analysis functions be sure to use an event which happens before the stimset is read, for example PRE_DAQ_EVENT, PRE_SET_EVENT or PRE_SWEEP_CONFIG_EVENT. The last one is always called for each sweep before it is configured.

Parameters:
  • setName – name of the stimset

  • entry – name of the parameter, can be global or epoch

  • epochIndex – [optional, when not given this sets global parameters] epoch index (0-based)

  • var – [optional, one of var/str must be present] numeric parameter to set

  • str – [optional, one of var/str must be present] string parameter to set

Returns:

0 on success, 1 on error