Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Mar 28, 2024
1 parent 373741c commit 0273d9b
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/probeinterface/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -1349,20 +1349,22 @@ def read_spikegadgets(file: str | Path) -> ProbeGroup:
sconf = root.find("SpikeConfiguration")

Check warning on line 1349 in src/probeinterface/io.py

View check run for this annotation

Codecov / codecov/patch

src/probeinterface/io.py#L1346-L1349

Added lines #L1346 - L1349 were not covered by tests

# Get number of probes present (each has its own Device element)
probe_configs = [device for device in hconf if device.attrib['name'] == 'NeuroPixels1']
probe_configs = [device for device in hconf if device.attrib["name"] == "NeuroPixels1"]
n_probes = len(probe_configs)
print(n_probes, "Neuropixels 1.0 probes found:")

Check warning on line 1354 in src/probeinterface/io.py

View check run for this annotation

Codecov / codecov/patch

src/probeinterface/io.py#L1352-L1354

Added lines #L1352 - L1354 were not covered by tests

# Container to store Probe objects
probe_group = ProbeGroup()

Check warning on line 1357 in src/probeinterface/io.py

View check run for this annotation

Codecov / codecov/patch

src/probeinterface/io.py#L1357

Added line #L1357 was not covered by tests

for curr_probe in range(1, n_probes + 1):
print(f'Reading probe{curr_probe}...', flush=True, end='')
print(f"Reading probe{curr_probe}...", flush=True, end="")
probe_config = probe_configs[curr_probe - 1]

Check warning on line 1361 in src/probeinterface/io.py

View check run for this annotation

Codecov / codecov/patch

src/probeinterface/io.py#L1359-L1361

Added lines #L1359 - L1361 were not covered by tests

# Get number of active channels from probe Device element
active_channel_str = [option for option in probe_config if option.attrib['name'] == 'channelsOn'][0].attrib['data']
active_channels = [int(ch) for ch in active_channel_str.split(' ') if ch]
active_channel_str = [option for option in probe_config if option.attrib["name"] == "channelsOn"][0].attrib[

Check warning on line 1364 in src/probeinterface/io.py

View check run for this annotation

Codecov / codecov/patch

src/probeinterface/io.py#L1364

Added line #L1364 was not covered by tests
"data"
]
active_channels = [int(ch) for ch in active_channel_str.split(" ") if ch]
n_active_channels = sum(active_channels)
assert len(active_channels) == TOTAL_NPIX_ELECTRODES
assert n_active_channels <= MAX_ACTIVE_CHANNELS

Check warning on line 1370 in src/probeinterface/io.py

View check run for this annotation

Codecov / codecov/patch

src/probeinterface/io.py#L1367-L1370

Added lines #L1367 - L1370 were not covered by tests
Expand All @@ -1374,11 +1376,11 @@ def read_spikegadgets(file: str | Path) -> ProbeGroup:

nt_i = 0 # Both probes are in sconf, so need an independent counter of probe electrodes while iterating through
for ntrode in sconf:
electrode_id = ntrode.attrib['id']
electrode_id = ntrode.attrib["id"]
if int(electrode_id[0]) == curr_probe: # first digit of electrode id is probe number
contact_ids.append(electrode_id)
positions[nt_i, :] = (ntrode[0].attrib['coord_ml'], ntrode[0].attrib['coord_dv'])
device_channels.append(ntrode[0].attrib['hwChan'])
positions[nt_i, :] = (ntrode[0].attrib["coord_ml"], ntrode[0].attrib["coord_dv"])
device_channels.append(ntrode[0].attrib["hwChan"])
nt_i += 1
assert len(contact_ids) == n_active_channels

Check warning on line 1385 in src/probeinterface/io.py

View check run for this annotation

Codecov / codecov/patch

src/probeinterface/io.py#L1377-L1385

Added lines #L1377 - L1385 were not covered by tests

Expand Down Expand Up @@ -1414,7 +1416,7 @@ def read_spikegadgets(file: str | Path) -> ProbeGroup:
probe.move([250 * (curr_probe - 1), 0])

Check warning on line 1416 in src/probeinterface/io.py

View check run for this annotation

Codecov / codecov/patch

src/probeinterface/io.py#L1416

Added line #L1416 was not covered by tests

# Add the probe to the probe container
print(probe.get_contact_count(), 'active channels found.')
print(probe.get_contact_count(), "active channels found.")
probe_group.add_probe(probe)

Check warning on line 1420 in src/probeinterface/io.py

View check run for this annotation

Codecov / codecov/patch

src/probeinterface/io.py#L1419-L1420

Added lines #L1419 - L1420 were not covered by tests

return probe_group

Check warning on line 1422 in src/probeinterface/io.py

View check run for this annotation

Codecov / codecov/patch

src/probeinterface/io.py#L1422

Added line #L1422 was not covered by tests
Expand Down

0 comments on commit 0273d9b

Please sign in to comment.