-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix chunking bug with compound dtypes (#1146)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
89aac67
commit a896663
Showing
7 changed files
with
430 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
...st_backend_and_dataset_configuration/test_models/test_dataset_io_configuration_helpers.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
"""Unit tests for helper functions of DatasetIOConfiguration.""" | ||
|
||
import numpy as np | ||
from pynwb.testing.mock.base import mock_TimeSeries | ||
from pynwb.testing.mock.file import mock_NWBFile | ||
|
||
from neuroconv.tools.nwb_helpers._configuration_models._base_dataset_io import ( | ||
_find_location_in_memory_nwbfile, | ||
_infer_dtype, | ||
) | ||
|
||
|
||
def test_find_location_in_memory_nwbfile(): | ||
nwbfile = mock_NWBFile() | ||
time_series = mock_TimeSeries(name="TimeSeries") | ||
nwbfile.add_acquisition(time_series) | ||
neurodata_object = nwbfile.acquisition["TimeSeries"] | ||
location = _find_location_in_memory_nwbfile(neurodata_object=neurodata_object, field_name="data") | ||
assert location == "acquisition/TimeSeries/data" | ||
|
||
|
||
def test_infer_dtype_array(): | ||
nwbfile = mock_NWBFile() | ||
time_series = mock_TimeSeries(name="TimeSeries", data=np.array([1.0, 2.0, 3.0], dtype="float64")) | ||
nwbfile.add_acquisition(time_series) | ||
dataset = nwbfile.acquisition["TimeSeries"].data | ||
dtype = _infer_dtype(dataset) | ||
assert dtype == np.dtype("float64") | ||
|
||
|
||
def test_infer_dtype_list(): | ||
nwbfile = mock_NWBFile() | ||
time_series = mock_TimeSeries(name="TimeSeries", data=[1.0, 2.0, 3.0]) | ||
nwbfile.add_acquisition(time_series) | ||
dataset = nwbfile.acquisition["TimeSeries"].data | ||
dtype = _infer_dtype(dataset) | ||
assert dtype == np.dtype("float64") | ||
|
||
|
||
def test_infer_dtype_object(): | ||
nwbfile = mock_NWBFile() | ||
time_series = mock_TimeSeries(name="TimeSeries", data=(1.0, 2.0, 3.0)) | ||
nwbfile.add_acquisition(time_series) | ||
dataset = nwbfile.acquisition["TimeSeries"] | ||
dtype = _infer_dtype(dataset) | ||
assert dtype == np.dtype("object") |
Oops, something went wrong.