Skip to content

Commit

Permalink
Merge pull request #280 from NeurodataWithoutBorders/fix_electrodes
Browse files Browse the repository at this point in the history
check if x is in electrodes
  • Loading branch information
CodyCBakerPhD committed Feb 24, 2023
2 parents 62e4ad2 + 0725666 commit fe21c43
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
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()

0 comments on commit fe21c43

Please sign in to comment.