51
51
52
52
# Extract details from name of folder
53
53
splits = dir_name .split ("_" )
54
+ # Date and Timestamp are given as 2 sets of 6 digits
55
+ # Extract using regex
56
+ time_pattern = re .compile (r'\d{6}' )
57
+ time_match = time_pattern .findall (dir_name )
58
+ if len (time_match ) != 2 :
59
+ raise ValueError ('Timestamp not found in folder name' )
60
+
54
61
this_dict = {
55
62
"name" : splits [0 ],
56
63
"exp_type" : splits [1 ],
57
- "date" : splits [- 2 ],
58
- "timestamp" : splits [- 1 ]}
64
+ # "date": splits[-2],
65
+ # "timestamp": splits[-1]}
66
+ "date" : time_match [0 ],
67
+ "timestamp" : time_match [1 ],
68
+ }
59
69
60
70
##################################################
61
71
# Brain Regions and Electrode Layout
@@ -175,9 +185,17 @@ def confirm_check(x):
175
185
layout_frame_filled .electrode_ind .isin (orig_emg_electrodes )].\
176
186
unique ()
177
187
fin_emg_port = list (fin_emg_port )
188
+ # Ask for emg muscle
189
+ emg_muscle_str , continue_bool = entry_checker (
190
+ msg = 'Enter EMG muscle name :: ' ,
191
+ check_func = lambda x : True ,
192
+ fail_response = 'Please enter a valid muscle name' )
193
+ if not continue_bool :
194
+ exit ()
178
195
else :
179
196
fin_emg_port = []
180
197
orig_emg_electrodes = []
198
+ emg_muscle_str = ''
181
199
182
200
fin_perm = layout_dict
183
201
@@ -335,8 +353,24 @@ def laser_check(x):
335
353
onset_time , duration = [int (x ) for x in nums ]
336
354
else :
337
355
exit ()
356
+ # Ask for virus region
357
+ virus_region_str , continue_bool = entry_checker (
358
+ msg = 'Enter virus region :: ' ,
359
+ check_func = lambda x : True ,
360
+ fail_response = 'Please enter a valid region' )
361
+ if not continue_bool :
362
+ exit ()
363
+ # Ask for opto-fiber location
364
+ opto_loc_str , continue_bool = entry_checker (
365
+ msg = 'Enter opto-fiber location :: ' ,
366
+ check_func = lambda x : True ,
367
+ fail_response = 'Please enter a valid location' )
368
+ if not continue_bool :
369
+ exit ()
338
370
else :
339
371
onset_time , duration = [None , None ]
372
+ virus_region_str = ''
373
+ opto_loc_str = ''
340
374
341
375
notes = input ('Please enter any notes about the experiment. \n :: ' )
342
376
@@ -360,7 +394,8 @@ def laser_check(x):
360
394
},
361
395
'emg' : {
362
396
'port' : fin_emg_port ,
363
- 'electrodes' : orig_emg_electrodes },
397
+ 'electrodes' : orig_emg_electrodes ,
398
+ 'muscle' : emg_muscle_str },
364
399
'electrode_layout' : fin_perm ,
365
400
'taste_params' : {
366
401
'dig_ins' : taste_digins ,
@@ -374,7 +409,9 @@ def laser_check(x):
374
409
'filenames' : laser_digin_filenames ,
375
410
'trial_count' : laser_digin_trials ,
376
411
'onset' : onset_time ,
377
- 'duration' : duration },
412
+ 'duration' : duration ,
413
+ 'virus_region' : virus_region_str ,
414
+ 'opto_loc' : opto_loc_str },
378
415
'notes' : notes }
379
416
380
417
0 commit comments