Create new subtask base code (substitute subtask_name with the real name of the subtask: create_new_subtask_classes('(subtask_name)')
This will create table codes templates for subtask : (Subtask)Session.m, (Subtask)Block.m & (Subtask)Trial.m on the U19-pipeline-matlab/schemas/+behavior_subtask directory:
(We will use “Twolickspouts” subtask for this example).
%{
# Block level data for a twolickspouts subtask session
-> behavior_subtask.TwolickspoutsSession
-> acquisition.SessionBlock
---
sublevel : int # sublevel for the block
trial_params : blob # maze features of current block
%}
.
.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% fill here read corresponding TestSubtask data for each block
tuple.sublevel = block_data.sublevel;
tuple.trial_params = block_data.trialParams;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
In this example two fields were added to TwolickspoutsBlock table: (sublevel & trial_params)
Two things are needed:
Adding them to the table definition (1st part of the code block)
Add how this fields are being set from block_data variable: (search for fill here section on the code). block_data has all block data from 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 # 1 if reward was forced for trial 0 otherwise
%}
.
.
%%%%%%%%%%%%%%%%%%%%%%%
%%%% fill here read corresponding Twolickspouts data for each trial
trial_data.licks = curr_trial.licks;
if isfield(curr_trial, 'forced_automatic_reward')
trial_data.forced_automatic_reward = curr_trial.forced_automatic_reward;
else
trial_data.forced_automatic_reward = NaN;
end
if isfield(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 TwolickspoutsBlockTrial table: (licks & trial_difficult_type, forced_automatic_reward)
Two things are needed:
Adding them to the table definition (1st part of the code block)
Add how this fields are being set from trial_data variable: (search for fill here section on the code). trial_data has all trial data from behavior file.
After all code has been written on "Subtask"Session, "Subtask"Block & "Subtas"BlockTrial codebase it is needed to actually create the tables in the DB.
After all code for new sbutask has been set up and tables have been created the researcher will be able to select a specific subtask that will be associated with the schedule for a given animal. Subsequent behavior sessions will correspond to that selection.