forked from jonescompneurolab/hnn-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: remove test that use read_network
- Loading branch information
Showing
2 changed files
with
2 additions
and
115 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,12 +3,10 @@ | |
# Rajat Partani <[email protected]> | ||
|
||
from pathlib import Path | ||
from numpy.testing import assert_allclose | ||
from h5io import write_hdf5, read_hdf5 | ||
import pytest | ||
import numpy as np | ||
|
||
from hnn_core import (read_network, simulate_dipole, read_params, | ||
from hnn_core import (simulate_dipole, read_params, | ||
jones_2009_model, calcium_model, | ||
) | ||
|
||
|
@@ -314,43 +312,6 @@ def test_read_configuration_json(jones_2009_network): | |
assert net == jones_2009_network | ||
|
||
|
||
def test_read_hdf5_with_simulation(jones_2009_network): | ||
""" Read-in of a hdf5 file with simulation""" | ||
# Test reading a network with simulation | ||
net_sim = read_network( | ||
Path(assets_path, 'jones2009_3x3_drives_simulated.hdf5') | ||
) | ||
assert net_sim.rec_arrays['el1'].voltages.size != 0 | ||
assert len(net_sim.external_drives['evdist1']['events']) > 0 | ||
|
||
# Test reading file without simulation information | ||
net_sim_output_false = read_network( | ||
Path(assets_path, 'jones2009_3x3_drives_simulated.hdf5'), | ||
read_output=False | ||
) | ||
assert net_sim_output_false.rec_arrays['el1'].voltages.size == 0 | ||
assert len(net_sim_output_false.external_drives['evdist1']['events']) == 0 | ||
|
||
# Test reading file with simulation and without drive information | ||
net_sim_drives_false = read_network( | ||
Path(assets_path, 'jones2009_3x3_drives_simulated.hdf5'), | ||
read_output=True, | ||
read_drives=False | ||
) | ||
assert net_sim_drives_false.rec_arrays['el1'].voltages.size != 0 | ||
assert not bool(net_sim_drives_false.external_drives) | ||
|
||
# Test reading file without simulation and drive information | ||
net_sim_output_false_drives_false = read_network( | ||
Path(assets_path, 'jones2009_3x3_drives_simulated.hdf5'), | ||
read_output=False, | ||
read_drives=False | ||
) | ||
assert (net_sim_output_false_drives_false | ||
.rec_arrays['el1'].voltages.size == 0) | ||
assert not bool(net_sim_output_false_drives_false.external_drives) | ||
|
||
|
||
def test_read_incorrect_format(tmp_path): | ||
"""Test that error raise when the json do not have a Network label.""" | ||
|
||
|
@@ -365,24 +326,3 @@ def test_read_incorrect_format(tmp_path): | |
with pytest.raises(ValueError, | ||
match="The json should encode a Network object."): | ||
read_network_configuration(file_path) | ||
|
||
|
||
def test_simulate_from_read(jones_2009_network): | ||
""" | ||
Tests a simulation from a read-in network creates a similar simulation to | ||
the reference network the input file was created from. | ||
""" | ||
net = jones_2009_network | ||
dpls1 = simulate_dipole(net, tstop=2, n_trials=1, dt=0.5) | ||
|
||
net_read = read_network(Path(assets_path, 'jones2009_3x3_drives.hdf5')) | ||
dpls2 = simulate_dipole(net_read, tstop=2, n_trials=1, dt=0.5) | ||
|
||
for dpl1, dpl2 in zip(dpls1, dpls2): | ||
assert_allclose(dpl1.times, dpl2.times, rtol=0.00051, atol=0) | ||
for dpl_key in dpl1.data.keys(): | ||
assert_allclose(dpl1.data[dpl_key], | ||
dpl2.data[dpl_key], rtol=0.000051, atol=0) | ||
|
||
# Smoke test | ||
net_read.plot_cells(show=False) |
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