From 59c884dcf725d37be03d051e7d4c4f93caf8e2b5 Mon Sep 17 00:00:00 2001 From: Albert Kottke Date: Wed, 6 Jul 2016 07:15:52 -0700 Subject: [PATCH] Cleaned up versioning. --- CONTRIBUTING.rst | 5 ++++- HISTORY.rst | 8 ++++++++ MANIFEST.in | 2 -- Makefile | 3 --- pyrvt/motions.py | 12 ++++++++++-- requirements.txt | 2 ++ requirements_dev.txt | 3 +-- setup.cfg | 13 +++---------- setup.py | 17 ++++++++++++++--- 9 files changed, 42 insertions(+), 23 deletions(-) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index d9136ef..9c9d282 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -40,7 +40,10 @@ Write Documentation pyRVT could always use more documentation, whether as part of the official pyRVT docs, in docstrings, or even on the web in blog posts, -articles, and such. +articles, and such. Docstrings should be formatted using the +`NumPy conventions`_. + +.. _NumPy conventions: https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt Submit Feedback ~~~~~~~~~~~~~~~ diff --git a/HISTORY.rst b/HISTORY.rst index 6e12c2d..6c1ac1c 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -2,6 +2,14 @@ History ======= +0.5.0 (2016-07-06) +------------------ + +* Added ability to pass transfer function to PSA calculation. +* Removed extraneous files. +* Cleaned up documentation to use NumPy style. +* Fixed PEP8 issues. + 0.1.0 (2016-03-04) ------------------ diff --git a/MANIFEST.in b/MANIFEST.in index 843732b..e69de29 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,2 +0,0 @@ -include versioneer.py -include pyrvt/_version.py diff --git a/Makefile b/Makefile index da0efae..d86626e 100644 --- a/Makefile +++ b/Makefile @@ -51,9 +51,6 @@ lint: test: python setup.py test -test-all: - tox - coverage: coverage run --source pyrvt setup.py test coverage report -m diff --git a/pyrvt/motions.py b/pyrvt/motions.py index 858c801..3062674 100644 --- a/pyrvt/motions.py +++ b/pyrvt/motions.py @@ -200,7 +200,8 @@ def duration(self): """Duration of the ground motion for RVT analysis.""" return self._duration - def calc_osc_accels(self, osc_freqs, osc_damping=0.05): + def calc_osc_accels(self, osc_freqs, osc_damping=0.05, + trans_func=None): """Compute the pseudo-acceleration spectral response of an oscillator with a specific frequency and damping. @@ -211,15 +212,22 @@ def calc_osc_accels(self, osc_freqs, osc_damping=0.05): osc_damping : float Fractional damping of the oscillator (dec). For example, 0.05 for a damping ratio of 5%. + trans_func : array_like, optional + Transfer function to be applied to motion prior calculation of the + oscillator response. Returns ------- spec_accels : :class:`numpy.ndarray` Peak pseudo-spectral acceleration of the oscillator """ + if trans_func is None: + trans_func = np.ones_like(self.freqs) + else: + trans_func = np.asarray resp = np.array([ self.calc_peak( - calc_sdof_tf(self._freqs, of, osc_damping), + trans_func * calc_sdof_tf(self.freqs, of, osc_damping), of, osc_damping) for of in osc_freqs]) return resp diff --git a/requirements.txt b/requirements.txt index 0ea5d87..dee1b05 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,5 @@ +--index-url https://pypi.python.org/simple/ + numpy openpyxl pyprind diff --git a/requirements_dev.txt b/requirements_dev.txt index ccf3c38..cf4c6f1 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -1,13 +1,12 @@ -r ./requirements.txt -bumpversion coveralls cryptography flake8 -invoke pytest pytest-cov pytest-flake8 +pytest-runner sphinx sphinxcontrib-bibtex watchdog diff --git a/setup.cfg b/setup.cfg index a277d46..aaf5899 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,11 +1,6 @@ -[bumpversion] -current_version = 0.1.0 -commit = True -tag = True - -[bumpversion:file:setup.py] - -[bumpversion:file:pyrvt/__init__.py] +[aliases] +test = pytest +release = clean --all sdist bdist_wheel build_sphinx upload upload_docs [metadata] description-file = README.rst @@ -13,5 +8,3 @@ description-file = README.rst [wheel] universal = 1 -[pytest] -flake8-ignore = diff --git a/setup.py b/setup.py index 42eef1c..db7ddbf 100644 --- a/setup.py +++ b/setup.py @@ -14,16 +14,27 @@ history = history_file.read() requirements = [ - # TODO: put package requirements here + 'numpy', + 'openpyxl', + 'pyprind', + 'setuptools', + 'scipy', + 'xlrd', + 'xlwt', ] test_requirements = [ - # TODO: put package test requirements here + 'coveralls', + 'flake8', + 'pytest', + 'pytest-cov', + 'pytest-flake8', + 'pytest-runner' ] setup( name='pyrvt', - version='0.4.0', + version='0.5.0', description='Ground motion models implemented in Python.', long_description=readme + '\n\n' + history, author='Albert Kottke',