From 2e1a2ff121f8b1c60c5dbf4923fc52efaef4e9b6 Mon Sep 17 00:00:00 2001 From: Simon Torres Date: Tue, 12 Jan 2021 20:24:22 -0300 Subject: [PATCH 01/12] new version --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index c675498..28b3974 100644 --- a/setup.cfg +++ b/setup.cfg @@ -32,4 +32,4 @@ install_requires = sphinx # version should be PEP440 compatible (http://www.python.org/dev/peps/pep-0440) -version = 0.3.5 +version = 0.3.6 From 5a420010e8601326cf0ec3bcf1318a570451b658 Mon Sep 17 00:00:00 2001 From: Simon Torres Date: Tue, 12 Jan 2021 20:34:11 -0300 Subject: [PATCH 02/12] Updated change history --- CHANGES.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 761d83c..eec1ce6 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,12 @@ +.. _v0.3.6: + +0.3.6 +===== + +- Added python 3.7 and 3.8 to Travis CI +- Removed astroconda from environment.yml and specified python 3.8 to avoid 3.9 + + .. _v0.3.5: 0.3.5 From a6d0f11db74f473d3d29a4436d51de1393f4ced2 Mon Sep 17 00:00:00 2001 From: Simon Torres Date: Mon, 25 Jan 2021 12:57:50 -0300 Subject: [PATCH 03/12] Changed mode name format. From single underscore to double underscore. Used join method to avoid mistakes. --- goodman_focus/goodman_focus.py | 48 +++++----------------------------- 1 file changed, 7 insertions(+), 41 deletions(-) diff --git a/goodman_focus/goodman_focus.py b/goodman_focus/goodman_focus.py index 54d7b4b..acaf627 100644 --- a/goodman_focus/goodman_focus.py +++ b/goodman_focus/goodman_focus.py @@ -496,14 +496,14 @@ def _get_mode_name(group): subset=['INSTCONF', 'FILTER', 'FILTER2', 'WAVMODE'], keep='first') if unique_values['WAVMODE'].values == ['IMAGING']: - mode_name = 'IM_{}_{}'.format( - unique_values['INSTCONF'].values[0], - unique_values['FILTER'].values[0]) + mode_name = '__'.join(['IM', + str(unique_values['INSTCONF'].values[0]), + str(unique_values['FILTER'].values[0])]) else: - mode_name = 'SP_{}_{}_{}'.format( - unique_values['INSTCONF'].values[0], - unique_values['WAVMODE'].values[0], - unique_values['FILTER2'].values[0]) + mode_name = '__'.join(['SP', + str(unique_values['INSTCONF'].values[0]), + str(unique_values['WAVMODE'].values[0]), + str(unique_values['FILTER2'].values[0])]) mode_name = re.sub('[<> ]', '', mode_name) # mode_name = re.sub('[- ]', '_', mode_name) return mode_name @@ -592,39 +592,5 @@ def run_goodman_focus(args=None): # pragma: no cover log.info("Mode: {} Best Focus: {}".format(key, result[key])) -# def run_goodman_focus_list(args=None): # pragma: no cover -# """Entrypoint -# -# Args: -# args (list): (optional) a list of arguments and respective values. -# -# """ -# args = get_args(arguments=args) -# goodman_focus = GoodmanFocus(data_path=args.data_path, -# file_pattern=args.file_pattern, -# obstype=args.obstype, -# features_model=args.features_model, -# plot_results=args.plot_results, -# debug=args.debug) -# -# file_list = ['0016_foc_400m2.fits', -# '0018_foc_400m2.fits', -# '0020_foc_400m2.fits', -# '0022_foc_400m2.fits', -# '0024_foc_400m2.fits', -# '0026_foc_400m2.fits', -# '0028_foc_400m2.fits', -# '0017_foc_400m2.fits', -# '0019_foc_400m2.fits', -# '0021_foc_400m2.fits', -# '0023_foc_400m2.fits', -# '0025_foc_400m2.fits', -# '0027_foc_400m2.fits'] -# -# result = goodman_focus(files=file_list) -# print(result) - - if __name__ == '__main__': # pragma: no cover - # full_path = '/user/simon/data/soar/work/focus2' run_goodman_focus() From 3bf40b8d6fc46d1f32bf6c7a81c4d6401ab5a2e1 Mon Sep 17 00:00:00 2001 From: Simon Torres Date: Mon, 25 Jan 2021 13:02:34 -0300 Subject: [PATCH 04/12] fixed tests --- goodman_focus/tests/test_goodman_focus.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/goodman_focus/tests/test_goodman_focus.py b/goodman_focus/tests/test_goodman_focus.py index 5a8d04c..787bf6a 100644 --- a/goodman_focus/tests/test_goodman_focus.py +++ b/goodman_focus/tests/test_goodman_focus.py @@ -221,7 +221,7 @@ def setUp(self): def test_imaging_mode(self): df = pandas.DataFrame(self.data) - expected_name = 'IM_Blue_FILTER-X' + expected_name = 'IM__Blue__FILTER-X' mode_name = GoodmanFocus._get_mode_name(group=df) self.assertEqual(mode_name, expected_name) @@ -229,7 +229,7 @@ def test_spectroscopy_mode(self): self.data['WAVMODE'] = ['400 z1'] * 5 df = pandas.DataFrame(self.data) - expected_name = 'SP_Blue_400z1_NOFILTER' + expected_name = 'SP__Blue__400z1__NOFILTER' mode_name = GoodmanFocus._get_mode_name(group=df) From 9d5b29156dfab0ff25ec5e806d1a2ef40e3abdc6 Mon Sep 17 00:00:00 2001 From: Simon Torres Date: Tue, 26 Jan 2021 13:31:29 -0300 Subject: [PATCH 05/12] Removed mr2 since all the documentation is in rst format --- docs/conf.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 075f636..09be444 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -44,7 +44,6 @@ 'sphinx.ext.autodoc', 'sphinx.ext.intersphinx', 'sphinxcontrib.napoleon', - 'm2r', 'matplotlib.sphinxext.plot_directive', ] @@ -54,7 +53,7 @@ # The suffix(es) of source filenames. # You can specify multiple suffix as a list of string: # -source_suffix = ['.rst', '.md'] +source_suffix = ['.rst'] # source_suffix = '.rst' # The master toctree document. From a256be97f2fd1dbac987ed4daf07b75d68e6cbd5 Mon Sep 17 00:00:00 2001 From: Simon Torres Date: Tue, 26 Jan 2021 13:33:01 -0300 Subject: [PATCH 06/12] replaced travis for github actions badge --- .readthedocs.yml | 2 +- README.md | 2 +- docs/index.rst | 6 ++---- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index ceeeeb7..eec711e 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -6,7 +6,7 @@ sphinx: formats: all python: - version: 3.5 + version: 3.7 install: - method: pip path: . diff --git a/README.md b/README.md index 64c2ac9..4e257f9 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ # Goodman Focus Finder -[![Build Status](https://travis-ci.org/soar-telescope/goodman_focus.svg?branch=master)](https://travis-ci.org/soar-telescope/goodman_focus) +![Goodman Focus](https://github.com/soar-telescope/goodman_focus/workflows/Goodman%20Focus/badge.svg) [![Coverage Status](https://coveralls.io/repos/github/soar-telescope/goodman_focus/badge.svg?branch=master)](https://coveralls.io/github/soar-telescope/goodman_focus?branch=master) [![Documentation Status](https://readthedocs.org/projects/goodman-focus/badge/?version=latest)](https://goodman-focus.readthedocs.io/en/latest/?badge=latest) [![pypi](https://img.shields.io/pypi/v/goodman_focus.svg?style=flat)](https://pypi.org/project/goodman-focus/) diff --git a/docs/index.rst b/docs/index.rst index 6d0db1e..fa304b7 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -6,8 +6,8 @@ Welcome to Goodman Focus' documentation! ======================================== -.. image:: https://travis-ci.org/soar-telescope/goodman_focus.svg?branch=master - :target: https://travis-ci.org/soar-telescope/goodman_focus +.. image:: https://github.com/soar-telescope/goodman_focus/workflows/Goodman%20Focus/badge.svg + :alt: Goodman Focus .. image:: https://coveralls.io/repos/github/soar-telescope/goodman_focus/badge.svg?branch=master :target: https://coveralls.io/github/soar-telescope/goodman_focus?branch=master .. image:: https://readthedocs.org/projects/goodman-focus/badge/?version=latest @@ -25,8 +25,6 @@ different focus values. It works for imaging and for spectroscopy. This tool requires python `3.6` at least to work. It will not install with `3.5`. -We recommend using `astroconda `_ since it is easier. - .. toctree:: :maxdepth: 2 From e79b8601f3f570e4af6e5023ba6c666fffab691e Mon Sep 17 00:00:00 2001 From: Simon Torres Date: Tue, 26 Jan 2021 13:33:43 -0300 Subject: [PATCH 07/12] removed .travis.yml --- .travis.yml | 26 -------------------------- 1 file changed, 26 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 8a02f1e..0000000 --- a/.travis.yml +++ /dev/null @@ -1,26 +0,0 @@ -language: python -python: -- '3.6' -- '3.7' -- '3.8' -branches: - only: - - master -install: -- sudo apt-get update -- wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh; -- bash miniconda.sh -b -p $HOME/miniconda -- export PATH="$HOME/miniconda/bin:$PATH" -- hash -r -- conda config --set always_yes yes --set changeps1 no -- conda env create -q python=$TRAVIS_PYTHON_VERSION -f environment.yml -- source activate goodman_focus -- python setup.py test -- python setup.py install -script: -- coverage run --branch --source= setup.py test -after_success: -- coveralls -notifications: - slack: - secure: nJCEgN2ou41cgpRZ89GVBkNbKsxaMaIYVClJcOoU/hTFI3/XLLxsWSe1x+Shp6relrdS/P+T1gwSwvGqKrZWBZ/TDRSAwCyLxZ4l49sfNV7JoHmEgyg4qulXKkPwLpCK7R3PJwE0MAIaZAaklNcxTKV63KjjAXiFuyF3ldK2sjQMwjUeqlomRG+3EZQJUxkQTKAnrupq5gPO+iZlI2jevTYm1qwmT6KhUeg0wQMT49PkA1AZbDK9ch2NysIYAQgEW6nyot7k30rytU3rFetCcrmuzuT7i33LCsjQd/ltyOnnqujVMNE5nFRJLA0k16IV6zZbpIIKhfUb2k3ObtJW8A2lhULF+s4N8ayPl5hZJPZ6c9riLDm96iqLIfi79s09UL3Ws4vN3oTWOgbd/28fNgwl4yqZecuYFT9EUPidTkgYg2P1Pi0r0InsAP+KbELTeQoN+XltBS0sJnoCKkIK/fe1ZZHVXEVkUMt5AqPcv6+UMSS49OjU0+bIkqXlqamlFHWIstcWPVdshNHu9aWqxMtWrYQdhkZDjBbfM9BG9Bv0K8zfNi5n4UyJslmUY6vZl7x+gx5xU7tgZYVmZSckBu1n14PZC8lGQHuuuP4poLlQ954Q+TB7Jwv177apR20Vx6DKw/od7i6Zy2MwxbUhFtn8V7oa8wLSQYInnUXlL4I= From be120e25fd4860751fdef8f3bfd517d51a43aa45 Mon Sep 17 00:00:00 2001 From: Simon Torres Date: Tue, 26 Jan 2021 13:35:39 -0300 Subject: [PATCH 08/12] updated documentation about the double underscore --- docs/usingit.rst | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/docs/usingit.rst b/docs/usingit.rst index bbe89a8..3206225 100644 --- a/docs/usingit.rst +++ b/docs/usingit.rst @@ -90,7 +90,7 @@ Interpreting Results The terminal version will print a message like this - ``[17:16:06][INFO]: Best Focus for mode SP_Red_400m2_GG455 is -1032.6413206603302`` + ``[17:16:06][INFO]: Best Focus for mode SP__Red__400m2__GG455 is -1032.6413206603302`` Using it as a library will return a dictionary with the following values. @@ -100,16 +100,16 @@ explained in :ref:`decoding-mode-name` .. code-block:: python - {'IM_Red_g-SDSS': -571.4837418709354, - 'IM_Red_i-SDSS': -802.567783891946, - 'IM_Red_r-SDSS': -573.8694347173587, - 'IM_Red_z-SDSS': -1161.5072536268135, - 'SP_Red_400m1_NOFILTER': -492.0760380190095, - 'SP_Red_400m2_GG455': -1032.6413206603302} + {'IM__Red__g-SDSS': -571.4837418709354, + 'IM__Red__i-SDSS': -802.567783891946, + 'IM__Red__r-SDSS': -573.8694347173587, + 'IM__Red__z-SDSS': -1161.5072536268135, + 'SP__Red__400m1__NOFILTER': -492.0760380190095, + 'SP__Red__400m2__GG455': -1032.6413206603302} It is also possible to obtain a plot, from terminal, use ``--plot-results``. -Below is a repreduction of results obtained with test data. +Below is a reproduction of results obtained with test data. .. plot:: @@ -118,7 +118,7 @@ Below is a repreduction of results obtained with test data. import matplotlib.pyplot as plt best_focus = -571.483741871 - mode_name = 'IM_Red_g-SDSS' + mode_name = 'IM__Red__g-SDSS' data = {'file': ['0186_focus_gp.fits', '0187_focus_gp.fits', @@ -187,21 +187,26 @@ The mode name is different for Imaging and Spectroscopy, since for imaging the important settings are the instrument and the filter and for spectroscopy the important values come from the instrument, the grating and observing mode and filter from second filter wheel. Below, the word inside the parenthesis represents -a kewyword from the header. +a keyword from the header. + +.. warning:: + Be aware that the separator string is a ``double underscore``. This change + was necessary to avoid confusion with single underscores used in certain + keyword values. For imaging: - ``IM_(INSTCONF)_(FILTER)`` + ``IM__(INSTCONF)__(FILTER)`` for example: - ``IM_Red_g-SDSS`` + ``IM__Red__g-SDSS`` For spectroscopy: - ``SP_(INSTCONF)_(WAVMODE)_(FILTER2)`` + ``SP__(INSTCONF)__(WAVMODE)__(FILTER2)`` for example: - ``SP_Red_400m2_GG455`` \ No newline at end of file + ``SP__Red__400m2__GG455`` \ No newline at end of file From 4476be15d54691ae54261cf5949dbe65269ea78f Mon Sep 17 00:00:00 2001 From: Simon Torres Date: Tue, 26 Jan 2021 13:36:11 -0300 Subject: [PATCH 09/12] fixed docstrings and updated version --- goodman_focus/goodman_focus.py | 7 +++---- goodman_focus/version.py | 2 +- setup.cfg | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/goodman_focus/goodman_focus.py b/goodman_focus/goodman_focus.py index acaf627..8ae68bc 100644 --- a/goodman_focus/goodman_focus.py +++ b/goodman_focus/goodman_focus.py @@ -168,11 +168,10 @@ def get_fwhm(peaks, values, x_axis, profile, model, sigma=3, maxiter=3): peaks (numpy.ndarray): An array of peaks present in the profile. values (numpy.ndarray): An array of values at peak location. x_axis (numpy.ndarray): X-axis for the profile, usually is equivalent to - `range(len(profile))`. - profile (numpy.ndarray): 1-dimensional profile of the image being - analyzed. + `range(len(profile))`. + profile (numpy.ndarray): 1-dimensional profile of the image being analyzed. model (Model): A model to fit to each peak location. `Gaussian1D` and - `Moffat1D` are supported. + `Moffat1D` are supported. sigma (int): Number sigmas to use on sigma-clipping maxiter (int): Maximum number of sigma-clipping iterations diff --git a/goodman_focus/version.py b/goodman_focus/version.py index 2a4753a..a130add 100644 --- a/goodman_focus/version.py +++ b/goodman_focus/version.py @@ -1,2 +1,2 @@ # This is an automatic generated file please do not edit -__version__ = '0.3.5' \ No newline at end of file +__version__ = '0.3.7' \ No newline at end of file diff --git a/setup.cfg b/setup.cfg index 28b3974..44a3246 100644 --- a/setup.cfg +++ b/setup.cfg @@ -32,4 +32,4 @@ install_requires = sphinx # version should be PEP440 compatible (http://www.python.org/dev/peps/pep-0440) -version = 0.3.6 +version = 0.3.7 From 422b58c5a571d137cab43e567c29bdf155eb1dcf Mon Sep 17 00:00:00 2001 From: Simon Torres Date: Tue, 26 Jan 2021 13:37:27 -0300 Subject: [PATCH 10/12] removed m2r from environment.yml and added sphinx_rtd_theme --- environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/environment.yml b/environment.yml index 5f1f65e..51b62f8 100644 --- a/environment.yml +++ b/environment.yml @@ -10,6 +10,6 @@ dependencies: - pip: - ccdproc - coveralls - - m2r + - sphinx_rtd_theme - sphinx - sphinxcontrib.napoleon From 6bf37d779c08b957a2a776d7eede2ed686ea1978 Mon Sep 17 00:00:00 2001 From: Simon Torres Date: Tue, 26 Jan 2021 13:38:23 -0300 Subject: [PATCH 11/12] bumped version to 1.0.0 given it's stability and usage. --- pyproject.toml | 7 ++++ setup.cfg | 2 +- tox.ini | 103 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 pyproject.toml create mode 100644 tox.ini diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..21f01d0 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,7 @@ +[build-system] + +requires = ["setuptools", + "setuptools_scm", + "wheel"] + +build-backend = 'setuptools.build_meta' \ No newline at end of file diff --git a/setup.cfg b/setup.cfg index 44a3246..160a515 100644 --- a/setup.cfg +++ b/setup.cfg @@ -32,4 +32,4 @@ install_requires = sphinx # version should be PEP440 compatible (http://www.python.org/dev/peps/pep-0440) -version = 0.3.7 +version = 1.0.0 diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..0a18bb0 --- /dev/null +++ b/tox.ini @@ -0,0 +1,103 @@ +[tox] +envlist = + py{36,37,38}-test{,-alldeps,-devdeps}{,-cov} + py{36,37,38}-test-numpy{116,117,118} + py{36,37,38}-test-astropy{30,40,lts} + py{36,37,38}-test-external + build_docs + linkcheck + codestyle +requires = + setuptools >= 30.3.0 + pip >= 19.3.1 +isolated_build = true +indexserver = + NIGHTLY = https://pypi.anaconda.org/scipy-wheels-nightly/simple + +[testenv] +# Suppress display of matplotlib plots generated during docs build +setenv = + MPLBACKEND=agg + # Disable the accelerate linear algebra library when running on macos as + # latest numpy versions do not work with it + NPY_BLAS_ORDER= + NPY_LAPACK_ORDER= + +# Pass through the following environment variables which may be needed for the CI +passenv = HOME WINDIR LC_ALL LC_CTYPE CC CI TRAVIS + +# Run the tests in a temporary directory to make sure that we don't import +# this package from the source tree +changedir = .tmp/{envname} + +# tox environments are constructed with so-called 'factors' (or terms) +# separated by hyphens, e.g. test-devdeps-cov. Lines below starting with factor: +# will only take effect if that factor is included in the environment name. To +# see a list of example environments that can be run, along with a description, +# run: +# +# tox -l -v +# +description = + run tests + alldeps: with all optional dependencies + devdeps: with the latest developer version of key dependencies + oldestdeps: with the oldest supported version of key dependencies + cov: and test coverage + numpy116: with numpy 1.16.* + numpy117: with numpy 1.17.* + numpy118: with numpy 1.18.* + astropy30: with astropy 3.0.* + astropy40: with astropy 4.0.* + astropylts: with the latest astropy LTS + external: with outside packages as dependencies + +# The following provides some specific pinnings for key packages +deps = + + numpy116: numpy==1.16.* + numpy117: numpy==1.17.* + numpy118: numpy==1.18.* + + astropy30: astropy==3.0.* + astropy40: astropy==4.0.* + astropylts: astropy==4.0.* + + devdeps: :NIGHTLY:numpy + devdeps: git+https://github.com/astropy/astropy.git#egg=astropy + + external: asdf + external: git+https://github.com/spacetelescope/jwst@stable + +# The following indicates which extras_require from setup.cfg will be installed +extras = + test + alldeps: all + +commands = + pip freeze + !cov: pytest --pyargs specutils {toxinidir}/docs {posargs} + cov: pytest --pyargs specutils {toxinidir}/docs --cov specutils --cov-config={toxinidir}/setup.cfg {posargs} + +[testenv:build_docs] +changedir = docs +description = invoke sphinx-build to build the HTML docs +extras = docs +commands = + pip freeze + sphinx-build -W -b html . _build/html + +[testenv:linkcheck] +changedir = docs +description = check the links in the HTML docs +extras = docs +commands = + pip freeze + sphinx-build -W -b linkcheck . _build/html + +[testenv:codestyle] +skip_install = true +changedir = . +description = check code style, e.g. with flake8 +deps = flake8 +commands = flake8 specutils --count --max-line-length=100 --select=E101,W191,W291,W292,W293,W391,E111,E112,E113,E502,E722,E901,E902 \ No newline at end of file From 968351b1734c27dc5238992862565e4b2f71501b Mon Sep 17 00:00:00 2001 From: Simon Torres Date: Tue, 26 Jan 2021 14:04:25 -0300 Subject: [PATCH 12/12] Added change record entry for version 1.0.0 --- CHANGES.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index eec1ce6..44091bf 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,13 @@ +.. _v1.0.0: + +1.0.0 +===== + +- Removed Travis CI [#31] +- Replaced separator to double underscore [#34, #35] +- Updated documentation. + + .. _v0.3.6: 0.3.6