U19-pipeline-matlab repo added to MATLAB path Mounted network cup drives (braininit, u19_dj) Go through U19-pipeline-matlab/tutorials/202103/session01_queries_fetches.mlx to learn basic tips on datajoint. Execute (change the key for the desired session): key = struct ( 'subject_fullname' , 'testuser_T06' , 'session_date' , '2022-04-20' ) ;
[ status, data] = lab. utils. read_behavior_file ( key)
If successful, status = 1 and data = log behavioral file. If you only need to know the path of the behavior file, use: key = struct ( 'subject_fullname' , 'testuser_T06' , 'session_date' , '2022-04-20' ) ;
baseDir = fetch1 ( acquisition. SessionStarted & key, 'new_remote_path_behavior_file' ) ;
[ bucket_path, local_path] = lab. utils. get_path_from_official_dir ( baseDir)
Get trial data (position, velocity, etc.) efficiently with the DB. New method to retrieve all trial data for multiple sessions faster. Execute: key = struct ( 'subject_fullname' , 'testuser_T06' , 'session_date' , '2022-04-20' ) ;
get_full_trial_data ( key)
Get trial data from joined tables as well (e.g. TowersBlock ): key = struct ( 'subject_fullname' , 'testuser_T06' , 'session_date' , '2022-04-20' ) ;
get_full_trial_data ( key, behavior. TowersBlockTrial * behavior. TowersBlock)
Get data from subtasks as well (e.g. Twolickspouts subtask): key = struct ( 'subject_fullname' , 'efonseca_ef114_act114' , 'session_date' , '2023-01-11' ) ;
all_tables = behavior. TowersBlockTrial * behavior. TowersBlock * behavior_subtask. TwolickspoutsBlockTrial * behavior_subtask. TwolickspoutsBlock
get_full_trial_data ( key, all_tables)
Use this function to get behavior-file-like stats (at the trial level) for a single session or multiple sessions. Stats include, but are not limited to: (correct_left, correct_right, cum_correct_trials, performance, goodFraction, numPerMin, numRewardsPerMin, bias). key = struct ( 'subject_fullname' , 'testuser_T06' , 'session_date' , '2022-04-20' ) ;
stat_struct = get_stats_from_session ( key, "all")
Function to unnest the behavior file structure to get a plain trial table (with block data merged). key = struct ( 'subject_fullname' , 'testuser_T06' , 'session_date' , '2022-04-20' ) ;
data_struct = get_behaviorfile_as_db ( key)
Example of how to "translate" a variable from iteration# to trial_time. In this case, the 1st row of the variable licks (iteration#) is translated to lick_times and then added to the original trial structure. key = struct ( 'subject_fullname' , 'efonseca_ef114_act114' , 'session_date' , '2023-01-11' ) ;
trial_data = get_full_trial_data ( key, behavior. TowersBlockTrial * behavior_subtask. TwolickspoutsBlockTrial) ;
licks_time_struct = struct;
for i = 1 : length ( trial_data)
licks_time_struct ( i , 1 ) . lick_times = get_time_from_iter ( trial_data ( i ) . trial_time, trial_data ( i ) . licks ( 1 , : ) ) ;
end
trial_data = cat_struct ( trial_data, licks_time_struct) ;
Plot the trial-by-trial framerate of multiple sessions for comparison. key = 'subject_fullname like "mioffe%" and session_date > "2022-01-01" and session_date < "2022-01-30"' ;
analyze_iteration_time ( key)
Plot the mean framerate by level and rig for multiple sessions. key = 'subject_fullname like "mioffe%" and session_date > "2022-01-01" and session_date < "2022-12-10"' ;
analyze_iteration_time_level_rig ( key)
Plot the mean and max range velocity by session for multiple behavior sessions. key = struct ( 'subject_fullname' , 'emdiamanti_gps7' ) ;
plot_velocity_session ( key)
Get the default paths for network cup drives across different OSes and spock/scotty (bucket). key = struct ( 'subject_fullname' , 'testuser_T06' , 'session_date' , '2022-04-20' ) ;
baseDir = fetch1 ( acquisition. SessionStarted & key, 'new_remote_path_behavior_file' ) ;
[ bucket_path, local_path] = lab. utils. get_path_from_official_dir ( baseDir)
Fetching from a table with external storage when the corresponding network cup drive is not mounted: Error using dj. store_plugins. File ( line 89 )
Directory `/ Volumes/ u19_dj/ external_dj_blobs` not accessible.
Error in dj. internal. ExternalTable ( line 52 )
self. spec = dj. store_plugins. ( storePlugin) ( config) ;
Error using fread
Invalid file identifier. Use fopen to generate a valid file identifier.
Error in dj. store_plugins. File. download_buffer ( line 63 )
result = fread ( fileID) ;
Just mount all cup drives and try again! The key references more than one session when the function was meant to work for a single session: Error using dj. internal. GeneralRelvar/ fetch1 ( line 250 )
fetch1 can only retrieve a single existing tuple.
Just recreate the key to reference a single session.