Skip to content

Commit 8725078

Browse files
committed
Add emg muscle, virus region, and opto-fiber region as inputs
1 parent f0a1f72 commit 8725078

File tree

1 file changed

+41
-4
lines changed

1 file changed

+41
-4
lines changed

blech_exp_info.py

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,21 @@
5151

5252
# Extract details from name of folder
5353
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+
5461
this_dict = {
5562
"name": splits[0],
5663
"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+
}
5969

6070
##################################################
6171
# Brain Regions and Electrode Layout
@@ -175,9 +185,17 @@ def confirm_check(x):
175185
layout_frame_filled.electrode_ind.isin(orig_emg_electrodes)].\
176186
unique()
177187
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()
178195
else:
179196
fin_emg_port = []
180197
orig_emg_electrodes = []
198+
emg_muscle_str = ''
181199

182200
fin_perm = layout_dict
183201

@@ -335,8 +353,24 @@ def laser_check(x):
335353
onset_time, duration = [int(x) for x in nums]
336354
else:
337355
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()
338370
else:
339371
onset_time, duration = [None, None]
372+
virus_region_str = ''
373+
opto_loc_str = ''
340374

341375
notes = input('Please enter any notes about the experiment. \n :: ')
342376

@@ -360,7 +394,8 @@ def laser_check(x):
360394
},
361395
'emg': {
362396
'port': fin_emg_port,
363-
'electrodes': orig_emg_electrodes},
397+
'electrodes': orig_emg_electrodes,
398+
'muscle': emg_muscle_str},
364399
'electrode_layout': fin_perm,
365400
'taste_params': {
366401
'dig_ins': taste_digins,
@@ -374,7 +409,9 @@ def laser_check(x):
374409
'filenames': laser_digin_filenames,
375410
'trial_count': laser_digin_trials,
376411
'onset': onset_time,
377-
'duration': duration},
412+
'duration': duration,
413+
'virus_region': virus_region_str,
414+
'opto_loc': opto_loc_str},
378415
'notes': notes}
379416

380417

0 commit comments

Comments
 (0)