@@ -744,6 +744,7 @@ def read_openephys(
744744 oe_version = parse (info_chain .find ("VERSION" ).text )
745745 neuropix_pxi_processor = None
746746 onebox_processor = None
747+ onix_processor = None
747748 for signal_chain in root .findall ("SIGNALCHAIN" ):
748749 for processor in signal_chain :
749750 if "PROCESSOR" == processor .tag :
@@ -752,8 +753,10 @@ def read_openephys(
752753 neuropix_pxi_processor = processor
753754 if "OneBox" in name :
754755 onebox_processor = processor
756+ if "ONIX" in name :
757+ onix_processor = processor
755758
756- if neuropix_pxi_processor is None and onebox_processor is None :
759+ if neuropix_pxi_processor is None and onebox_processor is None and onix_processor is None :
757760 if raise_error :
758761 raise Exception ("Open Ephys can only be read when the Neuropix-PXI or the " "OneBox plugin is used." )
759762 return None
@@ -769,6 +772,8 @@ def read_openephys(
769772 if onebox_processor is not None :
770773 assert neuropix_pxi_processor is None , "Only one processor should be present"
771774 processor = onebox_processor
775+ if onix_processor is not None :
776+ processor = onix_processor
772777
773778 if "NodeId" in processor .attrib :
774779 node_id = processor .attrib ["NodeId" ]
@@ -797,14 +802,20 @@ def read_openephys(
797802 has_streams = False
798803 probe_names_used = None
799804
805+ if onix_processor is not None :
806+ probe_names_used = [probe_name for probe_name in probe_names_used if 'Probe' in probe_name ]
807+
800808 # for Open Ephys version < 1.0 np_probes is in the EDITOR field.
801809 # for Open Ephys version >= 1.0 np_probes is in the CUSTOM_PARAMETERS field.
802810 editor = processor .find ("EDITOR" )
803811 if oe_version < parse ("0.9.0" ):
804812 np_probes = editor .findall ("NP_PROBE" )
805813 else :
806814 custom_parameters = editor .find ("CUSTOM_PARAMETERS" )
807- np_probes = custom_parameters .findall ("NP_PROBE" )
815+ if onix_processor is not None :
816+ np_probes = custom_parameters .findall ("NEUROPIXELSV1E" )
817+ else :
818+ np_probes = custom_parameters .findall ("NP_PROBE" )
808819
809820 if len (np_probes ) == 0 :
810821 if raise_error :
@@ -839,13 +850,18 @@ def read_openephys(
839850 # now load probe info from NP_PROBE fields
840851 np_probes_info = []
841852 for probe_idx , np_probe in enumerate (np_probes ):
842- slot = np_probe .attrib ["slot" ]
843- port = np_probe .attrib ["port" ]
844- dock = np_probe .attrib ["dock" ]
845- probe_part_number = np_probe .attrib ["probe_part_number" ]
846- probe_serial_number = np_probe .attrib ["probe_serial_number" ]
847- # read channels
848- channels = np_probe .find ("CHANNELS" )
853+ if onix_processor is not None :
854+ slot , port , dock = None , None , None
855+ probe_part_number , probe_serial_number = np_probe .attrib ["probePartNumber" ], np_probe .attrib ["probeSerialNumber" ]
856+ channels = np_probe .find ("SELECTED_CHANNELS" )
857+ else :
858+ slot = np_probe .attrib ["slot" ]
859+ port = np_probe .attrib ["port" ]
860+ dock = np_probe .attrib ["dock" ]
861+ probe_part_number = np_probe .attrib ["probe_part_number" ]
862+ probe_serial_number = np_probe .attrib ["probe_serial_number" ]
863+ channels = np_probe .find ("CHANNELS" )
864+
849865 channel_names = np .array (list (channels .attrib .keys ()))
850866 channel_ids = np .array ([int (ch [2 :]) for ch in channel_names ])
851867 channel_order = np .argsort (channel_ids )
@@ -862,18 +878,20 @@ def read_openephys(
862878 else :
863879 shank_ids = None
864880
865- electrode_xpos = np_probe .find ("ELECTRODE_XPOS" )
866- electrode_ypos = np_probe .find ("ELECTRODE_YPOS" )
881+ if onix_processor is None :
882+ electrode_xpos = np_probe .find ("ELECTRODE_XPOS" )
883+ electrode_ypos = np_probe .find ("ELECTRODE_YPOS" )
867884
868- if electrode_xpos is None or electrode_ypos is None :
869- if raise_error :
870- raise Exception ("ELECTRODE_XPOS or ELECTRODE_YPOS is not available in settings!" )
871- return None
872- xpos = np .array ([float (electrode_xpos .attrib [ch ]) for ch in channel_names ])
873- ypos = np .array ([float (electrode_ypos .attrib [ch ]) for ch in channel_names ])
874- positions = np .array ([xpos , ypos ]).T
885+ if electrode_xpos is None or electrode_ypos is None :
886+ if raise_error :
887+ raise Exception ("ELECTRODE_XPOS or ELECTRODE_YPOS is not available in settings!" )
888+ return None
889+ xpos = np .array ([float (electrode_xpos .attrib [ch ]) for ch in channel_names ])
890+ ypos = np .array ([float (electrode_ypos .attrib [ch ]) for ch in channel_names ])
891+ positions = np .array ([xpos , ypos ]).T
892+ else :
893+ positions = np .reshape (np .arange (0 ,384 * 2 * 20 ,20 ), shape = (384 ,2 ))
875894
876- probe_part_number = np_probe .get ("probe_part_number" , None )
877895 pt_metadata , _ , mux_info = get_probe_metadata_from_probe_features (probe_features , probe_part_number )
878896
879897 shank_pitch = pt_metadata ["shank_pitch_um" ]
0 commit comments