@@ -33,10 +33,10 @@ class OpenEphys:
33
33
def __init__ (self , experiment_dir ):
34
34
self .sess_dir = pathlib .Path (experiment_dir )
35
35
36
- oe_file = pyopenephys .File (self .sess_dir .parent ) # this is on the Record Node level
36
+ openephys_file = pyopenephys .File (self .sess_dir .parent ) # this is on the Record Node level
37
37
38
38
# extract the "recordings" for this session
39
- self .experiment = next (experiment for experiment in oe_file .experiments
39
+ self .experiment = next (experiment for experiment in openephys_file .experiments
40
40
if pathlib .Path (experiment .absolute_foldername ) == self .sess_dir )
41
41
42
42
self .recording_time = self .experiment .datetime
@@ -58,47 +58,48 @@ def load_probe_data(self):
58
58
probes = {}
59
59
for processor in self .experiment .settings ['SIGNALCHAIN' ]['PROCESSOR' ]:
60
60
if processor ['@pluginName' ] in ('Neuropix-PXI' , 'Neuropix-3a' ):
61
- if processor ['@pluginName' ] == 'Neuropix-3a' :
62
- oe_probe = Probe (processor )
63
- probes [oe_probe .probeSN ] = oe_probe
61
+ if (processor ['@pluginName' ] == 'Neuropix-3a'
62
+ or 'NP_PROBE' not in processor ['EDITOR' ]):
63
+ probe = Probe (processor )
64
+ probes [probe .probe_SN ] = probe
64
65
else :
65
66
for probe_index in range (len (processor ['EDITOR' ]['NP_PROBE' ])):
66
- oe_probe = Probe (processor , probe_index )
67
- probes [oe_probe .probe_SN ] = oe_probe
67
+ probe = Probe (processor , probe_index )
68
+ probes [probe .probe_SN ] = probe
68
69
69
- for probe_index , probe_SN in enumerate (probes . keys () ):
70
+ for probe_index , probe_SN in enumerate (probes ):
70
71
71
- oe_probe = probes [probe_SN ]
72
+ probe = probes [probe_SN ]
72
73
73
74
for rec in self .experiment .recordings :
74
- for cont_info , analog_signal in zip (rec ._oebin ['continuous' ],
75
- rec .analog_signals ):
76
- if cont_info ['source_processor_id' ] != oe_probe .processor_id :
75
+ for continuous_info , analog_signal in zip (rec ._oebin ['continuous' ],
76
+ rec .analog_signals ):
77
+ if continuous_info ['source_processor_id' ] != probe .processor_id :
77
78
continue
78
79
79
- if cont_info ['source_processor_sub_idx' ] == probe_index * 2 : # ap data
80
- assert cont_info ['sample_rate' ] == analog_signal .sample_rate == 30000
81
- cont_type = 'ap'
80
+ if continuous_info ['source_processor_sub_idx' ] == probe_index * 2 : # ap data
81
+ assert continuous_info ['sample_rate' ] == analog_signal .sample_rate == 30000
82
+ continuous_type = 'ap'
82
83
83
- oe_probe .recording_info ['recording_count' ] += 1
84
- oe_probe .recording_info ['recording_datetimes' ].append (
84
+ probe .recording_info ['recording_count' ] += 1
85
+ probe .recording_info ['recording_datetimes' ].append (
85
86
rec .datetime )
86
- oe_probe .recording_info ['recording_durations' ].append (
87
+ probe .recording_info ['recording_durations' ].append (
87
88
float (rec .duration ))
88
- oe_probe .recording_info ['recording_files' ].append (
89
- rec .absolute_foldername / 'continuous' / cont_info ['folder_name' ])
89
+ probe .recording_info ['recording_files' ].append (
90
+ rec .absolute_foldername / 'continuous' / continuous_info ['folder_name' ])
90
91
91
- elif cont_info ['source_processor_sub_idx' ] == probe_index * 2 + 1 : # lfp data
92
- assert cont_info ['sample_rate' ] == analog_signal .sample_rate == 2500
93
- cont_type = 'lfp'
92
+ elif continuous_info ['source_processor_sub_idx' ] == probe_index * 2 + 1 : # lfp data
93
+ assert continuous_info ['sample_rate' ] == analog_signal .sample_rate == 2500
94
+ continuous_type = 'lfp'
94
95
95
- if getattr (oe_probe , cont_type + '_meta' ) is None :
96
- cont_info ['channels_ids' ] = analog_signal .channel_ids
97
- cont_info ['channels_names' ] = analog_signal .channel_names
98
- cont_info ['channels_gains' ] = analog_signal .gains
99
- setattr (oe_probe , cont_type + '_meta' , cont_info )
96
+ if getattr (probe , continuous_type + '_meta' ) is None :
97
+ continuous_info ['channels_ids' ] = analog_signal .channel_ids
98
+ continuous_info ['channels_names' ] = analog_signal .channel_names
99
+ continuous_info ['channels_gains' ] = analog_signal .gains
100
+ setattr (probe , continuous_type + '_meta' , continuous_info )
100
101
101
- oe_probe .__dict__ [f'{ cont_type } _analog_signals' ].append (analog_signal )
102
+ probe .__dict__ [f'{ continuous_type } _analog_signals' ].append (analog_signal )
102
103
103
104
return probes
104
105
@@ -108,11 +109,12 @@ class Probe:
108
109
def __init__ (self , processor , probe_index = 0 ):
109
110
self .processor_id = int (processor ['@NodeId' ])
110
111
111
- if processor ['@pluginName' ] == 'Neuropix-3a' :
112
-
112
+ if processor ['@pluginName' ] == 'Neuropix-3a' or 'NP_PROBE' not in processor ['EDITOR' ]:
113
113
self .probe_info = processor ['EDITOR' ]['PROBE' ]
114
114
self .probe_SN = self .probe_info ['@probe_serial_number' ]
115
- self .probe_model = "Neuropixels 3A"
115
+ self .probe_model = {
116
+ "Neuropix-PXI" : "neuropixels 1.0 - 3B" ,
117
+ "Neuropix-3a" : "neuropixels 1.0 - 3A" }[processor ['@pluginName' ]]
116
118
else :
117
119
self .probe_info = processor ['EDITOR' ]['NP_PROBE' ][probe_index ]
118
120
self .probe_SN = self .probe_info ['@probe_serial_number' ]
0 commit comments