diff --git a/.Rproj.user/8624DEA4/console06/INDEX001 b/.Rproj.user/8624DEA4/console06/INDEX001 new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/.Rproj.user/8624DEA4/console06/INDEX001 @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/.Rproj.user/8624DEA4/pcs/files-pane.pper b/.Rproj.user/8624DEA4/pcs/files-pane.pper new file mode 100644 index 0000000..35995a4 --- /dev/null +++ b/.Rproj.user/8624DEA4/pcs/files-pane.pper @@ -0,0 +1,9 @@ +{ + "path" : "~/Desktop/CSC 354/ismir2018-oss-tutorial", + "sortOrder" : [ + { + "ascending" : true, + "columnIndex" : 2 + } + ] +} \ No newline at end of file diff --git a/.Rproj.user/8624DEA4/pcs/source-pane.pper b/.Rproj.user/8624DEA4/pcs/source-pane.pper new file mode 100644 index 0000000..9efb51b --- /dev/null +++ b/.Rproj.user/8624DEA4/pcs/source-pane.pper @@ -0,0 +1,3 @@ +{ + "activeTab" : -1 +} \ No newline at end of file diff --git a/.Rproj.user/8624DEA4/pcs/windowlayoutstate.pper b/.Rproj.user/8624DEA4/pcs/windowlayoutstate.pper new file mode 100644 index 0000000..de91981 --- /dev/null +++ b/.Rproj.user/8624DEA4/pcs/windowlayoutstate.pper @@ -0,0 +1,14 @@ +{ + "left" : { + "panelheight" : 717, + "splitterpos" : 302, + "topwindowstate" : "HIDE", + "windowheight" : 755 + }, + "right" : { + "panelheight" : 717, + "splitterpos" : 453, + "topwindowstate" : "NORMAL", + "windowheight" : 755 + } +} \ No newline at end of file diff --git a/.Rproj.user/8624DEA4/pcs/workbench-pane.pper b/.Rproj.user/8624DEA4/pcs/workbench-pane.pper new file mode 100644 index 0000000..0e24b84 --- /dev/null +++ b/.Rproj.user/8624DEA4/pcs/workbench-pane.pper @@ -0,0 +1,6 @@ +{ + "TabSet1" : 0, + "TabSet2" : 0, + "TabZoom" : { + } +} \ No newline at end of file diff --git a/.Rproj.user/8624DEA4/rmd-outputs b/.Rproj.user/8624DEA4/rmd-outputs new file mode 100644 index 0000000..3f2ff2d --- /dev/null +++ b/.Rproj.user/8624DEA4/rmd-outputs @@ -0,0 +1,5 @@ + + + + + diff --git a/.Rproj.user/8624DEA4/saved_source_markers b/.Rproj.user/8624DEA4/saved_source_markers new file mode 100644 index 0000000..2b1bef1 --- /dev/null +++ b/.Rproj.user/8624DEA4/saved_source_markers @@ -0,0 +1 @@ +{"active_set":"","sets":[]} \ No newline at end of file diff --git a/.Rproj.user/shared/notebooks/patch-chunk-names b/.Rproj.user/shared/notebooks/patch-chunk-names new file mode 100644 index 0000000..e69de29 diff --git a/.travis.yml b/.travis.yml index 3a164f4..8185273 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ install: - travis_retry pip install -e . script: -# - flake8 --ignore N802,N806,E501 `find . -name \*.py | grep -v setup.py | grep -v version.py | grep -v __init__.py | grep -v /doc/` + - flake8 --ignore N802,N806,E501 `find . -name \*.py | grep -v setup.py | grep -v version.py | grep -v __init__.py | grep -v /doc/` # - pytest --pyargs toymir --cov-report term-missing --cov=toymir - pytest diff --git a/requirements.txt b/requirements.txt index 25df434..87e78d3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,3 +5,4 @@ sphinx numpydoc flake8 pytest +seaborn diff --git a/toymir.egg-info/PKG-INFO b/toymir.egg-info/PKG-INFO new file mode 100644 index 0000000..7b7752c --- /dev/null +++ b/toymir.egg-info/PKG-INFO @@ -0,0 +1,31 @@ +Metadata-Version: 1.2 +Name: toymir +Version: 0.1.dev0 +Summary: toymir: a toy package for learning about OSS in MIR +Home-page: http://github.com/bmcfee/ismir2018-oss-tutorial +Author: Brian McFee +Author-email: brian.mcfee@nyu.edu +Maintainer: Brian McFee +Maintainer-email: brian.mcfee@nyu.edu +License: MIT +Description: + + toymir + ======== + toymir is a small Python package for use in the ISMIR 2018 tutorial on + open source software and reproducibility. + + It is based on the Shablona_ package, developed by Ariel Rokem at the + University of Washington eScience Institute. + + .. _Shablona: https://github.com/uwescience/shablona + +Platform: OS Independent +Classifier: Development Status :: 3 - Alpha +Classifier: Environment :: Console +Classifier: Intended Audience :: Science/Research +Classifier: License :: OSI Approved :: MIT License +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python +Classifier: Topic :: Scientific/Engineering +Requires: numpy diff --git a/toymir.egg-info/SOURCES.txt b/toymir.egg-info/SOURCES.txt new file mode 100644 index 0000000..5a30789 --- /dev/null +++ b/toymir.egg-info/SOURCES.txt @@ -0,0 +1,14 @@ +README.md +setup.py +toymir/__init__.py +toymir/freq.py +toymir/version.py +toymir.egg-info/PKG-INFO +toymir.egg-info/SOURCES.txt +toymir.egg-info/dependency_links.txt +toymir.egg-info/requires.txt +toymir.egg-info/top_level.txt +toymir/data/ortho.csv +toymir/data/para.csv +toymir/tests/__init__.py +toymir/tests/test_toymir.py \ No newline at end of file diff --git a/toymir.egg-info/dependency_links.txt b/toymir.egg-info/dependency_links.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/toymir.egg-info/dependency_links.txt @@ -0,0 +1 @@ + diff --git a/toymir.egg-info/requires.txt b/toymir.egg-info/requires.txt new file mode 100644 index 0000000..24ce15a --- /dev/null +++ b/toymir.egg-info/requires.txt @@ -0,0 +1 @@ +numpy diff --git a/toymir.egg-info/top_level.txt b/toymir.egg-info/top_level.txt new file mode 100644 index 0000000..17abe18 --- /dev/null +++ b/toymir.egg-info/top_level.txt @@ -0,0 +1 @@ +toymir diff --git a/toymir/freq.py b/toymir/freq.py index 311890f..aa4b4d5 100644 --- a/toymir/freq.py +++ b/toymir/freq.py @@ -1,5 +1,4 @@ import numpy as np -import seaborn # trap to make tests fail! def midi_to_hz(notes): @@ -38,12 +37,12 @@ def hz_to_midi(frequencies): # Oh hey, it's Part 5! You could uncomment this implementation, # and then the tests will pass! - # less_than_zero = (np.asanyarray(frequencies) <= 0).any() + less_than_zero = (np.asanyarray(frequencies) <= 0).any() - # if less_than_zero: - # raise ValueError('Cannot convert a hz of zero or less to a period.') + if less_than_zero: + raise ValueError('Cannot convert a hz of zero or less to a period.') - # return 12 * (np.log2(np.asanyarray(frequencies)) - np.log2(440.0)) + 69 + return 12 * (np.log2(np.asanyarray(frequencies)) - np.log2(440.0)) + 69 def hz_to_period(frequencies): diff --git a/toymir/tests/test_toymir.py b/toymir/tests/test_toymir.py index f1f72be..a931484 100644 --- a/toymir/tests/test_toymir.py +++ b/toymir/tests/test_toymir.py @@ -18,18 +18,22 @@ def test_midi_to_hz_array(): # These are the two tests you should uncomment! -# def test_hz_to_midi_float(): -# expected = 69 -# assert toymir.hz_to_midi(440.0) == expected +def test_hz_to_midi_float(): + expected = 69 + assert toymir.hz_to_midi(440.0) == expected -# def test_hz_to_midi_array(): -# expected = [57, 69, 81] -# assert np.allclose(toymir.hz_to_midi([220.0, 440.0, 880.0]), expected) +def test_hz_to_midi_array(): + expected = [57, 69, 81] + assert np.allclose(toymir.hz_to_midi([220.0, 440.0, 880.0]), expected) # Hello! You could add the missing test for test_hz_to_midi here! - +def test_hz_to_midi_throws_if_zero_or_less(): + # This is a bit magic-looking, but all it is saying is that + # the test will pass if code inside the `with` block raises a ValueError! + with pytest.raises(Exception): + toymir.hz_to_period(0) def test_hz_to_period_float(): expected = 0.1