From 7ee280ddca2697c2cf999a5281c5dfc8242e1b2f Mon Sep 17 00:00:00 2001 From: Joe Filippazzo Date: Tue, 26 Nov 2019 12:43:53 -0500 Subject: [PATCH 01/12] Removed pypi deploy --- .travis.yml | 13 ------------- README.rst | 14 ++++++++++---- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/.travis.yml b/.travis.yml index edee3b4..8cd4ec4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,16 +17,3 @@ script: after_success: - coveralls - -# deploy new versions to PyPI -deploy: - provider: pypi - distributions: "sdist bdist_wheel" - user: "__token__" - password: - secure: "pypi-AgEIcHlwaS5vcmcCJDk1YWM2MWJiLWJkY2YtNDZmMC05YWNlLTAzNDYyZTgxZGVlYwACO3sicGVybWlzc2lvbnMiOiB7InByb2plY3RzIjogWyJhd2VzaW1zb3NzIl19LCAidmVyc2lvbiI6IDF9AAAGIMtrbKrXoSda3BcSs59WkNb8gdiTvfeGosbRn1GA7FQD" - tags: true - repo: spacetelescope/awesimsoss - python: 3.5 - on: - tags: true \ No newline at end of file diff --git a/README.rst b/README.rst index c638233..464a6a5 100644 --- a/README.rst +++ b/README.rst @@ -2,8 +2,8 @@ awesimsoss ========== - -.. image:: https://img.shields.io/pypi/v/awesimsoss.svg +.. image:: https://img.shields.io/github/v/release/spacetelescope/awesimsoss?label=awesimsoss + :alt: GitHub release :target: https://pypi.python.org/pypi/awesimsoss .. image:: https://img.shields.io/travis/hover2pi/awesimsoss.svg @@ -17,8 +17,8 @@ awesimsoss :target: https://coveralls.io/github/spacetelescope/awesimsoss .. image:: https://pyup.io/repos/github/hover2pi/awesimsoss/shield.svg - :target: https://pyup.io/repos/github/hover2pi/awesimsoss/ - :alt: Updates + :target: https://pyup.io/repos/github/hover2pi/awesimsoss/ + :alt: Updates @@ -42,6 +42,12 @@ Installation The best way to install ``awesimsoss`` is +.. code-block:: bash + + conda install -c jfilippazzo awesimsoss + +You can also do it with + .. code-block:: bash git clone https://github.com/spacetelescope/awesimsoss.git From c9c98620e0870f601aa25ced29d45aa42424714d Mon Sep 17 00:00:00 2001 From: Joe Filippazzo Date: Tue, 26 Nov 2019 13:14:22 -0500 Subject: [PATCH 02/12] Update README.rst --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 464a6a5..ec0a3e7 100644 --- a/README.rst +++ b/README.rst @@ -4,7 +4,7 @@ awesimsoss .. image:: https://img.shields.io/github/v/release/spacetelescope/awesimsoss?label=awesimsoss :alt: GitHub release - :target: https://pypi.python.org/pypi/awesimsoss + :target: https://github.com/spacetelescope/awesimsoss/releases .. image:: https://img.shields.io/travis/hover2pi/awesimsoss.svg :target: https://travis-ci.com/hover2pi/awesimsoss From 6a8ecabcd1a2e40d57c42eee59a64135316b7904 Mon Sep 17 00:00:00 2001 From: Joe Filippazzo Date: Wed, 29 Jan 2020 14:58:02 -0500 Subject: [PATCH 03/12] Updated astropy and astroquery versions --- requirements_dev.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/requirements_dev.txt b/requirements_dev.txt index 509852d..9c15004 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -9,16 +9,15 @@ Sphinx==1.8.2 twine==1.12.1 click==7.0 -astropy==3.0.3 +astropy==4.0 numpy==1.16.1 bokeh==1.0.4 svo_filters==0.2.16 scipy==1.1.0 -astroquery==0.3.9 +astroquery==0.4 hotsoss==0.1.5 # webbpsf==0.7.0 batman-package==2.4.6 -# exoctk pytest==4.0.0 pytest-runner==4.2 From 68e834cc866f3d6ced174690a53931d07199a121 Mon Sep 17 00:00:00 2001 From: Joe Filippazzo Date: Wed, 29 Jan 2020 15:04:46 -0500 Subject: [PATCH 04/12] Updated environment.yml file --- environment.yml | 51 ++++++++++++++++++++++++++++++++++---------- requirements_dev.txt | 6 +++--- 2 files changed, 43 insertions(+), 14 deletions(-) diff --git a/environment.yml b/environment.yml index 3d59fda..2b6aa8f 100644 --- a/environment.yml +++ b/environment.yml @@ -1,30 +1,52 @@ +name: awesimsoss channels: - conda-forge - http://ssb.stsci.edu/astroconda - defaults dependencies: + - anaconda-client=1.7.2=py_0 + - astropy=4.0=py36h0b31af3_1 + - astroquery=0.4=py_0 + - bzip2=1.0.8=h01d97ff_1 - ca-certificates=2019.6.16=hecc5488_0 - certifi=2019.3.9=py36_0 + - clyent=1.2.2=py_1 + - conda=4.7.12=py36_0 + - conda-build=3.18.11=py36_0 + - conda-package-handling=1.6.0=py36h01d97ff_0 - cryptography=2.7=py36h212c5bf_0 - docutils=0.14=py36_1001 + - glob2=0.7=py_0 - healpy=1.11.0=py36_1 - imageio=2.5.0=py36_0 - libgcc=4.8.5=hdbeacc1_10 + - liblief=0.9.0=h2a1bed3_1 - libsodium=1.0.16=h470a237_1 + - lz4-c=1.8.3=h6de7cb9_1001 + - lzo=2.10=h1de35cc_1000 + - mkl-service=2.3.0=py36h0b31af3_0 + - mkl_fft=1.1.0=py36h3b54f70_1 + - mkl_random=1.1.0=py36h86efe34_0 - nbformat=4.4.0=py_1 - nbsphinx=0.3.5=py_0 - openssl=1.1.1b=h01d97ff_2 - pandoc=2.3.1=0 - pandocfilters=1.4.2=py_1 - pip=19.1.1=py36_0 + - pkginfo=1.5.0.1=py_0 + - py-lief=0.9.0=py36h6d6d4d2_1 + - pycosat=0.6.3=py36h0b31af3_1002 + - python-libarchive-c=2.9=py36_0 + - ripgrep=11.0.2=h01d97ff_3 + - ruamel_yaml=0.15.71=py36h1de35cc_1000 - snowballstemmer=1.2.1=py_1 - tblib=1.4.0=py_0 - tk=8.6.8=ha441bb4_0 + - tqdm=4.36.1=py_0 - webencodings=0.5.1=py_1 - alabaster=0.7.12=py36_0 - appnope=0.1.0=py36hf537a9a_0 - asn1crypto=0.24.0=py36_0 - - astropy=3.2.1=py36h1de35cc_0 - atomicwrites=1.3.0=py36_1 - attrs=19.1.0=py36_1 - babel=2.7.0=py_0 @@ -77,6 +99,7 @@ dependencies: - jupyter_core=4.4.0=py36_0 - keyring=18.0.0=py36_0 - kiwisolver=1.1.0=py36h0a44026_0 + - libarchive=3.3.3=h786848e_5 - libcxx=4.0.1=hcfea43d_1 - libcxxabi=4.0.1=hcfea43d_1 - libedit=3.1.20181209=hb402a30_0 @@ -95,9 +118,6 @@ dependencies: - matplotlib=3.1.0=py36h54f8f79_0 - mistune=0.8.4=py36h1de35cc_0 - mkl=2019.4=233 - - mkl-service=2.0.2=py36h1de35cc_0 - - mkl_fft=1.0.12=py36h5e564d8_0 - - mkl_random=1.0.2=py36h27c97d8_0 - more-itertools=7.0.0=py36_0 - mpmath=1.1.0=py36_0 - msgpack-python=0.6.1=py36h04f5b5a_1 @@ -105,8 +125,8 @@ dependencies: - ncurses=6.1=h0a44026_1 - networkx=2.3=py_0 - notebook=5.7.8=py36_0 - - numpy=1.16.4=py36hacdab7b_0 - - numpy-base=1.16.4=py36h6575580_0 + - numpy=1.18.1=py36h7241aed_0 + - numpy-base=1.18.1=py36h6575580_1 - olefile=0.46=py36_0 - packaging=19.0=py36_0 - pandas=0.24.2=py36h0a44026_0 @@ -185,7 +205,6 @@ dependencies: - zlib=1.2.11=h1de35cc_3 - zstd=1.3.7=h5bba6e5_0 - asdf=2.3.3=py36_0 - - astroquery=0.3.9=py36_0 - cfitsio=3.440=1 - crds=7.3.3=py36_0 - drizzle=1.13=py36_0 @@ -203,30 +222,40 @@ dependencies: - stsci.tools=3.4.13=py36_1 - verhawk=0.0.2=py36_1 - webbpsf-data=0.8.0=0 + - namedlist=1.7=py36_1 - pip: - asteval==0.9.14 - - bibtexparser==1.1.0 + - awesimsoss==0.3.1 - batman-package==2.4.6 + - bibtexparser==1.1.0 + - dustmaps==1.0.4 - et-xmlfile==1.0.1 - - exoctk==0.2.3 - flask==1.0.3 - future==0.17.1 + - hotsoss==0.1.6 - itsdangerous==1.1.0 - jdcal==1.4 + - jwst==0.13.8a0.dev37+g1f2237de - jwst-backgrounds==1.1.1 - jwxml==0.3.0 + - libarchive-c==2.9 + - lief==0.9.0 + - line-profiler==2.1.2 - llvmlite==0.29.0 - lmfit==0.9.13 + - memory-profiler==0.55.0 - msgpack==0.6.1 - - namedlist==1.7 - numba==0.44.1 - numpydoc==0.8.0 - openpyxl==2.5.8 - poppy==0.7.0 + - progressbar2==3.42.0 + - pscript==0.7.1 - pysiaf==0.2.4 + - python-utils==2.3.0 - relic==1.1.2 + - sedkit==0.3.1 - svo-filters==0.2.19 - uncertainties==3.1.1 - webbpsf==0.7.0 - werkzeug==0.15.4 - - git+https://github.com/spacetelescope/jwst@1f2237de#egg=jwst diff --git a/requirements_dev.txt b/requirements_dev.txt index 9c15004..1fe494b 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -12,11 +12,11 @@ click==7.0 astropy==4.0 numpy==1.16.1 bokeh==1.0.4 -svo_filters==0.2.16 +svo_filters==0.2.19 scipy==1.1.0 astroquery==0.4 -hotsoss==0.1.5 -# webbpsf==0.7.0 +hotsoss==0.1.6 +webbpsf batman-package==2.4.6 pytest==4.0.0 From 3f8c1eacedcabfa9d979e18f6406103ee2bc357a Mon Sep 17 00:00:00 2001 From: Joe Filippazzo Date: Fri, 31 Jan 2020 11:42:23 -0500 Subject: [PATCH 05/12] Updated packages and fixed bugs with _select_data method --- awesimsoss/awesim.py | 28 +++++++++++++++++----------- tests/test_awesim.py | 13 +++++++------ 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/awesimsoss/awesim.py b/awesimsoss/awesim.py index f3f57d4..700ac58 100644 --- a/awesimsoss/awesim.py +++ b/awesimsoss/awesim.py @@ -316,8 +316,11 @@ def export(self, outfile, all_data=False): outfile: str The path of the output file """ + if not outfile.endswith('_uncal.fits'): + raise ValueError("Filename must end with '_uncal.fits'") + # Make a RampModel - data = self.tso + data = copy(self.tso) mod = RampModel(data=data, groupdq=np.zeros_like(data), pixeldq=np.zeros((self.nrows, self.ncols)), err=np.zeros_like(data)) pix = utils.subarray_specs(self.subarray) @@ -791,6 +794,8 @@ def plot_lightcurve(self, column, time_unit='s', resolution_mult=20, draw=True): @run_required def plot_spectrum(self, frame=0, order=None, noise=False, scale='log', draw=True): """ + Plot a column sum of counts converted to flux density as a function of the mean column wavelength + Parameters ---------- frame: int @@ -807,14 +812,14 @@ def plot_spectrum(self, frame=0, order=None, noise=False, scale='log', draw=True # Get the data cube tso = self._select_data(order, noise) - # Get extracted spectrum (Column sum for now) + # Get counts per wavelength (Column sum for now) wave = np.mean(self.wave[0], axis=0) - flux_out = np.sum(tso[frame].data, axis=0) - response = 1./self.order1_response + counts = np.sum(tso[frame].data, axis=0) + response = self.order1_response # Convert response in [mJy/ADU/s] to [Flam/ADU/s] then invert so # that we can convert the flux at each wavelegth into [ADU/s] - flux_out *= response/self.time[np.mod(self.ngrps, frame)] + flux_out = (counts/response/(self.time[np.mod(self.ngrps, frame)]*q.s)).value # Trim wacky extracted edges flux_out[0] = flux_out[-1] = np.nan @@ -894,8 +899,8 @@ def _reset_psfs(self): # Convert response in [mJy/ADU/s] to [Flam/ADU/s] then invert so # that we can convert the flux at each wavelegth into [ADU/s] - response = self.frame_time/(response*q.mJy*ac.c/(wave*q.um)**2).to(self.star[1].unit).value - flux = np.interp(self.avg_wave[order-1], self.star[0], self.star[1], left=0, right=0)*response + response = self.frame_time/(response*q.mJy*ac.c/(wave*q.um)**2).to(self.star[1].unit) + flux = np.interp(wave, self.star[0].value, self.star[1].value, left=0, right=0)*self.star[1].unit*response cube = mt.SOSS_psf_cube(filt=self.filter, order=order, subarray=self.subarray)*flux[:, None, None] setattr(self, 'order{}_response'.format(order), response) setattr(self, 'order{}_psfs'.format(order), cube) @@ -920,12 +925,12 @@ def _select_data(self, order, noise, reshape=True): The selected data """ if order in [1, 2]: - tso = getattr(self, 'tso_order{}_ideal'.format(order)) + tso = copy(getattr(self, 'tso_order{}_ideal'.format(order))) else: if noise: - tso = self.tso + tso = copy(self.tso) else: - tso = self.tso_ideal + tso = copy(self.tso_ideal) # Reshape data if reshape: @@ -1009,9 +1014,10 @@ def simulate(self, ld_coeffs=None, noise=True, model_grid=None, n_jobs=-1, **kwa # Set the radius at the given wavelength from the transmission # spectrum (Rp/R*)**2... or an array of ones if self.planet is not None: - tdepth = np.interp(wave, self.planet[0], self.planet[1]) + tdepth = np.interp(wave, self.planet[0].to(q.um).value, self.planet[1]) else: tdepth = np.ones_like(wave) + tdepth[tdepth < 0] = np.nan self.rp = np.sqrt(tdepth) # Run multiprocessing to generate lightcurves diff --git a/tests/test_awesim.py b/tests/test_awesim.py index d12e229..5331a93 100755 --- a/tests/test_awesim.py +++ b/tests/test_awesim.py @@ -85,12 +85,13 @@ def test_add_lines(self): def test_export(self): """Test the export method""" # Make the TSO object and save - test_tso = TSO(ngrps=2, nints=2, star=self.star, subarray='SUBSTRIP256') - test_tso.simulate() - try: - test_tso.export('outfile.fits') - except NameError: - pass + test_tso = TestTSO(add_planet=True) + + # Good filename + test_tso.export('outfile_uncal.fits') + + # Bad filename (no '_uncal') + self.assertRaises(ValueError, test_tso.export, 'outfile.fits') def test_init(self): """Test that the TSO class is generated properly""" From 5d5254f0a6c8096f328cddc68e6cf55320ba0cca Mon Sep 17 00:00:00 2001 From: Joe Filippazzo Date: Tue, 24 Mar 2020 09:29:28 -0400 Subject: [PATCH 06/12] Added some inline comments --- awesimsoss/awesim.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/awesimsoss/awesim.py b/awesimsoss/awesim.py index 700ac58..ac36e27 100644 --- a/awesimsoss/awesim.py +++ b/awesimsoss/awesim.py @@ -767,13 +767,16 @@ def plot_lightcurve(self, column, time_unit='s', resolution_mult=20, draw=True): time = np.linspace(min(self.time), max(self.time), self.ngrps*self.nints*resolution_mult) time = time*q.s.to('d') + # Generate transit model tmodel = batman.TransitModel(self.tmodel, time) tmodel.rp = self.rp[col] theory = tmodel.light_curve(tmodel) theory *= max(lightcurve)/max(theory) + # Convert time time = time*q.d.to(time_unit) + # Add to figure lc.line(time, theory, legend=label+' model', color=color, alpha=0.8) # Convert datatime From 41c8bbb26af50174d4fb45779f8f637464b996c7 Mon Sep 17 00:00:00 2001 From: Joe Filippazzo Date: Tue, 24 Mar 2020 09:45:59 -0400 Subject: [PATCH 07/12] Updated version to 0.3.2 and added conda install of astropy since v4.0 is not on PyPI --- .travis.yml | 1 + setup.cfg | 2 +- setup.py | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8cd4ec4..82db695 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,7 @@ python: - 3.5 install: + - conda install -c anaconda astropy - pip install -r requirements_dev.txt - pip install -e . - pip install pytest pytest-cov coveralls diff --git a/setup.cfg b/setup.cfg index 7240ad7..3ed075e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.3.1 +current_version = 0.3.2 commit = True tag = True diff --git a/setup.py b/setup.py index a3ffa0b..1871d19 100755 --- a/setup.py +++ b/setup.py @@ -47,6 +47,6 @@ test_suite='tests', tests_require=test_requirements, url='https://github.com/hover2pi/awesimsoss', - version='0.3.1', + version='0.3.2', zip_safe=False, ) From e1989ac7679bb0f1785e3d0da72957b012ae0983 Mon Sep 17 00:00:00 2001 From: Joe Filippazzo Date: Tue, 24 Mar 2020 10:16:29 -0400 Subject: [PATCH 08/12] Added pip install of astropy 4.0 from github release --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 82db695..e29b8d9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ python: - 3.5 install: - - conda install -c anaconda astropy + - pip install git+https://github.com/astropy/astropy.git@763f069058cb1ee2038fa1cfa485452ec94b726e - pip install -r requirements_dev.txt - pip install -e . - pip install pytest pytest-cov coveralls From ba135ea1cf8e985a744922a3d04779b6b8eca141 Mon Sep 17 00:00:00 2001 From: Joe Filippazzo Date: Tue, 24 Mar 2020 10:21:47 -0400 Subject: [PATCH 09/12] astropy v4.0 requires python 3.6 so removing 3.5 test environment --- .travis.yml | 1 - setup.py | 4 +--- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index e29b8d9..40a3043 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,6 @@ language: python python: - 3.6 - - 3.5 install: - pip install git+https://github.com/astropy/astropy.git@763f069058cb1ee2038fa1cfa485452ec94b726e diff --git a/setup.py b/setup.py index 1871d19..ee500d4 100755 --- a/setup.py +++ b/setup.py @@ -25,9 +25,7 @@ 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', 'Natural Language :: English', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.6' ], description="Advanced Webb Exposure SIMulator for SOSS", entry_points={ From a41a05ad7b7753112e37a997e59bc9ce74a0ae1f Mon Sep 17 00:00:00 2001 From: Joe Filippazzo Date: Tue, 24 Mar 2020 10:36:40 -0400 Subject: [PATCH 10/12] Added jwst install to travis --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 40a3043..2ba625a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,8 @@ python: - 3.6 install: - - pip install git+https://github.com/astropy/astropy.git@763f069058cb1ee2038fa1cfa485452ec94b726e + - pip install git+https://github.com/astropy/astropy.git@4.0 + - pip install git+https://github.com/spacetelescope/jwst@0.15.0 - pip install -r requirements_dev.txt - pip install -e . - pip install pytest pytest-cov coveralls From 2df9d6a3d6e3209c07aea4e872a09ae070c4fa6d Mon Sep 17 00:00:00 2001 From: Joe Filippazzo Date: Tue, 24 Mar 2020 10:45:24 -0400 Subject: [PATCH 11/12] Switched back to pip install from commit for astropy --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2ba625a..f4327bd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ python: - 3.6 install: - - pip install git+https://github.com/astropy/astropy.git@4.0 + - pip install git+https://github.com/astropy/astropy.git@763f069058cb1ee2038fa1cfa485452ec94b726e - pip install git+https://github.com/spacetelescope/jwst@0.15.0 - pip install -r requirements_dev.txt - pip install -e . From e50d2a6e839a2819ea0554d9cbb9cd6202752fb9 Mon Sep 17 00:00:00 2001 From: Joe Filippazzo Date: Tue, 24 Mar 2020 11:12:58 -0400 Subject: [PATCH 12/12] Updated twine and bokeh versions --- .travis.yml | 1 + environment.yml | 2 +- requirements_dev.txt | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index f4327bd..83946b9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,7 @@ python: install: - pip install git+https://github.com/astropy/astropy.git@763f069058cb1ee2038fa1cfa485452ec94b726e - pip install git+https://github.com/spacetelescope/jwst@0.15.0 + - pip install git+https://github.com/pypa/twine.git@68dc617bafbc8a32adbe41c12055efe6ba6d0e1e - pip install -r requirements_dev.txt - pip install -e . - pip install pytest pytest-cov coveralls diff --git a/environment.yml b/environment.yml index 2b6aa8f..51fd47c 100644 --- a/environment.yml +++ b/environment.yml @@ -54,7 +54,7 @@ dependencies: - beautifulsoup4=4.7.1=py36_1 - blas=1.0=mkl - bleach=3.1.0=py36_0 - - bokeh=1.2.0=py36_0 + - bokeh=1.3.4 - cffi=1.12.3=py36hb5b8e2f_0 - chardet=3.0.4=py36_1 - click=7.0=py36_0 diff --git a/requirements_dev.txt b/requirements_dev.txt index 1fe494b..f79ffc5 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -6,12 +6,12 @@ flake8==3.6.0 tox==3.5.3 coverage==4.5.2 Sphinx==1.8.2 -twine==1.12.1 +twine==3.1.1 click==7.0 astropy==4.0 numpy==1.16.1 -bokeh==1.0.4 +bokeh==1.3.4 svo_filters==0.2.19 scipy==1.1.0 astroquery==0.4