Skip to content

Commit

Permalink
Fix warnings from tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rly committed Oct 4, 2023
1 parent 4656c08 commit 3863b62
Show file tree
Hide file tree
Showing 12 changed files with 322 additions and 186 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/run_all_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,9 @@ jobs:
fail-fast: false
matrix:
include:
- { name: linux-python3.11-ros3 , python-ver: "3.11", os: ubuntu-latest }
- { name: windows-python3.11-ros3, python-ver: "3.11", os: windows-latest }
- { name: macos-python3.11-ros3 , python-ver: "3.11", os: macos-latest }
- { name: conda-linux-python3.11-ros3 , python-ver: "3.11", os: ubuntu-latest }
- { name: conda-windows-python3.11-ros3, python-ver: "3.11", os: windows-latest }
- { name: conda-macos-python3.11-ros3 , python-ver: "3.11", os: macos-latest }
steps:
- name: Cancel non-latest runs
uses: styfle/[email protected]
Expand Down Expand Up @@ -243,9 +243,9 @@ jobs:
fail-fast: false
matrix:
include:
- { name: linux-gallery-python3.11-ros3 , python-ver: "3.11", os: ubuntu-latest }
- { name: windows-gallery-python3.11-ros3, python-ver: "3.11", os: windows-latest }
- { name: macos-gallery-python3.11-ros3 , python-ver: "3.11", os: macos-latest }
- { name: conda-linux-gallery-python3.11-ros3 , python-ver: "3.11", os: ubuntu-latest }
- { name: conda-windows-gallery-python3.11-ros3, python-ver: "3.11", os: windows-latest }
- { name: conda-macos-gallery-python3.11-ros3 , python-ver: "3.11", os: macos-latest }
steps:
- name: Cancel non-latest runs
uses: styfle/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run_dandi_read_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ jobs:
- name: Run DANDI read tests
run: |
pytest -rP tests/read_dandi/
python tests/read_dandi/test_read_dandi.py
4 changes: 2 additions & 2 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ jobs:
fail-fast: false
matrix:
include:
- { name: linux-python3.11-ros3 , python-ver: "3.11", os: ubuntu-latest }
- { name: conda-linux-python3.11-ros3 , python-ver: "3.11", os: ubuntu-latest }
steps:
- name: Cancel non-latest runs
uses: styfle/[email protected]
Expand Down Expand Up @@ -219,7 +219,7 @@ jobs:
fail-fast: false
matrix:
include:
- { name: linux-gallery-python3.11-ros3 , python-ver: "3.11", os: ubuntu-latest }
- { name: conda-linux-gallery-python3.11-ros3 , python-ver: "3.11", os: ubuntu-latest }
steps:
- name: Cancel non-latest runs
uses: styfle/[email protected]
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ per-file-ignores =
tests/integration/__init__.py:F401
src/pynwb/testing/__init__.py:F401
src/pynwb/validate.py:T201
tests/read_dandi/test_read_dandi.py:T201
setup.py:T201
test.py:T201
scripts/*:T201
Expand Down
30 changes: 26 additions & 4 deletions src/pynwb/testing/mock/ophys.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from hdmf.common.table import DynamicTableRegion

from ... import NWBFile
from ... import NWBFile, ProcessingModule
from ...device import Device
from ...ophys import (
RoiResponseSeries,
Expand Down Expand Up @@ -272,6 +272,8 @@ def mock_RoiResponseSeries(
else:
n_rois = 5

plane_seg = plane_segmentation or mock_PlaneSegmentation(n_rois=n_rois, nwbfile=nwbfile)

roi_response_series = RoiResponseSeries(
name=name if name is not None else name_generator("RoiResponseSeries"),
data=data if data is not None else np.ones((30, n_rois)),
Expand All @@ -280,7 +282,7 @@ def mock_RoiResponseSeries(
or DynamicTableRegion(
name="rois",
description="rois",
table=plane_segmentation or mock_PlaneSegmentation(n_rois=n_rois, nwbfile=nwbfile),
table=plane_seg,
data=list(range(n_rois)),
),
resolution=resolution,
Expand All @@ -298,6 +300,9 @@ def mock_RoiResponseSeries(
if "ophys" not in nwbfile.processing:
nwbfile.create_processing_module("ophys", "ophys")

if plane_seg.name not in nwbfile.processing["ophys"].data_interfaces:
nwbfile.processing["ophys"].add(plane_seg)

nwbfile.processing["ophys"].add(roi_response_series)

return roi_response_series
Expand All @@ -309,16 +314,24 @@ def mock_DfOverF(
nwbfile: Optional[NWBFile] = None
) -> DfOverF:
df_over_f = DfOverF(
roi_response_series=roi_response_series or [mock_RoiResponseSeries(nwbfile=nwbfile)],
name=name if name is not None else name_generator("DfOverF"),
)
plane_seg = mock_PlaneSegmentation(nwbfile=nwbfile)

if nwbfile is not None:
if "ophys" not in nwbfile.processing:
nwbfile.create_processing_module("ophys", "ophys")

nwbfile.processing["ophys"].add(df_over_f)

else:
pm = ProcessingModule(name="ophys", description="ophys")
pm.add(plane_seg)
pm.add(df_over_f)

df_over_f.add_roi_response_series(
roi_response_series or mock_RoiResponseSeries(nwbfile=nwbfile, plane_segmentation=plane_seg)
)
return df_over_f


Expand All @@ -328,13 +341,22 @@ def mock_Fluorescence(
nwbfile: Optional[NWBFile] = None,
) -> Fluorescence:
fluorescence = Fluorescence(
roi_response_series=roi_response_series or [mock_RoiResponseSeries(nwbfile=nwbfile)],
name=name if name is not None else name_generator("Fluorescence"),
)
plane_seg = mock_PlaneSegmentation(nwbfile=nwbfile)

if nwbfile is not None:
if "ophys" not in nwbfile.processing:
nwbfile.create_processing_module("ophys", "ophys")

nwbfile.processing["ophys"].add(fluorescence)
else:
pm = ProcessingModule(name="ophys", description="ophys")
pm.add(plane_seg)
pm.add(fluorescence)

fluorescence.add_roi_response_series(
roi_response_series or mock_RoiResponseSeries(nwbfile=nwbfile, plane_segmentation=plane_seg)
)

return fluorescence
Loading

0 comments on commit 3863b62

Please sign in to comment.