Skip to content

Commit

Permalink
master: Merged release into master
Browse files Browse the repository at this point in the history
  • Loading branch information
adamltaylor committed Aug 23, 2018
2 parents 106cc5c + af52957 commit a689d13
Show file tree
Hide file tree
Showing 11 changed files with 81 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.0.2
current_version = 0.0.3
commit = True
tag = True

Expand Down
1 change: 0 additions & 1 deletion .coverage

This file was deleted.

7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,12 @@ launch_satellite_engine/bin/launch_satellite_engine.exe
*.cache
*.pyc

\.coverage

\.idea/
.idea/


build/
dist/
pywavesurfer.egg-info/
.pytest_cache
htmlcov/
.coverage
3 changes: 3 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ Version History

0.0.2 Oct 14, 2017 Added a check for WS version.

0.0.3 Aug 23, 2018 Added test for WS 0.97 data files, changed an
exception to a warning, updated dependencies.


.. |Updates| image:: https://pyup.io/repos/github/JaneliaSciComp/PyWaveSurfer/shield.svg
:target: https://pyup.io/repos/github/JaneliaSciComp/PyWaveSurfer/
Expand Down
42 changes: 36 additions & 6 deletions developer-notes.txt
Original file line number Diff line number Diff line change
@@ -1,24 +1,54 @@
Users: This files contains information for the Wavesurfer
Users: This files contains information for the PyWaveSurfer
developer(s). You can safely ignore it.



To bump version
---------------

1. Run: bumpversion patch (or 'minor' or 'major' following: major.minor.patch)
0. pip install --user bumpversion

2. Add a paragraph to the README about the new release.
This installs the bumpversion command-line tool for the current user.

3. Run: python setup.py sdist
1. Checkout the release branch, merge develop branch into it.

4. Run: twine upload dist\pywaveserfer{version}
2. Run: bumpversion patch (or 'minor' or 'major' following:
major.minor.patch)

This modifies the setup.py file in the root of the repo. It also
changes .bumpversion.cfg to reflect the new version. ***It then
does a git commit of these changes, with a comment
like "Bump version: 0.0.2 -> 0.0.3".*** (That's why you should be
on a release branch before you do this.)

3. Add a paragraph to the README about the new release.

4. Commit to the release branch, then switch over to master, and merge
in the release branch.

5. Run: python3 setup.py sdist

Runs the setup.py script that got updated in the "bumpversion" step
above. This creates/updates the dist folder and the
pywavesurfer.egg-info folders, which contain a packaged version of
the pywavesurfer module, ready for uploading to PyPI, and some
metadata pertaining to it.

6. Run: twine upload dist\pywaveserfer{version}

This uploads the module to PyPI.



To run automated tests
----------------------

0. Do

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

1. Change directory to pywavesurfer

2. Run: pytest --pep8
Expand All @@ -27,7 +57,7 @@ To run automated tests



pyWavesurfer coding/development conventions
PyWaveSurfer coding/development conventions
-----------------------------------------

As much as possible please adhere to PEP8.
Expand Down
7 changes: 4 additions & 3 deletions pywavesurfer/ws.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
import math
import numpy as np
import h5py
import warnings

# 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 Expand Up @@ -37,8 +38,8 @@ def loadDataFile(filename, format_string='double'):
version_string = header["VersionString"] # this is a scalar numpy array with a weird datatype
version = float(version_string.tostring().decode('utf-8'))
if version > _latest_version:
raise RuntimeWarning('You are reading a WaveSurfer file version this module was not tested with: '
'file version %f, latest version tested: %f' % (version, _latest_version))
warnings.warn('You are reading a WaveSurfer file version this module was not tested with: '
'file version %f, latest version tested: %f' % (version, _latest_version), RuntimeWarning)
else:
# If no VersionsString field, the file is from an old old version
version = 0
Expand Down
8 changes: 4 additions & 4 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
bumpversion==0.5.3
h5py==2.7.1
numpy==1.13.3
pytest==3.2.3
h5py==2.8.0
numpy==1.15.1
pytest==3.7.2
pytest-pep8==1.0.6
pytest-cov==2.5.1
coveralls==1.2.0
coveralls==1.3.0
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
h5py == 2.7.1
numpy == 1.13.3
h5py==2.8.0
numpy==1.15.1
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
setup(
name='pywavesurfer',
packages=['pywavesurfer'],
version='0.0.2',
version='0.0.3',
description="Python package for reading WaveSurfer data files",
long_description=long_description,
author='Adam L. Taylor, Boaz Mohar',
author_email='taylora@janelia.hhmi.org, boazmohar@gmail.com',
url='https://github.com/JaneliaSciComp/PyWaveSurfer',
download_url='https://github.com/JaneliaSciComp/PyWaveSurfer/archive/v0.0.2.tar.gz',
download_url='https://github.com/JaneliaSciComp/PyWaveSurfer/archive/v0.0.3.tar.gz',
classifiers=['Development Status :: 3 - Alpha',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
Expand Down
27 changes: 25 additions & 2 deletions tests/test_ws.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,36 @@ 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)
file_name = os.path.join(this_dir_name, 'ws_v100_data.h5')
with pytest.raises(RuntimeWarning) as ex:
with pytest.warns(RuntimeWarning) as record:
_ = ws.loadDataFile(file_name)
assert 'You are reading a WaveSurfer file version this module was not' in str(ex.value)
# check that only one warning was raised
assert len(record) == 1
# check that the message matches
assert 'You are reading a WaveSurfer file version this module was not' in record[0].message.args[0]


def test_identity_function_on_vector():
Expand Down
Binary file added tests/ws_0p97_data_0001.h5
Binary file not shown.

0 comments on commit a689d13

Please sign in to comment.