@@ -301,6 +301,17 @@ def generate_processing_scripts(dir_name, blech_clust_dir, electrode_layout_fram
301
301
electrodes_list = file_lists [file_type [0 ]]['electrodes' ]
302
302
dig_in_file_list = file_lists [file_type [0 ]]['dig_in' ]
303
303
304
+ if file_type == ['one file per channel' ]:
305
+ print ("\t One file per CHANNEL Detected" )
306
+ # Read dig-in data
307
+ # Pull out the digital input channels used,
308
+ # and convert them to integers
309
+ dig_in_int = [x .split ('-' )[- 1 ].split ('.' )[0 ] for x in dig_in_file_list ]
310
+ dig_in_int = sorted ([(x ) for x in dig_in_int ])
311
+ elif file_type == ['one file per signal type' ]:
312
+ print ("\t One file per SIGNAL Detected" )
313
+ dig_in_int = np .arange (info_dict ['dig_ins' ]['count' ])
314
+
304
315
# Use info file for port list calculation
305
316
info_file = np .fromfile (dir_name + '/info.rhd' , dtype = np .dtype ('float32' ))
306
317
sampling_rate = int (info_file [2 ])
@@ -310,20 +321,22 @@ def generate_processing_scripts(dir_name, blech_clust_dir, electrode_layout_fram
310
321
num_recorded_samples = len (np .fromfile (
311
322
dir_name + '/' + 'time.dat' , dtype = np .dtype ('float32' )))
312
323
total_recording_time = num_recorded_samples / sampling_rate # In seconds
324
+ ports = info_dict ['ports' ]
313
325
314
326
check_str = f'Amplifier files: { electrodes_list } \n Sampling rate: { sampling_rate } Hz' \
315
- f'\n Digital input files: { dig_in_file_list } \n ---------- \n \n '
327
+ f'\n Digital input files: { dig_in_file_list } \n Ports : { ports } \n ---------- \n \n '
316
328
print (check_str )
317
- ports = info_dict ['ports' ]
318
329
319
330
if file_type [0 ] == 'traditional' :
331
+ print ('Tranditional INTAN file format detected' )
320
332
rhd_file_list = file_lists [file_type [0 ]]['rhd' ]
321
333
with open (rhd_file_list [0 ], 'rb' ) as f :
322
334
header = read_header (f )
323
335
# temp_file, data_present = importrhdutilities.load_file(file_list[0])
324
336
amp_channel_ports = [x ['port_prefix' ] for x in header ['amplifier_channels' ]]
325
337
amp_channel_names = [x ['native_channel_name' ] for x in header ['amplifier_channels' ]]
326
338
dig_in_channels = [x ['native_channel_name' ] for x in header ['board_dig_in_channels' ]]
339
+ dig_in_int = sorted ([x .split ('-' )[- 1 ].split ('.' )[0 ] for x in dig_in_channels ])
327
340
sampling_rate = int (header ['sample_rate' ])
328
341
ports = np .unique (amp_channel_ports )
329
342
@@ -335,27 +348,6 @@ def generate_processing_scripts(dir_name, blech_clust_dir, electrode_layout_fram
335
348
"""
336
349
print (check_str )
337
350
338
-
339
-
340
- if file_type == ['one file per channel' ]:
341
- print ("\t One file per CHANNEL Detected" )
342
- # Read dig-in data
343
- # Pull out the digital input channels used,
344
- # and convert them to integers
345
- dig_in_int = [x .split ('-' )[- 1 ].split ('.' )[0 ] for x in dig_in_file_list ]
346
- dig_in_int = sorted ([(x ) for x in dig_in_int ])
347
- elif file_type == ['one file per signal type' ]:
348
- print ("\t One file per SIGNAL Detected" )
349
- dig_in_int = np .arange (info_dict ['dig_ins' ]['count' ])
350
- elif file_type == ['traditional' ]:
351
- print ('Tranditional INTAN file format detected' )
352
- dig_in_int = sorted ([x .split ('-' )[- 1 ].split ('.' )[0 ] for x in dig_in_channels ])
353
-
354
- check_str = f'ports used: { ports } \n sampling rate: { sampling_rate } Hz' \
355
- f'\n digital inputs on intan board: { dig_in_int } '
356
-
357
- print (check_str )
358
-
359
351
all_car_group_vals = []
360
352
for region_name , region_elecs in info_dict ['electrode_layout' ].items ():
361
353
if not region_name == 'emg' :
0 commit comments