From 2865ebc79592ddbe492bc7df88348ed747776a8d Mon Sep 17 00:00:00 2001 From: "york@stsci.edu" Date: Wed, 7 Oct 2020 11:32:30 -0400 Subject: [PATCH 01/18] Adding Travis and PyPI status to README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 508ef73..edf5d59 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +|Travis Status| |PyPI Status| + # STScI-STIPS For documentation and installation instructions please visit https://stsci-stips.readthedocs.io From 697b008970a68325f713de5596d6e043d253c903 Mon Sep 17 00:00:00 2001 From: "york@stsci.edu" Date: Thu, 8 Oct 2020 17:54:18 -0400 Subject: [PATCH 02/18] Moving from pysynphot to synphot/stsynphot so as to be compatible with pandeia 1.5.2 and be on a supported module --- .travis.yml | 8 ++- Dockerfile | 9 +-- docs/installation.rst | 15 +++-- environment.yml | 5 +- stips/astro_image/astro_image.py | 2 +- stips/data/CreatePhoenixGrid.py | 44 ++++++------- stips/instruments/instrument.py | 90 +++++++++++++------------- stips/instruments/wfc3ir.py | 5 +- stips/stellar_module/star_generator.py | 20 +++--- 9 files changed, 99 insertions(+), 99 deletions(-) diff --git a/.travis.yml b/.travis.yml index 434797e..da8aee4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -127,13 +127,15 @@ before_install: # download synphot data - mkdir $TEST_DATA_PATH/synphot - - wget -qO- http://ssb.stsci.edu/cdbs/tarfiles/synphot1.tar.gz -O $TEST_DATA_PATH/synphot1.tar.gz - - wget -qO- http://ssb.stsci.edu/cdbs/tarfiles/synphot2.tar.gz -O $TEST_DATA_PATH/synphot2.tar.gz - - wget -qO- http://ssb.stsci.edu/cdbs/tarfiles/synphot5.tar.gz -O $TEST_DATA_PATH/synphot5.tar.gz + - wget -qO- https://ssb.stsci.edu/trds/tarfiles/synphot1.tar.gz -O $TEST_DATA_PATH/synphot1.tar.gz + - wget -qO- https://ssb.stsci.edu/trds/tarfiles/synphot2.tar.gz -O $TEST_DATA_PATH/synphot2.tar.gz + - wget -qO- https://ssb.stsci.edu/trds/tarfiles/synphot5.tar.gz -O $TEST_DATA_PATH/synphot5.tar.gz + - wget -qO- https://ssb.stsci.edu/trds/tarfiles/synphot6.tar.gz -O $TEST_DATA_PATH/synphot5.tar.gz - tar -xzvf $TEST_DATA_PATH/synphot1.tar.gz -C $TEST_DATA_PATH/synphot/ - tar -xzvf $TEST_DATA_PATH/synphot2.tar.gz -C $TEST_DATA_PATH/synphot/ - tar -xzvf $TEST_DATA_PATH/synphot5.tar.gz -C $TEST_DATA_PATH/synphot/ + - tar -xzvf $TEST_DATA_PATH/synphot6.tar.gz -C $TEST_DATA_PATH/synphot/ - export PYSYN_CDBS=$TEST_DATA_PATH/synphot/grp/hst/cdbs diff --git a/Dockerfile b/Dockerfile index 88b099e..e11766e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -59,14 +59,15 @@ RUN wget -qO- https://stsci.box.com/shared/static/iufbhsiu0lts16wmdsi12cun25888n ENV stips_data /opt/stips_data # Extract PySynphot reference data -RUN wget -qO- http://ssb.stsci.edu/cdbs/tarfiles/synphot1.tar.gz | tar xvz -RUN wget -qO- http://ssb.stsci.edu/cdbs/tarfiles/synphot2.tar.gz | tar xvz -RUN wget -qO- http://ssb.stsci.edu/cdbs/tarfiles/synphot5.tar.gz | tar xvz +RUN wget -qO- https://ssb.stsci.edu/trds/tarfiles/synphot1.tar.gz | tar xvz +RUN wget -qO- https://ssb.stsci.edu/trds/tarfiles/synphot2.tar.gz | tar xvz +RUN wget -qO- https://ssb.stsci.edu/trds/tarfiles/synphot5.tar.gz | tar xvz +RUN wget -qO- https://ssb.stsci.edu/trds/tarfiles/synphot6.tar.gz | tar xvz ENV PYSYN_CDBS /opt/grp/hst/cdbs # Extract Pandeia reference data RUN wget -qO- https://stsci.box.com/shared/static/5j506xzg9tem2l7ymaqzwqtxne7ts3sr.gz | tar -xvz -ENV pandeia_refdata /opt/pandeia_data-1.5_wfirst +ENV pandeia_refdata /opt/pandeia_data-1.5.2_wfirst # Extract WebbPSF reference data # (note: version number env vars are declared close to where they are used diff --git a/docs/installation.rst b/docs/installation.rst index c81fd92..1008070 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -23,9 +23,9 @@ STIPS Requirements * `numpy`: STIPS uses numpy extensively for almost everything that it does. * `photutils`: STIPS uses photutils to determine the flux inside the half-light radius in generated Sersic profiles. -* `pysynphot`: STIPS uses pysynphot to generate bandpasses, count rates, and - zero points. Note that pysynphot's data files (also known as the CDBS data tree) must also be - installed and available as indicated in pysynphot's documentation. +* `synphot` and `stsynphot`: STIPS uses synphot and stsynphot to generate + bandpasses, count rates, and zero points. Note that the reference data must + also be downloaded, as described below in "Doanloading Required Data". * `scipy`: STIPS uses scipy to manipulate its internal images (zoom and rotate). Finally, STIPS requires a set of data files whose location is marked by setting the environment @@ -99,10 +99,11 @@ You will need to download the data and add them to your environmental path 2. `cd` into a directory you would like to store the data in and run the following commands:: - # PySynphot reference data - wget -qO- http://ssb.stsci.edu/cdbs/tarfiles/synphot1.tar.gz | tar xvz - wget -qO- http://ssb.stsci.edu/cdbs/tarfiles/synphot2.tar.gz | tar xvz - wget -qO- http://ssb.stsci.edu/cdbs/tarfiles/synphot5.tar.gz | tar xvz + # Synphot and STSynphot reference data + wget -qO- http://ssb.stsci.edu/trds/tarfiles/synphot1.tar.gz | tar xvz + wget -qO- http://ssb.stsci.edu/trds/tarfiles/synphot2.tar.gz | tar xvz + wget -qO- http://ssb.stsci.edu/trds/tarfiles/synphot5.tar.gz | tar xvz + wget -qO- http://ssb.stsci.edu/trds/tarfiles/synphot6.tar.gz | tar xvz # Pandeia reference data diff --git a/environment.yml b/environment.yml index 7f522aa..9ab8772 100644 --- a/environment.yml +++ b/environment.yml @@ -34,7 +34,8 @@ dependencies: - astropy - photutils - healpy - - pysynphot + - synphot + - stsynphot - esutil # Major modules @@ -57,7 +58,7 @@ dependencies: - pip: # Major modules - - pandeia.engine==1.5 + - pandeia.engine>=1.5 - jwst_backgrounds # Minor modules diff --git a/stips/astro_image/astro_image.py b/stips/astro_image/astro_image.py index 4ab0ab8..afc8465 100644 --- a/stips/astro_image/astro_image.py +++ b/stips/astro_image/astro_image.py @@ -168,7 +168,7 @@ def __init__(self, **kwargs): def __del__(self): - if os.path.exists(self.fname): + if hasattr(self, 'fname') and os.path.exists(self.fname): os.remove(self.fname) def copy(self): diff --git a/stips/data/CreatePhoenixGrid.py b/stips/data/CreatePhoenixGrid.py index cfda9df..a53c5cb 100644 --- a/stips/data/CreatePhoenixGrid.py +++ b/stips/data/CreatePhoenixGrid.py @@ -17,31 +17,15 @@ sys.path.append(os.path.abspath(os.path.join(os.getcwd(), "..", ".."))) import numpy as np -import pysynphot as ps +import synphot as syn +import stsynphot as stsyn from stips.utilities import InstrumentList from .. import __version__ as stips_version_info from astropy.io import fits as pyfits +from astropy import units as u print("STIPS Version: {}".format(stips_version_info)) -COMPFILES = sorted(glob.glob(os.path.join(os.environ["PYSYN_CDBS"],"mtab","*tmc.fits"))) -GRAPHFILES = sorted(glob.glob(os.path.join(os.environ["PYSYN_CDBS"],"mtab","*tmg.fits"))) -THERMFILES = sorted(glob.glob(os.path.join(os.environ["PYSYN_CDBS"],"mtab","*tmt.fits"))) -wfc3_refs = { - 'comptable': COMPFILES[-1], - 'graphtable': GRAPHFILES[-1], - 'thermtable': THERMFILES[-1], - 'area': 45238.93416, - 'waveset': (500,26000,10000.,'log') - } - -area = { - 'nircamlong': 253260.0, - 'nircamshort': 253260.0, - 'miri': 253260.0, - 'wfc3ir': 45238.93416, - 'wfi': 45238.93416 - } modes = { 'nircamshort': ['sw_imaging'], 'nircamlong': ['lw_imaging'], @@ -66,6 +50,14 @@ 'wfc3ir': {'imaging': "default"}, 'wfi': {'imaging': "any"} } +area = { + 'nircamlong': 253260.0, + 'nircamshort': 253260.0, + 'miri': 253260.0, + 'wfc3ir': 45238.93416, + 'wfi': 45238.93416 + } + def get_grid_points(): grid_file = os.path.abspath(os.path.join(os.environ['PYSYN_CDBS'], "grid", "phoenix", "catalog.fits")) @@ -81,7 +73,7 @@ def get_grid_points(): if __name__ == '__main__': - norm_bandpass = ps.ObsBandpass('johnson,i') + norm_bandpass = syn.SpectralElement.from_filter('johnson_i') coords = get_grid_points() print(coords) bandpasses = {} @@ -110,23 +102,23 @@ def get_grid_points(): for k, teff in enumerate(coords[2]): print("\t\t{}: Starting Teff = {}".format(time.ctime(), teff)) try: - spec = ps.Icat('phoenix', teff, Z, logg) + spec = stsyn.grid_to_spec('phoenix', teff, Z, logg) counts = False if sum(spec.flux) > 0: counts = True - except ps.exceptions.ParameterOutOfBounds: + except syn.exceptions.ParameterOutOfBounds: counts = False for l, mag in enumerate(coords[3]): print("\t\t\t{} of {}: {}: Starting Z = {}, log(g) = {}, Teff = {}, Mabs = {:>4}".format(n+1, total, time.ctime(), Z, logg, teff, mag), end='') if counts: - spec_norm = spec.renorm(mag, 'vegamag', norm_bandpass) + norm_value = u.Magnitude(mag) + spec_norm = spec.normalize(norm_value, norm_bandpass) for instrument in instruments: - ps.setref(area=area[instrument.lower()], waveset=(500, 260000, 10000., 'log')) for mode in modes[instrument.lower()]: for filter in filters[instrument.lower()][mode]: if counts: - obs = ps.Observation(spec_norm, bandpasses[instrument.lower()][filter], binset=spec_norm.wave) - result_arrays[instrument.lower()][filter][i,j,k,l] = obs.countrate() + obs = syn.Observation(spec_norm, bandpasses[instrument.lower()][filter], binset=spec_norm.waveset) + result_arrays[instrument.lower()][filter][i,j,k,l] = obs.countrate(area[mode]) print(".", end='') else: result_arrays[instrument.lower()][filter][i,j,k,l] = 0. diff --git a/stips/instruments/instrument.py b/stips/instruments/instrument.py index f6bffbc..01c06de 100644 --- a/stips/instruments/instrument.py +++ b/stips/instruments/instrument.py @@ -5,8 +5,10 @@ import glob, logging, os, shutil, sys, types, uuid import numpy as np -import pysynphot as ps +import synphot as syn +import stsynphot as stsyn +from astropy import units as u from astropy.io import fits as pyfits from astropy.table import Table, Column from functools import wraps @@ -464,7 +466,7 @@ def readPhoenixTable(self, table, bp, cached=-1): idx = np.where(datasets == dataset) if len(idx[0]) > 0: stargen = StarGenerator(ages[idx][0], metallicities[idx][0], seed=self.seed, logger=self.logger) - rates[idx] = stargen.make_cluster_rates(masses[idx], self.DETECTOR, self.filter, bp, self.REFS) + rates[idx] = stargen.make_cluster_rates(masses[idx], self, bp) del stargen rates = rates * 100 / (distances**2) #convert absolute to apparent rates if cached > 0: @@ -509,7 +511,6 @@ def readPhoenixRealtimeTable(self, table, bp, cached=-1): """ if table is None: return None - ps.setref(**self.REFS) ids = table['id'] ras = table['ra'] decs = table['dec'] @@ -523,10 +524,10 @@ def readPhoenixRealtimeTable(self, table, bp, cached=-1): rates = np.zeros_like(ras) for index in range(len(ids)): t, g, Z, a = temps[index], gravs[index], metallicities[index], apparents[index] - sp = ps.Icat('phoenix', t, Z, g) + sp = stsyn.grid_to_spec('phoenix', t, Z, g) sp = self.normalize(sp, a, norm_bp) - obs = ps.Observation(sp, bp, binset=sp.wave) - rates[index] = obs.countrate() + obs = syn.Observation(sp, bp, binset=sp.waveset) + rates[index] = obs.countrate(area=self.AREA) t = Table() t['ra'] = Column(data=ras) t['dec'] = Column(data=decs) @@ -549,7 +550,6 @@ def readPandeiaTable(self, table, bp, cached=-1): if table is None: return None from pandeia.engine.sed import SEDFactory - ps.setref(**self.REFS) ids = table['id'] ras = table['ra'] decs = table['dec'] @@ -564,8 +564,8 @@ def readPandeiaTable(self, table, bp, cached=-1): spectrum = SEDFactory(config=config) wave, flux = spectrum.get_spectrum() sp = self.normalize((wave, flux), a, norm_bp) - obs = ps.Observation(sp, bp, binset=sp.wave) - rates = np.append(rates, obs.countrate()) + obs = syn.Observation(sp, bp, binset=sp.wave) + rates = np.append(rates, obs.countrate(area=self.AREA)) t = Table() t['ra'] = Column(data=ras) t['dec'] = Column(data=decs) @@ -584,6 +584,7 @@ def readBC95Table(self, table, bp, cached=-1): """ Converts a BC95 galaxy grid of sources into the internal source table standard """ + from pandeia.engine.custom_exceptions import SynphotError as pSynError if table is None: return None # This function is needed because I can't get python not to read '50E8' as a number, or to output it as a correctly formatted string @@ -593,10 +594,8 @@ def stringify(num): value = int(10*(num/(10**np.floor(np.log10(num))))) return "{}E{}".format(value, exponent-1) - from pandeia.engine.custom_exceptions import PysynphotError self._log("info", "Converting BC95 Catalogue") proflist = {"expdisk":1,"devauc":4} - ps.setref(**self.REFS) distance_type = "redshift" ids = table['id'] ras = table['ra'] @@ -626,18 +625,21 @@ def stringify(num): # self._log("info", "{} of {}: {} {} {} {} {} {} {} {}".format(i, total, z, model, age, profile, radius, ratio, pa, mag)) fname = "bc95_{}_{}.fits".format(model, stringify(age)) try: - sp = ps.FileSpectrum(os.path.join(os.environ['PYSYN_CDBS'],"grid","bc95","templates",fname)) + sp = syn.SourceSpectrum.from_file(os.path.join(os.environ['PYSYN_CDBS'],"grid","bc95","templates",fname)) if distance_type == "redshift": - sp = sp.redshift(z) + sp = syn.SourceSpectrum(sp.model, z=z) sp = self.normalize(sp, mag, norm_bp) - obs = ps.Observation(sp, self.bandpass, force='taper', binset=sp.wave) - rate = obs.countrate() - except PysynphotError as e: - self._log('warning', 'Source {} of {}: Pysynphot Error {} encountered'.format(i, total, e)) + obs = syn.Observation(sp, self.bandpass, force='taper', + binset=sp.waveset) + rate = obs.countrate(area=self.AREA).value + except pSynError as e: + msg = 'Source {} of {}: Pysynphot Error {} encountered' + self._log('warning', msg.format(i, total, e)) rate = 0. - rates = np.append(rates,rate) - indices = np.append(indices,proflist[profile]) - notes = np.append(notes,"BC95_{}_{}_{}".format(model, stringify(age), mag)) + rates = np.append(rates, rate) + indices = np.append(indices, proflist[profile]) + note = "BC95_{}_{}_{}".format(model, stringify(age), mag) + notes = np.append(notes, note) t = Table() t['ra'] = Column(data=ras, dtype=np.float) t['dec'] = Column(data=decs) @@ -854,10 +856,10 @@ def normalize(self, source_spectrum_or_wave_flux, norm_flux, bandpass): if isinstance(source_spectrum_or_wave_flux, tuple): wave, flux = source_spectrum_or_wave_flux else: - wave, flux = norm.from_pysynphot(source_spectrum_or_wave_flux) + wave = source_spectrum_or_wave_flux.waveset + flux = source_spectrum_or_wave_flux(wave) norm_wave, norm_flux = norm.normalize(wave, flux) - sp = norm.to_pysynphot(norm_wave, norm_flux) - sp.convert('angstroms') + sp = syn.SourceSpectrum(syn.Empirical1D, points=norm_wave, lookup_table=norm_flux) return sp def get_type(self, bandpass_str): @@ -892,8 +894,8 @@ def bandpass(self): wave = np.append(wave, wave[-1]+(wave[-1]-wave[-2])) pce = np.append(pce, 0.) - self._bp = ps.ArrayBandpass(wave=wave, throughput=pce, waveunits='micron', name='bp_{}_{}'.format(self.instrument, self.filter)) - self._bp.convert('angstroms') + self._bp = syn.SpectralElement(syn.Empirical1D, points=wave*u.micron, + lookup_table=pce) return self._bp @property @@ -920,28 +922,29 @@ def pandeia_instrument(self): @property def zeropoint(self): - ps.setref(**self.REFS) - standard_star_file = GetStipsData(os.path.join("standards", "alpha_lyr_stis_008.fits")) - sp = ps.FileSpectrum(standard_star_file) - sp.convert('angstroms') + sp = syn.SourceSpectrum.from_vega() bp = self.bandpass - sp = sp.renorm(0.0,"VEGAMAG",bp) - obs = ps.Observation(sp, bp, binset=sp.wave) - zeropoint = obs.effstim("OBMAG") + obs = syn.Observation(sp, bp, binset=sp.waveset) + zeropoint = obs.effstim(flux_unit=u.ABmag).value return zeropoint @property - def photflam(self): - ps.setref(**self.REFS) - sp = ps.FlatSpectrum(0, fluxunits='stmag') - sp.convert('angstroms') + def unit_photflam(self): + sp = syn.SourceSpectrum(syn.ConstFlux1D, amplitude=(0.*u.STmag)) bp = self.bandpass - obs = ps.Observation(sp, bp, binset=sp.wave) - return obs.effstim('flam') / obs.countrate() + obs = syn.Observation(sp, bp, binset=sp.waveset) + pf = (obs.effstim(flux_unit='flam') / obs.countrate(area=self.AREA)) + return pf + + @property + def photflam(self): + return self.unit_photflam.value @property def pixel_background(self): - if self.background_value == 'none': + if isinstance(self.background_value, (int, float)): + return self.background_value + elif self.background_value == 'none': self._log("info", "Returning background 0.0 for 'none'") return 0. elif self.background_value == 'custom': @@ -989,12 +992,9 @@ def pixel_background(self): # Conversion: * self.SCALE[0] * self.SCALE[1] for arcsec^-2 -> pixel^-2 flux_array_pixels = 1e9 * flux_array * 2.3504e-11 * self.SCALE[0] * self.SCALE[1] - ps.setref(**self.REFS) - sp = ps.ArraySpectrum(wave_array, flux_array_pixels, waveunits='micron', fluxunits='mjy') - sp.convert('angstroms') - sp.convert('photlam') - obs = ps.Observation(sp, self.bandpass, binset=sp.wave, force='taper') - bg = obs.countrate() + sp = syn.SourceSpectrum(syn.Empirical1D, points=wave_array, lookup_table=flux_array_pixels) + obs = syn.Observation(sp, self.bandpass, binset=sp.waveset, force='taper') + bg = obs.countrate(area=self.AREA) self._log("info", "Returning background {} for '{}'".format(bg, self.background_value)) return bg diff --git a/stips/instruments/wfc3ir.py b/stips/instruments/wfc3ir.py index d2de1b3..2fda5dc 100644 --- a/stips/instruments/wfc3ir.py +++ b/stips/instruments/wfc3ir.py @@ -3,6 +3,7 @@ #External Modules import os +import stsynphot as stsyn #Local Modules from ..astro_image import AstroImage @@ -42,10 +43,8 @@ def resetPSF(self): @property def bandpass(self): - import pysynphot as ps - ps.setref(**self.REFS) obsmode = "wfc3,ir," + self.filter.lower() - return ps.ObsBandpass(obsmode) + return stsyn.band(obsmode) def generateReadnoise(self): """ diff --git a/stips/stellar_module/star_generator.py b/stips/stellar_module/star_generator.py index 8b9d8d4..ae288dd 100644 --- a/stips/stellar_module/star_generator.py +++ b/stips/stellar_module/star_generator.py @@ -33,6 +33,8 @@ import numpy as np import sqlite3 +from astropy import units as u + from scipy.interpolate import RegularGridInterpolator from esutil import sqlite_util @@ -239,7 +241,9 @@ def get_star_info(self): arr = sc.execute(stmt,asarray=True) return arr['m_ini'],arr['te'],arr['log_g'],arr['johnson_i_abs'] - def make_cluster_rates(self,masses,instrument,filter,bandpass=None,refs=None): + def make_cluster_rates(self, masses, ins, bandpass=None): + filter = ins.filter + instrument = ins.DETECTOR try: coords = np.load(os.path.join(self.gridpath, 'input.npy'), allow_pickle=True) except UnicodeError: @@ -271,15 +275,15 @@ def make_cluster_rates(self,masses,instrument,filter,bandpass=None,refs=None): else: self.log('warning', 'Could not find result file "result_{}_{}.npy" from {}'.format(instrument.lower(), filter.lower(), self.gridpath)) # raise FileNotFoundError('Could not find result file "result_{}_{}.npy" from {}'.format(instrument.lower(), filter.lower(), self.gridpath)) - import pysynphot as ps + import synphot as syn + import stsynphot as stsyn countrates = np.array(()) - ps.setref(**refs) - johnson_i = ps.ObsBandpass('johnson,i') + johnson_i = syn.SpectralElement.from_filter('johnson_i') for te, log_g, z, j_i in zip(temps, gravs, metals, mags): - spectrum = ps.Icat('phoenix', te, z, log_g) - spectrum = spectrum.renorm(j_i, 'vegamag', johnson_i) - obs = ps.Observation(spectrum, bandpass, binset=spectrum.wave) - countrates = np.append(countrates, obs.countrate()) + spectrum = stsyn.grid_to_spec('phoenix', te, z, log_g) + spectrum = spectrum.normalize(u.Magnitude(j_i), johnson_i) + obs = syn.Observation(spectrum, bandpass, binset=spectrum.waveset) + countrates = np.append(countrates, obs.countrate(ins.AREA)) self.log('info', 'Manually created star {} of {}'.format(len(countrates), len(temps))) return countrates From 8d06139471e5df7b130cd06072e4816dfab48185 Mon Sep 17 00:00:00 2001 From: "york@stsci.edu" Date: Thu, 8 Oct 2020 17:59:09 -0400 Subject: [PATCH 03/18] Pandeia prior to 1.5.2 used pysynphot, and STIPS needs to use the same underlying tools --- environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/environment.yml b/environment.yml index 9ab8772..b9f02e0 100644 --- a/environment.yml +++ b/environment.yml @@ -58,7 +58,7 @@ dependencies: - pip: # Major modules - - pandeia.engine>=1.5 + - pandeia.engine>=1.5.2 - jwst_backgrounds # Minor modules From 91cb7dd9d86174d6f3f07e010f8a8d7f0a80003c Mon Sep 17 00:00:00 2001 From: "york@stsci.edu" Date: Thu, 8 Oct 2020 18:03:44 -0400 Subject: [PATCH 04/18] Accidentally named synphot5.tgz and synphot6.tgz as synphot5.tgz thus overwriting 5 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index da8aee4..dd63c73 100644 --- a/.travis.yml +++ b/.travis.yml @@ -130,7 +130,7 @@ before_install: - wget -qO- https://ssb.stsci.edu/trds/tarfiles/synphot1.tar.gz -O $TEST_DATA_PATH/synphot1.tar.gz - wget -qO- https://ssb.stsci.edu/trds/tarfiles/synphot2.tar.gz -O $TEST_DATA_PATH/synphot2.tar.gz - wget -qO- https://ssb.stsci.edu/trds/tarfiles/synphot5.tar.gz -O $TEST_DATA_PATH/synphot5.tar.gz - - wget -qO- https://ssb.stsci.edu/trds/tarfiles/synphot6.tar.gz -O $TEST_DATA_PATH/synphot5.tar.gz + - wget -qO- https://ssb.stsci.edu/trds/tarfiles/synphot6.tar.gz -O $TEST_DATA_PATH/synphot6.tar.gz - tar -xzvf $TEST_DATA_PATH/synphot1.tar.gz -C $TEST_DATA_PATH/synphot/ - tar -xzvf $TEST_DATA_PATH/synphot2.tar.gz -C $TEST_DATA_PATH/synphot/ From be1bc0bb314151dee67c80373f9a0c8eb772090f Mon Sep 17 00:00:00 2001 From: "york@stsci.edu" Date: Thu, 8 Oct 2020 18:18:25 -0400 Subject: [PATCH 05/18] Needed to set jbt background spectrum units to microns. --- stips/instruments/instrument.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/stips/instruments/instrument.py b/stips/instruments/instrument.py index 01c06de..10be093 100644 --- a/stips/instruments/instrument.py +++ b/stips/instruments/instrument.py @@ -992,8 +992,10 @@ def pixel_background(self): # Conversion: * self.SCALE[0] * self.SCALE[1] for arcsec^-2 -> pixel^-2 flux_array_pixels = 1e9 * flux_array * 2.3504e-11 * self.SCALE[0] * self.SCALE[1] - sp = syn.SourceSpectrum(syn.Empirical1D, points=wave_array, lookup_table=flux_array_pixels) - obs = syn.Observation(sp, self.bandpass, binset=sp.waveset, force='taper') + sp = syn.SourceSpectrum(syn.Empirical1D, points=wave_array*u.micron, + lookup_table=flux_array_pixels) + obs = syn.Observation(sp, self.bandpass, binset=sp.waveset, + force='taper') bg = obs.countrate(area=self.AREA) self._log("info", "Returning background {} for '{}'".format(bg, self.background_value)) From b0a9c0e2a0469d382b95503699a9e83a3512df15 Mon Sep 17 00:00:00 2001 From: "york@stsci.edu" Date: Thu, 8 Oct 2020 18:37:46 -0400 Subject: [PATCH 06/18] changing pandeia data directory. --- .travis.yml | 2 +- Dockerfile | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index dd63c73..83d3a5d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -140,7 +140,7 @@ before_install: - export PYSYN_CDBS=$TEST_DATA_PATH/synphot/grp/hst/cdbs # download pandeia_data data - - wget -qO- https://stsci.box.com/shared/static/5j506xzg9tem2l7ymaqzwqtxne7ts3sr.gz -O $TEST_DATA_PATH/pandeia_data-1.5_wfirst.gz + - wget -qO- https://stsci.box.com/shared/static/7voehzi5krrpml5wgyg8bo954ew7arh2.gz -O $TEST_DATA_PATH/pandeia_data-1.5_wfirst.gz - tar -xzvf $TEST_DATA_PATH/pandeia_data-1.5_wfirst.gz -C $TEST_DATA_PATH/ - export pandeia_refdata=$TEST_DATA_PATH/pandeia_data-1.5_wfirst diff --git a/Dockerfile b/Dockerfile index e11766e..68e2411 100644 --- a/Dockerfile +++ b/Dockerfile @@ -66,8 +66,8 @@ RUN wget -qO- https://ssb.stsci.edu/trds/tarfiles/synphot6.tar.gz | tar xvz ENV PYSYN_CDBS /opt/grp/hst/cdbs # Extract Pandeia reference data -RUN wget -qO- https://stsci.box.com/shared/static/5j506xzg9tem2l7ymaqzwqtxne7ts3sr.gz | tar -xvz -ENV pandeia_refdata /opt/pandeia_data-1.5.2_wfirst +RUN wget -qO- https://stsci.box.com/shared/static/7voehzi5krrpml5wgyg8bo954ew7arh2.gz | tar -xvz +ENV pandeia_refdata /opt/pandeia_data-1.5_wfirst # Extract WebbPSF reference data # (note: version number env vars are declared close to where they are used From a53404f6db0c41d6c005885c8ca3c5d182811523 Mon Sep 17 00:00:00 2001 From: "york@stsci.edu" Date: Thu, 8 Oct 2020 18:43:37 -0400 Subject: [PATCH 07/18] changed to have the actual name of the pandeia ref file directory --- .travis.yml | 2 +- Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 83d3a5d..e610be8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -143,7 +143,7 @@ before_install: - wget -qO- https://stsci.box.com/shared/static/7voehzi5krrpml5wgyg8bo954ew7arh2.gz -O $TEST_DATA_PATH/pandeia_data-1.5_wfirst.gz - tar -xzvf $TEST_DATA_PATH/pandeia_data-1.5_wfirst.gz -C $TEST_DATA_PATH/ - - export pandeia_refdata=$TEST_DATA_PATH/pandeia_data-1.5_wfirst + - export pandeia_refdata=$TEST_DATA_PATH/pandeia_data-1.5.2rc2_roman # download webbpsf data - wget -qO- https://stsci.box.com/shared/static/qcptcokkbx7fgi3c00w2732yezkxzb99.gz -O $TEST_DATA_PATH/webbpsf_data.gz diff --git a/Dockerfile b/Dockerfile index 68e2411..29c2f6b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -67,7 +67,7 @@ ENV PYSYN_CDBS /opt/grp/hst/cdbs # Extract Pandeia reference data RUN wget -qO- https://stsci.box.com/shared/static/7voehzi5krrpml5wgyg8bo954ew7arh2.gz | tar -xvz -ENV pandeia_refdata /opt/pandeia_data-1.5_wfirst +ENV pandeia_refdata /opt/pandeia_data-1.5.2rc2_roman # Extract WebbPSF reference data # (note: version number env vars are declared close to where they are used From e6f0e2deeddc4b94d9c500a0c4259ade2d85ddef Mon Sep 17 00:00:00 2001 From: "york@stsci.edu" Date: Thu, 8 Oct 2020 19:00:23 -0400 Subject: [PATCH 08/18] make the background property unitless by default --- stips/instruments/instrument.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/stips/instruments/instrument.py b/stips/instruments/instrument.py index 10be093..24c2b69 100644 --- a/stips/instruments/instrument.py +++ b/stips/instruments/instrument.py @@ -929,7 +929,11 @@ def zeropoint(self): return zeropoint @property - def unit_photflam(self): + def photflam(self): + return self.photflam_unit.value + + @property + def photflam_unit(self): sp = syn.SourceSpectrum(syn.ConstFlux1D, amplitude=(0.*u.STmag)) bp = self.bandpass obs = syn.Observation(sp, bp, binset=sp.waveset) @@ -937,11 +941,11 @@ def unit_photflam(self): return pf @property - def photflam(self): - return self.unit_photflam.value + def pixel_background(self): + return self.pixel_background_unit.value @property - def pixel_background(self): + def pixel_background_unit(self): if isinstance(self.background_value, (int, float)): return self.background_value elif self.background_value == 'none': From 787adfdeda4b6b2cfd2dd021f07a7f9ffe90a54d Mon Sep 17 00:00:00 2001 From: "york@stsci.edu" Date: Thu, 8 Oct 2020 19:16:52 -0400 Subject: [PATCH 09/18] trying to fix documentation --- docs/installation.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/installation.rst b/docs/installation.rst index 1008070..e8e40dd 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -100,10 +100,10 @@ You will need to download the data and add them to your environmental path 2. `cd` into a directory you would like to store the data in and run the following commands:: # Synphot and STSynphot reference data - wget -qO- http://ssb.stsci.edu/trds/tarfiles/synphot1.tar.gz | tar xvz - wget -qO- http://ssb.stsci.edu/trds/tarfiles/synphot2.tar.gz | tar xvz - wget -qO- http://ssb.stsci.edu/trds/tarfiles/synphot5.tar.gz | tar xvz - wget -qO- http://ssb.stsci.edu/trds/tarfiles/synphot6.tar.gz | tar xvz + wget -qO- https://ssb.stsci.edu/trds/tarfiles/synphot1.tar.gz | tar xvz + wget -qO- https://ssb.stsci.edu/trds/tarfiles/synphot2.tar.gz | tar xvz + wget -qO- https://ssb.stsci.edu/trds/tarfiles/synphot5.tar.gz | tar xvz + wget -qO- https://ssb.stsci.edu/trds/tarfiles/synphot6.tar.gz | tar xvz # Pandeia reference data @@ -116,9 +116,9 @@ You will need to download the data and add them to your environmental path export WEBBPSF_PATH=//webbpsf-data export PYSYN_CDBS=//grp/hst/cdbs - export pandeia_refdata=//pandeia_data-x.x_wfirst + export pandeia_refdata=//pandeia_data-x.x.x_roman -Make sure that you have the correct version number for `pandeia_refdata` (replace the "x.x"). +Make sure that you have the correct version number for `pandeia_refdata` (replace the "x.x.x"). .. note:: The URL we provide in this section and the suggested pandeia reference data directory name From 28a57b3ee6368be800ca2bf6d6012d08f5e11a2e Mon Sep 17 00:00:00 2001 From: "york@stsci.edu" Date: Thu, 8 Oct 2020 19:29:51 -0400 Subject: [PATCH 10/18] typo fixes --- .travis.yml | 4 ++-- environment.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index e610be8..318777a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -140,9 +140,9 @@ before_install: - export PYSYN_CDBS=$TEST_DATA_PATH/synphot/grp/hst/cdbs # download pandeia_data data - - wget -qO- https://stsci.box.com/shared/static/7voehzi5krrpml5wgyg8bo954ew7arh2.gz -O $TEST_DATA_PATH/pandeia_data-1.5_wfirst.gz + - wget -qO- https://stsci.box.com/shared/static/7voehzi5krrpml5wgyg8bo954ew7arh2.gz -O $TEST_DATA_PATH/pandeia_data-1.5.2rc2_roman.gz - - tar -xzvf $TEST_DATA_PATH/pandeia_data-1.5_wfirst.gz -C $TEST_DATA_PATH/ + - tar -xzvf $TEST_DATA_PATH/pandeia_data-1.5.2rc2_roman.gz -C $TEST_DATA_PATH/ - export pandeia_refdata=$TEST_DATA_PATH/pandeia_data-1.5.2rc2_roman # download webbpsf data diff --git a/environment.yml b/environment.yml index b9f02e0..318506a 100644 --- a/environment.yml +++ b/environment.yml @@ -58,7 +58,7 @@ dependencies: - pip: # Major modules - - pandeia.engine>=1.5.2 + - pandeia.engine==1.5.2 - jwst_backgrounds # Minor modules From baeab79dc51cd41f78cc84123142294836edb874 Mon Sep 17 00:00:00 2001 From: "york@stsci.edu" Date: Thu, 8 Oct 2020 21:55:57 -0400 Subject: [PATCH 11/18] add explicit conda version --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 318777a..e8210f7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,6 +18,9 @@ addons: env: global: + # Define Conda Version + - MINICONDA_VERSION=4.8.5 + # The following versions are the 'default' for tests, unless # overridden underneath. They are defined here in order to save having # to repeat them for all configurations. From adcabf7c6e8f0bed4384564086fffd6973120a31 Mon Sep 17 00:00:00 2001 From: "york@stsci.edu" Date: Thu, 8 Oct 2020 22:11:02 -0400 Subject: [PATCH 12/18] change explicit conda version to 4.8.3 from 4.8.5 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e8210f7..b51e110 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,7 @@ addons: env: global: # Define Conda Version - - MINICONDA_VERSION=4.8.5 + - MINICONDA_VERSION=4.8.3 # The following versions are the 'default' for tests, unless # overridden underneath. They are defined here in order to save having From 54ff13cf526b4f3725e8fec1ff83e6fcd92f1e72 Mon Sep 17 00:00:00 2001 From: "york@stsci.edu" Date: Thu, 8 Oct 2020 22:17:22 -0400 Subject: [PATCH 13/18] change explicit conda version from 4.8.3 to latest --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b51e110..636ec3d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,7 @@ addons: env: global: # Define Conda Version - - MINICONDA_VERSION=4.8.3 + - MINICONDA_VERSION=latest # The following versions are the 'default' for tests, unless # overridden underneath. They are defined here in order to save having From 963fb5e55d06279fa99afbab4d0b0e2d4b7221e8 Mon Sep 17 00:00:00 2001 From: "york@stsci.edu" Date: Thu, 8 Oct 2020 22:36:16 -0400 Subject: [PATCH 14/18] change explicit conda version from latest to 4.8.0 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 636ec3d..4abfcf6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,7 @@ addons: env: global: # Define Conda Version - - MINICONDA_VERSION=latest + - MINICONDA_VERSION=4.8.0 # The following versions are the 'default' for tests, unless # overridden underneath. They are defined here in order to save having From 5fb6e95e6a1666d6d69a8f157d78e11d7e7e5c75 Mon Sep 17 00:00:00 2001 From: "york@stsci.edu" Date: Thu, 8 Oct 2020 22:45:13 -0400 Subject: [PATCH 15/18] change explicit conda version from 4.8.0 to py38_4.8.3 --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4abfcf6..47354b5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,12 +19,12 @@ addons: env: global: # Define Conda Version - - MINICONDA_VERSION=4.8.0 + - MINICONDA_VERSION=py38_4.8.3 # The following versions are the 'default' for tests, unless # overridden underneath. They are defined here in order to save having # to repeat them for all configurations. - - PYTHON_VERSION=3.7 + - PYTHON_VERSION=3.8 - NUMPY_VERSION=stable - ASTROPY_VERSION=stable - MAIN_CMD='python setup.py' From b8781330f693bd58bb11433783c698e4f9705a6d Mon Sep 17 00:00:00 2001 From: "york@stsci.edu" Date: Thu, 8 Oct 2020 22:46:53 -0400 Subject: [PATCH 16/18] change explicit conda version from py38_4.8.3 to py37_4.8.3 --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 47354b5..c18b888 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,12 +19,12 @@ addons: env: global: # Define Conda Version - - MINICONDA_VERSION=py38_4.8.3 + - MINICONDA_VERSION=py37_4.8.3 # The following versions are the 'default' for tests, unless # overridden underneath. They are defined here in order to save having # to repeat them for all configurations. - - PYTHON_VERSION=3.8 + - PYTHON_VERSION=3.7 - NUMPY_VERSION=stable - ASTROPY_VERSION=stable - MAIN_CMD='python setup.py' From 0c4165c5ece38c45fd2cff34d807d534fbed2d59 Mon Sep 17 00:00:00 2001 From: Robel Geda Date: Fri, 9 Oct 2020 01:19:28 -0400 Subject: [PATCH 17/18] Try adding CONDA_ENVIRONMENT='.rtd-environment.yml' --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c18b888..5a97a28 100644 --- a/.travis.yml +++ b/.travis.yml @@ -77,7 +77,7 @@ matrix: - name: "Doc Build Test" os: linux env: SETUP_CMD='build_docs -w' - CONDA_DEPENDENCIES=$CONDA_DEPENDENCIES_DOC + CONDA_ENVIRONMENT='.rtd-environment.yml' # Main test # --------------------------- From e52673d4983d2f6f031345829a4f726149dfd6f1 Mon Sep 17 00:00:00 2001 From: Robel Geda Date: Fri, 9 Oct 2020 01:42:34 -0400 Subject: [PATCH 18/18] add sphinx_rtd_theme --- .rtd-environment.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.rtd-environment.yml b/.rtd-environment.yml index 4d971c0..13d7c2b 100644 --- a/.rtd-environment.yml +++ b/.rtd-environment.yml @@ -13,9 +13,10 @@ dependencies: # Docs - sphinx - docutils + - sphinx_rtd_theme - stsci_rtd_theme - pip: # Docs - astropy_helpers - - sphinx_astropy \ No newline at end of file + - sphinx_astropy