-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #568 from catalystneuro/new_backend_pydantic_backe…
…nd_configuration_models [Backend Configuration Ib] Pydantic models for communicating backend-specific configuration information
- Loading branch information
Showing
11 changed files
with
259 additions
and
19 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
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
4 changes: 1 addition & 3 deletions
4
...mal/test_tools/test_backend_and_dataset_configuration/test_dataset_configuration_model.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
49 changes: 49 additions & 0 deletions
49
...est_tools/test_backend_and_dataset_configuration/test_hdf5_backend_configuration_model.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,49 @@ | ||
"""Unit tests for the DatasetInfo Pydantic model.""" | ||
from io import StringIO | ||
from unittest.mock import patch | ||
|
||
from neuroconv.tools.testing import mock_HDF5BackendConfiguration | ||
|
||
|
||
def test_hdf5_backend_configuration_print(): | ||
"""Test the printout display of a HDF5DatasetConfiguration model looks nice.""" | ||
hdf5_backend_configuration = mock_HDF5BackendConfiguration() | ||
|
||
with patch("sys.stdout", new=StringIO()) as out: | ||
print(hdf5_backend_configuration) | ||
|
||
expected_print = """ | ||
Configurable datasets identified using the hdf5 backend | ||
------------------------------------------------------- | ||
acquisition/TestElectricalSeriesAP/data | ||
--------------------------------------- | ||
dtype : int16 | ||
full shape of source array : (1800000, 384) | ||
full size of source array : 1.38 GB | ||
buffer shape : (1250000, 384) | ||
maximum RAM usage per iteration : 0.96 GB | ||
chunk shape : (78125, 64) | ||
disk space usage per chunk : 10.00 MB | ||
compression method : gzip | ||
acquisition/TestElectricalSeriesLF/data | ||
--------------------------------------- | ||
dtype : int16 | ||
full shape of source array : (75000, 384) | ||
full size of source array : 0.06 GB | ||
buffer shape : (75000, 384) | ||
maximum RAM usage per iteration : 0.06 GB | ||
chunk shape : (37500, 128) | ||
disk space usage per chunk : 9.60 MB | ||
compression method : gzip | ||
""" | ||
assert out.getvalue() == expected_print |
53 changes: 53 additions & 0 deletions
53
...est_tools/test_backend_and_dataset_configuration/test_zarr_backend_configuration_model.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,53 @@ | ||
"""Unit tests for the DatasetInfo Pydantic model.""" | ||
from io import StringIO | ||
from unittest.mock import patch | ||
|
||
from neuroconv.tools.testing import mock_ZarrBackendConfiguration | ||
|
||
|
||
def test_zarr_backend_configuration_print(): | ||
"""Test the printout display of a HDF5DatasetConfiguration model looks nice.""" | ||
zarr_backend_configuration = mock_ZarrBackendConfiguration() | ||
|
||
with patch("sys.stdout", new=StringIO()) as out: | ||
print(zarr_backend_configuration) | ||
|
||
expected_print = """ | ||
Configurable datasets identified using the zarr backend | ||
------------------------------------------------------- | ||
acquisition/TestElectricalSeriesAP/data | ||
--------------------------------------- | ||
dtype : int16 | ||
full shape of source array : (1800000, 384) | ||
full size of source array : 1.38 GB | ||
buffer shape : (1250000, 384) | ||
maximum RAM usage per iteration : 0.96 GB | ||
chunk shape : (78125, 64) | ||
disk space usage per chunk : 10.00 MB | ||
compression method : gzip | ||
filter methods : ['delta'] | ||
acquisition/TestElectricalSeriesLF/data | ||
--------------------------------------- | ||
dtype : int16 | ||
full shape of source array : (75000, 384) | ||
full size of source array : 0.06 GB | ||
buffer shape : (75000, 384) | ||
maximum RAM usage per iteration : 0.06 GB | ||
chunk shape : (37500, 128) | ||
disk space usage per chunk : 9.60 MB | ||
compression method : gzip | ||
filter methods : ['delta'] | ||
""" | ||
assert out.getvalue() == expected_print |