Skip to content

Commit

Permalink
added redo_rescale option
Browse files Browse the repository at this point in the history
  • Loading branch information
lolaBerkowitz committed Dec 3, 2024
1 parent 06af54e commit 85120b5
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions preprocessing/behavior/process_behavior_batch.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ function process_behavior_batch(data_path,metadata_path,varargin)

% Assumes general behavior file and *maze_coords.csv is in basepath.
p = inputParser;
p.addParameter('overwrite',false,@islogical)
p.addParameter('overwrite',true,@islogical)
p.addParameter('redo_rescale',true,@islogical)

p.parse(varargin{:});
overwrite = p.Results.overwrite;

redo_rescale = p.Results.redo_rescale;

% loop through basepaths and run main function
df = compile_sessions(data_path);
Expand All @@ -26,7 +27,7 @@ function process_behavior_batch(data_path,metadata_path,varargin)
if exist(fullfile(basepath,[basename,'.animal.behavior.mat'])) & ~overwrite
continue
else
main(basepath,metadata_path)
main(basepath,metadata_path,overwrite,redo_rescale)
end
else
disp('Missing DLC for a video')
Expand All @@ -39,7 +40,7 @@ function process_behavior_batch(data_path,metadata_path,varargin)
end


function main(basepath,metadata_path)
function main(basepath,metadata_path,overwrite,redo_rescale)

basename = basenameFromBasepath(basepath);
% check is session file exists, if not make one
Expand All @@ -51,23 +52,32 @@ function main(basepath,metadata_path)
end

% Make events from DLC
make_events('basepath',basepath);
if ~exist(fullfile(basepath,'digitalin.events.mat'),'file')
make_events('basepath',basepath);
end

% update epochs from digitalIn.events.mat
update_epochs('basepath',basepath,...
'annotate',true,...
'overwrite',true,...
'overwrite',false,...
'ttl_method',[])



% general behavior file
general_behavior_file_SNlab('basepath',basepath,'force_overwrite',true,'smooth_factor',.2,'primary_coords_dlc',4);

% update behavior file from metadata csv
update_behavior_from_metadata(metadata_path,'basepath',basepath);

get_maze_XY('basepath',basepath,'config_path', 'C:\Users\schafferlab\github\SNLab_ephys\behavior\behavior_configs\');
get_maze_XY('basepath',basepath,'config_path', 'C:\Users\schafferlab\github\SNLab_ephys\behavior\behavior_configs\',...
'overwrite',overwrite,'redo_rescale',redo_rescale);

% sacle coordinates to cm
tracking.scale_coords(basepath,overwrite);

restrict_and_transform(basepath,'overwrite',true);
% restrict coordintes to remove extramaze tracking points
tracking.restrict(basepath,overwrite);

end

Expand Down

0 comments on commit 85120b5

Please sign in to comment.