@@ -778,16 +778,7 @@ def write_csv(file, probe):
778
778
"elec_ids" ,
779
779
),
780
780
},
781
- 'Ultra' : {
782
- "x_pitch" : 6 ,
783
- "y_pitch" : 6 ,
784
- "contact_width" : 5 ,
785
- "stagger" : 0.0 ,
786
- "shank_pitch" : 0 ,
787
- "shank_number" : 1 ,
788
- "ncol" : 8
789
- },
790
- #
781
+ # Experimental probes previous to 1.0
791
782
"Phase3a" : {
792
783
"probe_name" : "Phase3a" ,
793
784
"x_pitch" : 32 ,
@@ -906,6 +897,26 @@ def write_csv(file, probe):
906
897
"ap_hp_filters" ,
907
898
),
908
899
},
900
+ # Ultra probe
901
+ 1100 : {
902
+ "probe_name" : "Ultra probe" ,
903
+ "x_pitch" : 6 ,
904
+ "y_pitch" : 6 ,
905
+ "contact_width" : 5 ,
906
+ "stagger" : 0.0 ,
907
+ "shank_pitch" : 0 ,
908
+ "shank_number" : 1 ,
909
+ "ncol" : 8 ,
910
+ "polygon" : polygon_description ["default" ],
911
+ "fields_in_imro_table" : (
912
+ "channel_ids" ,
913
+ "banks" ,
914
+ "references" ,
915
+ "ap_gains" ,
916
+ "lf_gains" ,
917
+ "ap_hp_filters" ,
918
+ ),
919
+ },
909
920
}
910
921
911
922
@@ -961,35 +972,36 @@ def _read_imro_string(imro_str: str, imDatPrb_pn: str = None) -> Probe:
961
972
elif len (header ) == 2 :
962
973
imDatPrb_type , num_contact = header
963
974
else :
964
- raise ValueError (f'read_imro error, the header has a strange length : { len ( header ) } ' )
975
+ raise ValueError (f'read_imro error, the header has a strange shape : { header } ' )
965
976
966
977
if imDatPrb_type in [0 , None ]:
967
978
imDatPrb_type = probe_number_to_probe_type [imDatPrb_pn ]
968
979
969
- fields = npx_probe [imDatPrb_type ]["fields_in_imro_table" ]
980
+ probe_description = npx_probe [imDatPrb_type ]
981
+ fields = probe_description ["fields_in_imro_table" ]
970
982
contact_info = {k : [] for k in fields }
971
983
for i , part in enumerate (parts ):
972
984
values = tuple (map (int , part [1 :].split (' ' )))
973
985
for k , v in zip (fields , values ):
974
986
contact_info [k ].append (v )
975
987
976
988
channel_ids = np .array (contact_info ['channel_ids' ])
977
- if 'elec_ids' in contact_info :
978
- elec_ids = np .array (contact_info ['elec_ids' ])
979
-
980
- if imDatPrb_type == 0 or imDatPrb_type == 'Phase3a' or (imDatPrb_type in (1015 , 1022 , 1030 , 1031 , 1032 )):
981
- # for NP1 and previous the elec_id is not in the list
989
+ probe_types_without_elec_ids_in_their_imro_table = (0 , 1015 , 1022 , 1030 , 1031 , 1032 , "Phase3a" , 1100 )
990
+ if imDatPrb_type in probe_types_without_elec_ids_in_their_imro_table :
982
991
banks = np .array (contact_info ['banks' ])
983
992
elec_ids = banks * 384 + channel_ids
984
-
993
+ else :
994
+ elec_ids = np .array (contact_info ['elec_ids' ])
995
+
985
996
# compute position
986
- y_idx , x_idx = np .divmod (elec_ids , npx_probe [ imDatPrb_type ] ["ncol" ])
987
- x_pitch = npx_probe [ imDatPrb_type ] ["x_pitch" ]
988
- y_pitch = npx_probe [ imDatPrb_type ] ["y_pitch" ]
997
+ y_idx , x_idx = np .divmod (elec_ids , probe_description ["ncol" ])
998
+ x_pitch = probe_description ["x_pitch" ]
999
+ y_pitch = probe_description ["y_pitch" ]
989
1000
990
- stagger = np .mod (y_idx + 1 , 2 ) * npx_probe [ imDatPrb_type ] ["stagger" ]
1001
+ stagger = np .mod (y_idx + 1 , 2 ) * probe_description ["stagger" ]
991
1002
x_pos = x_idx * x_pitch + stagger
992
1003
y_pos = y_idx * y_pitch
1004
+ positions = np .stack ((x_pos , y_pos ), axis = 1 )
993
1005
994
1006
if imDatPrb_type == 24 :
995
1007
shank_ids = np .array (contact_info ['shank_id' ])
@@ -998,31 +1010,31 @@ def _read_imro_string(imro_str: str, imDatPrb_pn: str = None) -> Probe:
998
1010
shank_ids = None
999
1011
contact_ids = [f'e{ elec_id } ' for elec_id in elec_ids ]
1000
1012
1001
-
1002
- positions = np .zeros ((num_contact , 2 ), dtype = 'float64' )
1003
- positions [:, 0 ] = x_pos
1004
- positions [:, 1 ] = y_pos
1005
-
1006
1013
# construct Probe object
1007
1014
probe = Probe (ndim = 2 , si_units = 'um' )
1008
- probe .set_contacts (positions = positions , shapes = 'square' ,
1009
- shank_ids = shank_ids ,
1010
- shape_params = {'width' : npx_probe [imDatPrb_type ]["contact_width" ]})
1015
+ probe .set_contacts (
1016
+ positions = positions ,
1017
+ shapes = "square" ,
1018
+ shank_ids = shank_ids ,
1019
+ shape_params = {"width" : probe_description ["contact_width" ]},
1020
+ )
1021
+
1011
1022
probe .set_contact_ids (contact_ids )
1012
1023
1013
1024
# Add planar contour
1014
- polygon = np .array (npx_probe [ imDatPrb_type ] ["polygon" ])
1025
+ polygon = np .array (probe_description ["polygon" ])
1015
1026
contour = []
1016
- for shank_id in range (npx_probe [imDatPrb_type ]["shank_number" ]):
1017
- shift = [npx_probe [imDatPrb_type ]["shank_pitch" ] * shank_id , 0 ]
1027
+ shank_pitch = probe_description ["shank_pitch" ]
1028
+ for shank_id in range (probe_description ["shank_number" ]):
1029
+ shift = [shank_pitch * shank_id , 0 ]
1018
1030
contour += list (polygon + shift )
1019
1031
1020
1032
# shift
1021
1033
contour = np .array (contour ) - [11 , 11 ]
1022
1034
probe .set_planar_contour (contour )
1023
1035
1024
1036
# this is scalar annotations
1025
- probe_name = npx_probe [ imDatPrb_type ] ["probe_name" ]
1037
+ probe_name = probe_description ["probe_name" ]
1026
1038
probe .annotate (
1027
1039
name = probe_name ,
1028
1040
manufacturer = "IMEC" ,
@@ -1346,7 +1358,7 @@ def read_openephys(
1346
1358
ptype = 0
1347
1359
x_shift = - 11
1348
1360
elif "Ultra" in pname :
1349
- ptype = "Ultra"
1361
+ ptype = 1100
1350
1362
x_shift = - 8
1351
1363
else : # Probe type unknown
1352
1364
ptype = None
0 commit comments