This repository has been archived by the owner on Jul 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into dicarlo.BashivanKar2019
Also fix tests for dicarlo.BashivanKar2019 as only two assemblies * master: Rust305 (#51) Fix Kuzovkin 2018 (#50) Inplace (#47) dicarlo.Seibert2019 (#48) add ImageNet stimulus set (#45) Created exceptions in fetch and packaging for PropertyAssembly class that do not merge responses with stimulus_set (#42) Update lookup.csv (#44) Update Rajalingham2020 lookup (#43) Update lookup.csv (#41) use image_file_name without .png if present (#40) # Conflicts: # tests/test_assemblies.py # tests/test_stimuli.py
- Loading branch information
Showing
7 changed files
with
344 additions
and
89 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import pytest | ||
from pathlib import Path | ||
|
||
from brainio_base.assemblies import DataAssembly, get_levels | ||
from brainio_collection.packaging import write_netcdf | ||
|
||
|
||
def test_write_netcdf(): | ||
assy = DataAssembly( | ||
data=[[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12], [13, 14, 15], [16, 17, 18]], | ||
coords={ | ||
'up': ("a", ['alpha', 'alpha', 'beta', 'beta', 'beta', 'beta']), | ||
'down': ("a", [1, 1, 1, 1, 2, 2]), | ||
'sideways': ('b', ['x', 'y', 'z']) | ||
}, | ||
dims=['a', 'b'] | ||
) | ||
netcdf_path = Path("test.nc") | ||
netcdf_sha1 = write_netcdf(assy, str(netcdf_path)) | ||
assert netcdf_path.exists() | ||
|
||
|
||
def test_reset_index(): | ||
assy = DataAssembly( | ||
data=[[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12], [13, 14, 15], [16, 17, 18]], | ||
coords={ | ||
'up': ("a", ['alpha', 'alpha', 'beta', 'beta', 'beta', 'beta']), | ||
'down': ("a", [1, 1, 1, 1, 2, 2]), | ||
'sideways': ('b', ['x', 'y', 'z']) | ||
}, | ||
dims=['a', 'b'] | ||
) | ||
assert assy["a"].variable.level_names == ["up", "down"] | ||
assert list(assy.indexes) == ["a", "b"] | ||
assy = assy.reset_index(list(assy.indexes)) | ||
assert assy["a"].variable.level_names is None | ||
assert get_levels(assy) == [] | ||
assert list(assy.indexes) == [] | ||
|
||
|
||
|
||
def test_reset_index_levels(): | ||
assy = DataAssembly( | ||
data=[[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12], [13, 14, 15], [16, 17, 18]], | ||
coords={ | ||
'up': ("a", ['alpha', 'alpha', 'beta', 'beta', 'beta', 'beta']), | ||
'down': ("a", [1, 1, 1, 1, 2, 2]), | ||
'sideways': ('b', ['x', 'y', 'z']) | ||
}, | ||
dims=['a', 'b'] | ||
) | ||
assert assy["a"].variable.level_names == ["up", "down"] | ||
assy = assy.reset_index(["up", "down"]) | ||
assert get_levels(assy) == [] | ||
|
||
|
||
|
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