Skip to content

Commit

Permalink
Added WS 0.97 data file test, updated _latest_version
Browse files Browse the repository at this point in the history
  • Loading branch information
adamltaylor committed Aug 22, 2018
1 parent 15356f3 commit 1f91359
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,4 @@ launch_satellite_engine/bin/launch_satellite_engine.exe
build/
dist/
pywavesurfer.egg-info/
.pytest_cache
5 changes: 5 additions & 0 deletions developer-notes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ To bump version
To run automated tests
----------------------

0. Do

pip install --user pytest
pip install --user pytest-pep8

1. Change directory to pywavesurfer

2. Run: pytest --pep8
Expand Down
2 changes: 1 addition & 1 deletion pywavesurfer/ws.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import h5py

# the latest version pywavesurfer was tested against
_latest_version = 0.953
_latest_version = 0.97

# from pywavesurfer.ws import * will only import loadDataFile
__all__ = ['loadDataFile']
Expand Down
20 changes: 20 additions & 0 deletions tests/test_ws.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,26 @@ def test_loading_0p933_file():
assert np.allclose(x.mean(axis=1), np.array([2.49962616]))


def test_loading_0p97_file():
this_file_path = os.path.realpath(__file__)
this_dir_name = os.path.dirname(this_file_path)
file_name = os.path.join(this_dir_name, 'ws_0p97_data_0001.h5')
dataAsDict = ws.loadDataFile(file_name)
acq_sampling_rate = float(dataAsDict['header']['AcquisitionSampleRate'])
assert acq_sampling_rate == 20e3
n_a_i_channels = dataAsDict['header']['AIChannelScales'].size
assert n_a_i_channels == 1
n_active_a_i_channels = int(dataAsDict['header']['IsAIChannelActive'].sum())
assert n_active_a_i_channels == 1
stim_sampling_rate = dataAsDict['header']['StimulationSampleRate']
assert stim_sampling_rate == 20e3
x = dataAsDict['sweep_0001']['analogScans']
assert x.dtype == 'float64'
assert np.absolute(np.max(x[0]) - 5) < 0.01
assert np.absolute(np.min(x[0]) - 0) < 0.01
assert np.allclose(x.mean(axis=1), np.array([2.50221981]))


def test_version_higher_then_latest():
this_file_path = os.path.realpath(__file__)
this_dir_name = os.path.dirname(this_file_path)
Expand Down
Binary file added tests/ws_0p97_data_0001.h5
Binary file not shown.

0 comments on commit 1f91359

Please sign in to comment.