MasterScan
Lab_Matlab_control Master Branch
|
Properties and Events | |
Property | taskID = -1 |
A special-purpose version of a topsTreeNode with properties and functions that facilitate operating with tasks. More... | |
Property | taskTypeID = -1 |
Unique type identifier. | |
Property | trialData |
An array of structs describing each trial. | |
Property | trialCount = 0 |
Index of current trial (in trialIndices array) | |
Property | incrementTrialMethod = 'auto' |
How to increment trials in prepareForNextTrial 'auto' ... More... | |
incrementTrial | |
For controlling incrementTrialMethod (should have a struct of args for each method) | |
Property | trialIterations = 1 |
Number of times to run through this node's trials. | |
Property | trialIterationMethod = 'random' |
How to run through this node's trials –'sequential' or 'random' order. | |
Property | randomizeWhenRepeating = true |
Flag indicating whether or not to randomize order of repeated trial. | |
Property | interTrialInterval = 1.0 |
Inter-trial interval, in seconds. | |
Property | trialIndices = [] |
Array of trial indices, in order of calling. | |
Property | pauseBeforeTask = 0 |
Time to pause before task starts. More... | |
![]() | |
Property | iterations = 1 |
number of times to run through this node's children | |
Property | iterationCount = 0 |
count of iterations while running | |
Property | iterationMethod = 'sequential' |
how to run through this node's children–'sequential' or 'random' order | |
Property | nodeData = [] |
For any node-specific data. | |
Property | helpers = struct() |
The helpers. | |
Property | inheritHelpers = 'all' |
Flag indicating whether to inherit all helpers from parent. | |
Property | helperTypes = {'drawable', 'targets', 'playable', 'readable', 'writable', 'message', 'general'} |
List of helper types. | |
![]() | |
Property | children = {} |
cell array of topsRunnable (or subclass) objects | |
![]() | |
Property | startFevalable = {} |
optional fevalable cell array to invoke just before running | |
Property | finishFevalable = {} |
optional fevalable cell array to invoke just after running | |
Property | isRunning = false |
true or false, whether this object is currently busy running | |
Property | caller |
topsRunnable that invoked run() on this object, or empty | |
Property | startString = 'start' |
string used for topsDataLog entry just before run() | |
Property | finishString = 'finish' |
string used for topsDataLog entry just after run() | |
![]() | |
Property | name = '' |
a string name to indentify the object | |
Property | clockFunction =@topsClock |
clock function, to standardize | |
Protected Properties | |
stateMachine Property | completedTrial = false |
The state machine. More... | |
Property | controlActiveFlags |
Control keyboard active flags, so we can reset them. | |
Property | trialDataDefaultFields = {'taskID', 'trialIndex', 'trialStart', 'trialEnd'} |
Default trialData fields. | |
Methods | |
self | topsTreeNodeTask (varargin) |
% Constuct with optional arguments. More... | |
start (self) | |
% Start task method | |
finish (self) | |
% Finish task method | |
startTask (self) | |
% Blank startTask method – overload in subclass More... | |
finishTask (self) | |
% Blank finishTask method – overload in subclass | |
makeTrials (self, independentVariables, trialIterations) | |
% makeTrials More... | |
makeTrialData (self, ivvStruct) | |
Utility for taking an array of structs, adding default fields and storing as self.trialData. More... | |
loadTrials (self, filename) | |
% loadTrials More... | |
saveTrials (self, filename, variableList) | |
% saveTrials More... | |
trial | getTrial (self, trialCount) |
% Get a trial struct by trialCount index | |
setTrial (self, trial, trialCount) | |
% Set a trial struct by trialCount index | |
setTrialData (self, trialIndex, varargin) | |
% Utility to save timing data in the trialData struct using a standard format | |
data | getTrialData (self, fieldName, trialIndex) |
% Utility for getting trialData value(s) | |
setTrialDataValue (self, name, value, trialIndex) | |
% Utility function to set the value of a property in the current trial data struct | |
blankScreen (self, name) | |
% Utility function to blank the screen and save a timestamp More... | |
![]() | |
self | topsTreeNode (varargin) |
Constuct with name optional. More... | |
child | newChildNode (self, varargin) |
Create a new topsTreeNode child and add it beneath this node. More... | |
addChild (self, child) | |
Add a child and process inheritance. | |
abort (self) | |
Convenient routine to abort running self and children. | |
addCall (self, tag, fevalable, name, theObject) | |
Add fevalable to the start/finish fevalable call list. It's a. More... | |
theHelpers | addHelpers (self, constructor, varargin) |
Add helper(s) to the node. More... | |
helper | getHelperByClassName (self, name) |
Find a helper of the named class. | |
helper | getControlHelper (self) |
Get the control helper (see topsTreeNodeTopNode) | |
run (self) | |
Recursively run(), starting with this node. More... | |
![]() | |
self | topsRunnableComposite (varargin) |
Constuct with name optional. More... | |
fig | gui (self) |
Open a GUI to view object details. More... | |
addChild (self, child) | |
Add a child beneath this object. More... | |
removeChild (self, child) | |
Remove a child beneath this object. More... | |
selector | isChild (self, child) |
Check if child is there. | |
![]() | |
self | topsRunnable (varargin) |
Constuct with name optional. More... | |
run (self) | |
Do flow control. More... | |
g | gui (self) |
Show heirarchy of topsRunnable[Composite] objects. | |
start (self) | |
Log action and prepare to do flow control. More... | |
finish (self) | |
Log, action and finish doing flow control. More... | |
logAction (self, actionName, actionData) | |
Log an event of interest with topsDataLog. More... | |
logFeval (self, fevalName, fevalable) | |
Log a function call with topsDataLog. More... | |
![]() | |
self | topsFoundation (name) |
Constuct with name optional. More... | |
fig | gui (self) |
Open a GUI to view object details. More... | |
p | guiPanel (self, varargin) |
Make a topsDetailPanel with details about this object. More... | |
Protected Methods | |
addStateMachineWithDrawing (self, states, varargin) | |
% Utility to add a state machine that sets up drawing More... | |
addStateMachine (self, states, activeList, compositeChildren, nodeChildren) | |
% Utility to add a state machine More... | |
startTaskTrial (self) | |
% Start a trial ... can be overloaded in task subclass | |
finishTaskTrial (self) | |
% Finish a trial ... can be overloaded in task subclass | |
prepareForNextTrial (self) | |
% Finish the current trial and figure out what happens next. If done with this task, call the task's finish() routine, which should allow the parent topsTreeNode to find the next task. More... | |
updateStatus (self, taskStatusString, trialStatusString) | |
% show status | |
setNextState (self, condition, thisState, nextStateIfTrue, nextStateIfFalse) | |
% setNextState More... | |
debugStates (self, debugFlag) | |
% debugStates More... | |
kb | activateControlKeyboard (self, activateAll) |
% activateControlKeyboard More... | |
deactivateControlKeyboard (self) | |
% deactivateControlKeyboard More... | |
Additional Inherited Members | |
![]() | |
static c index | cellAdd (c, item, index) |
Add an item to a cell array. More... | |
static selector | cellContains (c, item) |
Does a cell array conatin an item? More... | |
static c | cellRemoveItem (c, item) |
Remove an item from a cell array. More... | |
static c | cellRemoveElement (c, index) |
Remove indexed elements from a cell array. More... | |
static index selector | findStructName (s, name) |
Where is the given name in the given struct array? More... | |
self topsTreeNodeTask | ( | varargin | ) |
% Constuct with optional arguments.
If any arguments are given, the first one must be the name. Any remaining arguments are property/value pairs – and note that properties can be cell array of strings for property structs
startTask | ( | self | ) |
% Blank startTask method – overload in subclass
Overloaded method can/should fill the following fields, as needed: stateMachineStates stateMachineActiveList stateMachineCompositeChildren
makeTrials | ( | self | , |
independentVariables | , | ||
trialIterations | |||
) |
% makeTrials
Utility to make trialData array using array of structs, which is by convention stored as task.independentVariables. This struct is assumed to be organized as: struct.(propertyName).values struct.(propertyName).priors trialIterations is number of repeats of each combination of independent variables
makeTrialData | ( | self | , |
ivvStruct | |||
) |
Utility for taking an array of structs, adding default fields and storing as self.trialData.
ivStruct is the structure of independent variable values
loadTrials | ( | self | , |
filename | |||
) |
% loadTrials
Utility to load trialData from a file.
saveTrials | ( | self | , |
filename | , | ||
variableList | |||
) |
% saveTrials
Utility to save trialData to a file. Arguments: filename ... string name, possibly with path variableList ... cell array of string names of variables to save
blankScreen | ( | self | , |
name | |||
) |
% Utility function to blank the screen and save a timestamp
name is string name of trialData field
|
protected |
% Utility to add a state machine that sets up drawing
Varargin is in pairs:
|
protected |
% Utility to add a state machine
Arguments: states ... the cell array of state specs for topsStateMachine.addMultipleStates activeList ... This determines which states will correspond to automatic, repeated calls to the given ensemble methods. See topsActivateEnsemblesByState for details. compositeChildren ... Cell array of children to add to the stateMachineComposite nodeChildren ... Cell array of children to add to this topsTreeNode
|
protected |
% Finish the current trial and figure out what happens next. If done with this task, call the task's finish() routine, which should allow the parent topsTreeNode to find the next task.
Checks self.completedTrial, a boolean flag indicating that this trial finished or needs to be repeated
|
protected |
% setNextState
Utility to conditionally set the next state
|
protected |
% debugStates
Utility to set a flag in the state machine that will print out each state name as it is entered
|
protected |
% activateControlKeyboard
Utility to set up the control keyboard to check for inputs Get all activeFlag values in case the keyboard is being used for something else and the statelist expects certain events to be active... then just set the ones in the control flags struct
|
protected |
% deactivateControlKeyboard
Utility to set up the control keyboard to check for inputs
Property taskID = -1 |
A special-purpose version of a topsTreeNode with properties and functions that facilitate operating with tasks.
This is an alternative approach than making the trials topsTreeNode children. Instead here the trials are defined by an array of structs with trial-specific data that can make it easy to dump that struct into the topsDataLog and keep track of what is going on. Assumes trialData is a struct and automatically adds timing fields. NOTE that this is not yet set up to handle multiple ui objects that each have their own time-base gracefully. Subclasses must re-define startTask finishTask Can optionally define properties: independentVariables ... used by makeTrials() 5/27/18 created by jig Unique identifier
Property incrementTrialMethod = 'auto' |
How to increment trials in prepareForNextTrial 'auto' ...
automatically increment after each good trial 'hazard' ... probabilistically increment wrt fixed hazard
Property pauseBeforeTask = 0 |
Time to pause before task starts.
Negative means wait for 't' keypress if control helper is set up
|
protected |
The state machine.
flag if successefully finished trial (or need to repeat)