@@ -357,7 +357,11 @@ def _make_npx_probe_from_description(probe_description, elec_ids, shank_ids):
357357 probe .set_contact_ids (contact_ids )
358358
359359 # Add planar contour
360- polygon = np .array (get_probe_contour_vertices (probe_description ["shank_width_um" ], probe_description ["tip_length_um" ], get_probe_length (model_name )))
360+ polygon = np .array (
361+ get_probe_contour_vertices (
362+ probe_description ["shank_width_um" ], probe_description ["tip_length_um" ], get_probe_length (model_name )
363+ )
364+ )
361365
362366 contour = []
363367 shank_pitch = probe_description ["shank_pitch_um" ]
@@ -367,10 +371,12 @@ def _make_npx_probe_from_description(probe_description, elec_ids, shank_ids):
367371
368372 # final contour_shift
369373 middle_of_bottommost_electrode_to_top_of_shank_tip = 11
370- contour_shift = np .array ([
371- - probe_description ["odd_row_horz_offset_left_edge_to_leftmost_electrode_center_um" ],
372- - middle_of_bottommost_electrode_to_top_of_shank_tip ,
373- ])
374+ contour_shift = np .array (
375+ [
376+ - probe_description ["odd_row_horz_offset_left_edge_to_leftmost_electrode_center_um" ],
377+ - middle_of_bottommost_electrode_to_top_of_shank_tip ,
378+ ]
379+ )
374380 contour = np .array (contour ) + contour_shift
375381 probe .set_planar_contour (contour )
376382
@@ -420,7 +426,7 @@ def _read_imro_string(imro_str: str, imDatPrb_pn: Optional[str] = None) -> Probe
420426 probe_features = json .load (open (probe_features_filepath , "r" ))
421427 pt_metadata , fields = get_probe_metadata_from_probe_features (probe_features , imDatPrb_pn )
422428
423- #fields = probe_description["fields_in_imro_table"]
429+ # fields = probe_description["fields_in_imro_table"]
424430 contact_info = {k : [] for k in fields }
425431 for field_values_str in imro_table_values_list : # Imro table values look like '(value, value, value, ... '
426432 # Split them by space to get int('value'), int('value'), int('value'), ...)
@@ -464,6 +470,7 @@ def _read_imro_string(imro_str: str, imDatPrb_pn: Optional[str] = None) -> Probe
464470
465471 return probe
466472
473+
467474def get_probe_metadata_from_probe_features (probe_features : dict , imDatPrb_pn : str ):
468475 """
469476 Parses the `probe_features` dict, to cast string to appropriate types
@@ -488,20 +495,29 @@ def get_probe_metadata_from_probe_features(probe_features: dict, imDatPrb_pn: st
488495 for key in probe_metadata .keys ():
489496 if key in ["num_shanks" , "cols_per_shank" , "rows_per_shank" , "adc_bit_depth" , "num_readout_channels" ]:
490497 probe_metadata [key ] = int (probe_metadata [key ])
491- elif key in ["electrode_pitch_horz_um" , "electrode_pitch_vert_um" , "electrode_size_horz_direction_um" , "shank_pitch_um" , "shank_width_um" , "tip_length_um" , "even_row_horz_offset_left_edge_to_leftmost_electrode_center_um" , "odd_row_horz_offset_left_edge_to_leftmost_electrode_center_um" ]:
498+ elif key in [
499+ "electrode_pitch_horz_um" ,
500+ "electrode_pitch_vert_um" ,
501+ "electrode_size_horz_direction_um" ,
502+ "shank_pitch_um" ,
503+ "shank_width_um" ,
504+ "tip_length_um" ,
505+ "even_row_horz_offset_left_edge_to_leftmost_electrode_center_um" ,
506+ "odd_row_horz_offset_left_edge_to_leftmost_electrode_center_um" ,
507+ ]:
492508 probe_metadata [key ] = float (probe_metadata [key ])
493509
494510 # Read the imro table formats to find out which fields the imro tables contain
495511 imro_table_format_type = probe_metadata ["imro_table_format_type" ]
496512 imro_table_fields = probe_features ["z_imro_formats" ][imro_table_format_type + "_elm_flds" ]
497-
513+
498514 # parse the imro_table_fields, which look like (value value value ...)
499515 list_of_imro_fields = imro_table_fields .replace ("(" , "" ).replace (")" , "" ).split (" " )
500516
501517 imro_fields_list = []
502518 for imro_field in list_of_imro_fields :
503519 imro_fields_list .append (imro_field )
504-
520+
505521 imro_fields = tuple (imro_fields_list )
506522
507523 return probe_metadata , imro_fields
0 commit comments