Skip to content

Commit 67ce7ca

Browse files
committed
simplify more
1 parent 2c77e9b commit 67ce7ca

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/probeinterface/neuropixels_tools.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -851,13 +851,14 @@ def read_spikeglx(file: str | Path) -> Probe:
851851
probe = full_probe.get_slice(selected_contact_indices)
852852

853853
# ===== 6. Store IMRO properties (acquisition settings) as annotations =====
854-
# Map IMRO field names to probeinterface field names and add as contact annotations
854+
# Filter IMRO data to only the properties we want to add as annotations
855855
imro_properties_to_add = ("channel", "bank", "bank_mask", "ref_id", "ap_gain", "lf_gain", "ap_hipas_flt")
856+
imro_filtered = {k: v for k, v in imro_per_channel.items() if k in imro_properties_to_add and len(v) > 0}
857+
# Map IMRO field names to probeinterface field names and add as contact annotations
856858
annotations = {}
857-
for imro_field, values in imro_per_channel.items():
858-
if imro_field in imro_properties_to_add and len(values) > 0:
859-
pi_field = imro_field_to_pi_field.get(imro_field)
860-
annotations[pi_field] = values
859+
for imro_field, values in imro_filtered.items():
860+
pi_field = imro_field_to_pi_field.get(imro_field)
861+
annotations[pi_field] = values
861862
probe.annotate_contacts(**annotations)
862863

863864
# ===== 7. Slice to saved channels (if subset was saved) =====

0 commit comments

Comments
 (0)