Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check if x is in electrodes #280

Merged
merged 3 commits into from
Feb 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion nwbwidgets/ecephys.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def selection_fn(trace, points, selector):

def show_electrodes(electrodes_table):
in_dict = dict(table=render_dataframe)
if np.isnan(electrodes_table.x[0]): # position is not defined
if not hasattr(electrodes_table, "x") or np.isnan(electrodes_table.x[0]): # position is not defined
in_dict.update(electrode_groups=ElectrodeGroupsWidget)
else:
subject = electrodes_table.get_ancestor("NWBFile").subject
Expand Down
2 changes: 2 additions & 0 deletions requirements-testing.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pytest
pynwb>=2.3.0
13 changes: 12 additions & 1 deletion test/test_ecephys.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,16 @@
from dateutil.tz import tzlocal
from pynwb import NWBFile, TimeSeries
from pynwb.ecephys import LFP, ElectricalSeries, SpikeEventSeries
from pynwb.testing.mock.ecephys import mock_ElectrodeTable

from nwbwidgets import nwb2widget
from nwbwidgets.base import show_multi_container_interface
from nwbwidgets.ecephys import show_ccf, show_spectrogram, show_spike_event_series
from nwbwidgets.ecephys import (
show_ccf,
show_electrodes,
show_spectrogram,
show_spike_event_series,
)
from nwbwidgets.view import default_neurodata_vis_spec


Expand Down Expand Up @@ -103,6 +109,11 @@ def test_show_spectrogram():
show_spectrogram(ts, channel=channel)


def test_show_electrodes():
electrode_table = mock_ElectrodeTable()
show_electrodes(electrode_table)


@pytest.mark.skip(reason="Test broke somewhere around PR #219, but cause is unclear.")
def test_show_ccf():
show_ccf()