Opticka 2.18.1
Opticka is an experiment manager for behavioral research.
Loading...
Searching...
No Matches
userFunctions Class Reference

Customised user functions for a task run. More...

Detailed Description

Customised user functions for a task run.

The state machine's job is to run a set of functions when entering and exiting states. Most required functions (methods in classes) are found in the core opticka classes like screenManager, stateMachine etc. BUT if a user wants to customise their own functions then we need to have a generic class we can load and use where you can add your own methods. This class serves this purpose.

The user should subclass it (or you can make a copy keeping name the same) and add functions there and then save it as a new class somewhere alongside their protocols (if you copy this you can rename the file, but keep the class name the same; if you subclass it then the file and class name should be the same). The user can add their own methods. The class will be added as a uF object and these methods can be used via the state info file, like:

@()myCustomFunction(uF)

IMPORTANT: as these are stored as anonymous function handles in the state machine, any variables passed are set at instantiation time, not at run-time. If you need to get a run-time (changing) variable, make a function. So if you need to get a value X that changes as the experiment runs, make a function like X = getCurrentX() that returns the current value. Now when the state machine calls the function the correct value is returned.

Copyright ©2014-2026 Ian Max Andolina — released: LGPL3, see LICENCE.md

Inheritance diagram for userFunctions:

Public Member Functions

virtual initialSetup (in me)
 
function userFunctions ()
 
function setDelayTimeWithStaircase (in me, in stim, in duration)
 Construct an instance of this class.
 
function resetDelayTime (in me, in stim, in value)
 Use the staircase to set stimulus delay/off time.
 
function testFunction (in me)
 Reset stimulus delay time to a specific value.
 

Public Attributes

Property rE
 runExperiment
 
Property sM
 stateMachine
 
Property s
 screenManager
 
Property task
 taskSequence
 
Property stims
 metaStimulus stimluli
 
Property rM
 reward manager
 
Property io
 I/O manager.
 
Property eT
 eyetracker manager
 
Property tM
 touch manager
 
Property tL
 time logger (saves timestamped messages
 
Property alyx
 alyx manager
 
Property verbose
 toggle to send messages to the command window
 

Constructor & Destructor Documentation

◆ userFunctions()

function userFunctions::userFunctions ( )

Member Function Documentation

◆ initialSetup()

virtual userFunctions::initialSetup ( in  me)
virtual

initial setup to run BEFORE the task starts; this will be called by runExperiment before the state machine starts, and before the first runExperiment.update(stims) call, so you can set up any variables or stimuli here that you want to use in the task. You can also call other functions from here to set things up.

Reimplemented in DMTSFunctions, and myUserFunctions.

◆ resetDelayTime()

function userFunctions::resetDelayTime ( in  me,
in  stim,
in  value 
)

Use the staircase to set stimulus delay/off time.

Parameters
stimIndex of stimulus in stims.
durationOptional extra duration added to off time.

◆ setDelayTimeWithStaircase()

function userFunctions::setDelayTimeWithStaircase ( in  me,
in  stim,
in  duration 
)

Construct an instance of this class.

◆ testFunction()

function userFunctions::testFunction ( in  me)

Reset stimulus delay time to a specific value.

Parameters
stimIndex of stimulus in stims.
valueDelay time value to apply.

Member Data Documentation

◆ alyx

Property userFunctions::alyx

alyx manager

◆ eT

Property userFunctions::eT

eyetracker manager

◆ io

Property userFunctions::io

I/O manager.

◆ rE

Property userFunctions::rE

◆ rM

Property userFunctions::rM

reward manager

◆ s

Property userFunctions::s

◆ sM

Property userFunctions::sM

◆ stims

Property userFunctions::stims

metaStimulus stimluli

◆ task

Property userFunctions::task

◆ tL

Property userFunctions::tL

time logger (saves timestamped messages

◆ tM

Property userFunctions::tM

touch manager

◆ verbose

Property userFunctions::verbose

toggle to send messages to the command window


The documentation for this class was generated from the following file: