Create the new subtask base code (substitute subtask_name with the real name of the subtask): create_new_subtask_classes('(subtask_name)')
This creates the table code templates for the subtask — (Subtask)Session.m, (Subtask)Block.m & (Subtask)Trial.m — in the U19-pipeline-matlab/schemas/+behavior_subtask directory.
(We will use the "Twolickspouts" subtask for this example.)
%{# Block level data for a twolickspouts subtask session-> behavior_subtask.TwolickspoutsSession-> acquisition.SessionBlock---sublevel : int # sublevel for the blocktrial_params : blob # maze features of current block%}..%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% fill here read corresponding TestSubtask data for each blocktuple.sublevel = block_data.sublevel;tuple.trial_params = block_data.trialParams;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
In this example, two fields were added to the TwolickspoutsBlock table (sublevel & trial_params).
Two things are needed:
Add them to the table definition (the 1st part of the code block).
Set how these fields are read from the block_data variable (search for the fill here section in the code). block_data holds all the block data from the behavior file.
%{ # Trial level data for a twolickspouts subtask session-> behavior_subtask.TwolickspoutsBlock-> acquisition.SessionBlockTrial--- licks : tinyblob # all iterations with lick detected and side trial_difficult_type :varchar(16) # trial type label(easy, medium, difficult, etc) forced_automatic_reward=null : tinyint # 1if reward was forced for trial 0otherwise%}..%%%%%%%%%%%%%%%%%%%%%%%%%%% fill here read corresponding Twolickspouts data for each trial trial_data.licks = curr_trial.licks;ifisfield(curr_trial,'forced_automatic_reward') trial_data.forced_automatic_reward = curr_trial.forced_automatic_reward;else trial_data.forced_automatic_reward =NaN;endifisfield(curr_trial,'trialDifficultyType') trial_data.trial_difficult_type = curr_trial.trialDifficultyType;else trial_data.trial_difficult_type ='';end%%%%%%%%%%%%%%%%%%%%%%%%
In this example, three fields were added to the TwolickspoutsBlockTrial table (licks, trial_difficult_type & forced_automatic_reward).
Two things are needed:
Add them to the table definition (the 1st part of the code block).
Set how these fields are read from the trial_data variable (search for the fill here section in the code). trial_data holds all the trial data from the behavior file.
Once all the code has been written in the "Subtask"Session, "Subtask"Block & "Subtask"BlockTrial codebase, you need to actually create the tables in the DB.
Once all the code for the new subtask has been set up and the tables have been created, the researcher can select a specific subtask to associate with the schedule for a given animal. Subsequent behavior sessions will correspond to that selection.