From 5873444b1d92d280ae1cc4c9be5c83bfe45871db Mon Sep 17 00:00:00 2001 From: Pey Lian Lim <2090236+pllim@users.noreply.github.com> Date: Wed, 22 Jul 2020 00:36:59 -0400 Subject: [PATCH 1/2] Change CDBS to TRDS --- .github/workflows/ci_workflows.yml | 6 ++-- docs/index.rst | 44 +++++++++++++++--------------- docs/stsynphot/appendixa.rst | 2 +- docs/stsynphot/data_hst.rst | 2 +- docs/stsynphot/obsmode.rst | 14 +++++----- docs/stsynphot/refdata.rst | 38 +++++++++++++------------- docs/stsynphot/tutorials.rst | 2 +- stsynphot/config.py | 6 ++-- stsynphot/stio.py | 6 ++-- stsynphot/stsynphot.cfg | 2 +- stsynphot/tests/test_stio.py | 2 +- stsynphot/tests/test_tables.py | 2 +- 12 files changed, 63 insertions(+), 63 deletions(-) diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml index bc258ec..a4e3ec4 100644 --- a/.github/workflows/ci_workflows.yml +++ b/.github/workflows/ci_workflows.yml @@ -9,7 +9,7 @@ on: - cron: '0 6 * * 2' env: - PYSYN_CDBS: "http://ssb.stsci.edu/cdbs/" + PYSYN_CDBS: "https://ssb.stsci.edu/trds" jobs: pep_and_audit: @@ -74,7 +74,7 @@ jobs: sudo apt-get install libxml2-utils python -m pip install --upgrade pip setuptools pytest-cov codecov python -m pip install -e .[test,all] - # NOTE: If CDBS cannot take the hit, disable --remote-data + # NOTE: If TRDS cannot take the hit, disable --remote-data - name: Test with coverage run: pytest --cov=./ --cov-report=xml --open-files --remote-data - name: Coverage report @@ -144,7 +144,7 @@ jobs: run: | python -m pip install --upgrade pip setuptools scipy python -m pip install -e .[test] - # NOTE: If CDBS cannot take the hit, disable --remote-data + # NOTE: If TRDS cannot take the hit, disable --remote-data - name: Run tests run: pytest --open-files --remote-data diff --git a/docs/index.rst b/docs/index.rst index 3dddd96..7bac1d2 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -61,7 +61,7 @@ You can install **stsynphot** using one of the following ways: conda install stsynphot -c conda-forge -* From standalone release:: +* From standalone release on PyPI:: pip install stsynphot @@ -77,15 +77,15 @@ separately by They are expected to follow a certain directory structure under the root directory, identified by the ``PYSYN_CDBS`` environment variable that *must* be set prior to using this package. In the examples below, the root directory is -arbitrarily named ``/my/local/dir/cdbs/``. +arbitrarily named ``/my/local/dir/trds``. In bash shell:: - export PYSYN_CDBS=/my/local/dir/cdbs/ + export PYSYN_CDBS=/my/local/dir/trds In csh shell:: - setenv PYSYN_CDBS /my/local/dir/cdbs/ + setenv PYSYN_CDBS /my/local/dir/trds Below are the instructions to install: @@ -100,19 +100,19 @@ Below are the instructions to install: >>> # This is not marked remote data because it is essential for VEGAMAG >>> from stsynphot.spectrum import load_vega - >>> load_vega(vegafile='http://ssb.stsci.edu/cdbs/calspec/alpha_lyr_stis_009.fits', encoding='binary') # doctest: +IGNORE_OUTPUT + >>> load_vega(vegafile='https://ssb.stsci.edu/trds/calspec/alpha_lyr_stis_010.fits', encoding='binary') # doctest: +IGNORE_OUTPUT To ensure consistency for all data files used, **stsynphot silently overwrites synphot data file locations within the Python session**. For example:: >>> from synphot.config import conf as syn_conf >>> print(syn_conf.johnson_v_file) # doctest: +IGNORE_OUTPUT - http://ssb.stsci.edu/cdbs/comp/nonhst/johnson_v_004_syn.fits + https://ssb.stsci.edu/trds/comp/nonhst/johnson_v_004_syn.fits >>> from stsynphot.config import conf >>> print(conf.rootdir) # doctest: +IGNORE_OUTPUT - /my/local/dir/cdbs/ + /my/local/dir/trds >>> print(syn_conf.johnson_v_file) # doctest: +IGNORE_OUTPUT - /my/local/dir/cdbs//comp/nonhst/johnson_v_004_syn.fits + /my/local/dir/trds/comp/nonhst/johnson_v_004_syn.fits You can also take advantage of :ref:`Astropy configuration system ` to manage @@ -121,14 +121,14 @@ You can also take advantage of to your ``$HOME/.astropy/config/`` directory and modify it to your needs:: # This replaces the need to set PYSYN_CDBS environment variable - rootdir = /my/local/dir/cdbs/ + rootdir = /my/local/dir/trds :: # This pins lookup tables to a specific files - graphtable = /my/local/dir/cdbs/mtab/07r1502mm_tmg.fits - comptable = /my/local/dir/cdbs/mtab/07r1502nm_tmc.fits - thermtable = /my/local/dir/cdbs/mtab/tae17277m_tmt.fits + graphtable = /my/local/dir/trds/mtab/07r1502mm_tmg.fits + comptable = /my/local/dir/trds/mtab/07r1502nm_tmc.fits + thermtable = /my/local/dir/trds/mtab/tae17277m_tmt.fits :: @@ -160,9 +160,9 @@ Display the current settings for graph and component tables, telescope area >>> import stsynphot as stsyn >>> stsyn.showref() # doctest: +SKIP - graphtable: /my/local/dir/cdbs/mtab/07r1502mm_tmg.fits - comptable : /my/local/dir/cdbs/mtab/07r1502nm_tmc.fits - thermtable: /my/local/dir/cdbs/mtab/tae17277m_tmt.fits + graphtable: /my/local/dir/trds/mtab/07r1502mm_tmg.fits + comptable : /my/local/dir/trds/mtab/07r1502nm_tmc.fits + thermtable: /my/local/dir/trds/mtab/tae17277m_tmt.fits area : 45238.93416 waveset : Min: 500, Max: 26000, Num: 10000, Delta: None, Log: True [stsynphot.config] @@ -173,7 +173,7 @@ slash in path name does not affect software operation):: >>> import synphot >>> synphot.conf.vega_file # doctest: +IGNORE_OUTPUT - '/my/local/dir/cdbs//calspec/alpha_lyr_stis_009.fits' + '/my/local/dir/trds/calspec/alpha_lyr_stis_009.fits' Plot the built-in Vega spectrum, which is used to compute VEGAMAG. This is pre-loaded at start-up for convenience:: @@ -193,11 +193,11 @@ Then, show all the individual throughput files used in its construction:: >>> bp = stsyn.band('acs,wfc1,f555w') # doctest: +SKIP >>> bp.showfiles() # doctest: +SKIP INFO: #Throughput table names: - /my/local/dir/cdbs/comp/ota/hst_ota_007_syn.fits - /my/local/dir/cdbs/comp/acs/acs_wfc_im123_004_syn.fits - /my/local/dir/cdbs/comp/acs/acs_f555w_wfc_006_syn.fits - /my/local/dir/cdbs/comp/acs/acs_wfc_ebe_win12f_005_syn.fits - /my/local/dir/cdbs/comp/acs/acs_wfc_ccd1_mjd_021_syn.fits [...] + /my/local/dir/trds/comp/ota/hst_ota_007_syn.fits + /my/local/dir/trds/comp/acs/acs_wfc_im123_004_syn.fits + /my/local/dir/trds/comp/acs/acs_f555w_wfc_006_syn.fits + /my/local/dir/trds/comp/acs/acs_wfc_ebe_win12f_005_syn.fits + /my/local/dir/trds/comp/acs/acs_wfc_ccd1_mjd_021_syn.fits [...] Construct a source spectrum from Kurucz 1993 Atlas of Model Atmospheres for a star with blackbody temperature of 5770 Kelvin, at solar metallicity, and log @@ -383,7 +383,7 @@ Koornneef, J., Bohlin, R., Buser, R., Horne, K., & Turnshek, D. 1986, Highlights .. _stsynphot-ref-laidler2009: -Laidler, V. 2009, TSR 2009-01: Pysynphot Commissioning Report (Baltimore, MD: STScI), http://ssb.stsci.edu/tsr/2009_01/ +Laidler, V. 2009, TSR 2009-01: Pysynphot Commissioning Report (Baltimore, MD: STScI), https://ssb.stsci.edu/tsr/2009_01/ .. _stsynphot-ref-laidler2005: diff --git a/docs/stsynphot/appendixa.rst b/docs/stsynphot/appendixa.rst index dd3d74c..bc8fe39 100644 --- a/docs/stsynphot/appendixa.rst +++ b/docs/stsynphot/appendixa.rst @@ -105,7 +105,7 @@ Considering that the entire atlas occupies close to 70 MB of disk space, many applications could be satisfied by a copy of the solar metallicity spectra only (Table 2 of the README file). See -`Kurucz 1993 atlas README file `_ +`Kurucz 1993 atlas README file `_ for more details. The models are in FLAM *surface* flux units. If the number of counts or the diff --git a/docs/stsynphot/data_hst.rst b/docs/stsynphot/data_hst.rst index 9d135d6..fd19813 100644 --- a/docs/stsynphot/data_hst.rst +++ b/docs/stsynphot/data_hst.rst @@ -5,7 +5,7 @@ HST data files These data files are needed for calculations involving HST bandpasses. To install them locally, first download -http://ssb.stsci.edu/cdbs/tarfiles/synphot1.tar.gz . +https://ssb.stsci.edu/cdbs/tarfiles/synphot1.tar.gz . Move it to the appropriate location and then extract it:: $ tar -xzf synphot1.tar.gz diff --git a/docs/stsynphot/obsmode.rst b/docs/stsynphot/obsmode.rst index 81407fb..92f5af8 100644 --- a/docs/stsynphot/obsmode.rst +++ b/docs/stsynphot/obsmode.rst @@ -41,11 +41,11 @@ filter:: To see which throughput tables are being used, as set by CRDS:: >>> bp_acs.showfiles() # doctest: +SKIP - /my/local/dir/cdbs/comp/ota/hst_ota_007_syn.fits - /my/local/dir/cdbs/comp/acs/acs_wfc_im123_004_syn.fits - /my/local/dir/cdbs/comp/acs/acs_f555w_wfc_005_syn.fits - /my/local/dir/cdbs/comp/acs/acs_wfc_ebe_win12f_005_syn.fits - /my/local/dir/cdbs/comp/acs/acs_wfc_ccd1_mjd_021_syn.fits [...] + /my/local/dir/trds/comp/ota/hst_ota_007_syn.fits + /my/local/dir/trds/comp/acs/acs_wfc_im123_004_syn.fits + /my/local/dir/trds/comp/acs/acs_f555w_wfc_005_syn.fits + /my/local/dir/trds/comp/acs/acs_wfc_ebe_win12f_005_syn.fits + /my/local/dir/trds/comp/acs/acs_wfc_ccd1_mjd_021_syn.fits [...] Create a bandpass for Johnson *V*:: @@ -70,9 +70,9 @@ Then plot the actual bandpass and overlay those components:: >>> from synphot import SpectralElement >>> ota = SpectralElement.from_file( - ... '/my/local/dir/cdbs/comp/ota/hst_ota_007_syn.fits') # doctest: +SKIP + ... '/my/local/dir/trds/comp/ota/hst_ota_007_syn.fits') # doctest: +SKIP >>> ccd = SpectralElement.from_file( - ... '/my/local/dir/cdbs/comp/acs/acs_wfc_ccd1_mjd_021_syn.fits') # doctest: +SKIP + ... '/my/local/dir/trds/comp/acs/acs_wfc_ccd1_mjd_021_syn.fits') # doctest: +SKIP >>> bp_partial = ota * ccd # doctest: +SKIP >>> w = bp_acs.binset # waveset that is optimal for binning # doctest: +SKIP >>> plt.plot(w, ota(w), 'b--', w, ccd(w), 'r--', w, bp_partial(w), 'g', w, bp_acs(w), 'k') # doctest: +SKIP diff --git a/docs/stsynphot/refdata.rst b/docs/stsynphot/refdata.rst index c9a055c..a36f1b7 100644 --- a/docs/stsynphot/refdata.rst +++ b/docs/stsynphot/refdata.rst @@ -47,17 +47,17 @@ For backward compatibilty, :func:`~stsynphot.config.showref` and >>> import stsynphot as stsyn >>> stsyn.showref() # doctest: +SKIP - graphtable: /my/local/dir/cdbs/mtab/0bf2050hm_tmg.fits - comptable : /my/local/dir/cdbs/mtab/0ac1951am_tmc.fits - thermtable: /my/local/dir/cdbs/mtab/tae17277m_tmt.fits + graphtable: /my/local/dir/trds/mtab/0bf2050hm_tmg.fits + comptable : /my/local/dir/trds/mtab/0ac1951am_tmc.fits + thermtable: /my/local/dir/trds/mtab/tae17277m_tmt.fits area : 45238.93416 waveset : Min: 500, Max: 26000, Num: 10000, Delta: None, Log: True [stsynphot.config] >>> stsyn.getref() # doctest: +SKIP {'area': 45238.93416, - 'comptable': '/my/local/dir/cdbs/mtab/0ac1951am_tmc.fits', - 'graphtable': '/my/local/dir/cdbs/mtab/0bf2050hm_tmg.fits', - 'thermtable': '/my/local/dir/cdbs/mtab/tae17277m_tmt.fits', + 'comptable': '/my/local/dir/trds/mtab/0ac1951am_tmc.fits', + 'graphtable': '/my/local/dir/trds/mtab/0bf2050hm_tmg.fits', + 'thermtable': '/my/local/dir/trds/mtab/tae17277m_tmt.fits', 'waveset': 'Min: 500, Max: 26000, Num: 10000, Delta: None, Log: True'} To change a configurable item's value, use the machinery of @@ -93,19 +93,19 @@ For example:: >>> bp_hst = stsyn.band('wfc3,ir,f105w') # doctest: +SKIP >>> bp_hst.showfiles() # doctest: +SKIP - /my/local/dir/cdbs/comp/wfc3/wfc3_ir_primary_001_syn.fits - /my/local/dir/cdbs/comp/wfc3/wfc3_ir_secondary_001_syn.fits - /my/local/dir/cdbs/comp/wfc3/wfc3_pom_001_syn.fits - /my/local/dir/cdbs/comp/wfc3/wfc3_ir_csm_001_syn.fits - /my/local/dir/cdbs/comp/wfc3/wfc3_ir_fold_001_syn.fits - /my/local/dir/cdbs/comp/wfc3/wfc3_ir_mir1_001_syn.fits - /my/local/dir/cdbs/comp/wfc3/wfc3_ir_mir2_001_syn.fits - /my/local/dir/cdbs/comp/wfc3/wfc3_ir_mask_001_syn.fits - /my/local/dir/cdbs/comp/wfc3/wfc3_ir_rcp_001_syn.fits - /my/local/dir/cdbs/comp/wfc3/wfc3_ir_f105w_004_syn.fits - /my/local/dir/cdbs/comp/wfc3/wfc3_ir_win_001_syn.fits - /my/local/dir/cdbs/comp/wfc3/wfc3_ir_qe_003_syn.fits - /my/local/dir/cdbs/comp/wfc3/wfc3_ir_cor_004_syn.fits [...] + /my/local/dir/trds/comp/wfc3/wfc3_ir_primary_001_syn.fits + /my/local/dir/trds/comp/wfc3/wfc3_ir_secondary_001_syn.fits + /my/local/dir/trds/comp/wfc3/wfc3_pom_001_syn.fits + /my/local/dir/trds/comp/wfc3/wfc3_ir_csm_001_syn.fits + /my/local/dir/trds/comp/wfc3/wfc3_ir_fold_001_syn.fits + /my/local/dir/trds/comp/wfc3/wfc3_ir_mir1_001_syn.fits + /my/local/dir/trds/comp/wfc3/wfc3_ir_mir2_001_syn.fits + /my/local/dir/trds/comp/wfc3/wfc3_ir_mask_001_syn.fits + /my/local/dir/trds/comp/wfc3/wfc3_ir_rcp_001_syn.fits + /my/local/dir/trds/comp/wfc3/wfc3_ir_f105w_004_syn.fits + /my/local/dir/trds/comp/wfc3/wfc3_ir_win_001_syn.fits + /my/local/dir/trds/comp/wfc3/wfc3_ir_qe_003_syn.fits + /my/local/dir/trds/comp/wfc3/wfc3_ir_cor_004_syn.fits [...] >>> from synphot import SpectralElement >>> bp_nonhst = SpectralElement.from_filter('johnson_v') # doctest: +REMOTE_DATA diff --git a/docs/stsynphot/tutorials.rst b/docs/stsynphot/tutorials.rst index 4762656..cb673f7 100644 --- a/docs/stsynphot/tutorials.rst +++ b/docs/stsynphot/tutorials.rst @@ -151,7 +151,7 @@ needs to be normalized to literature value >>> import stsynphot as stsyn >>> from synphot import units, SourceSpectrum, SpectralElement, Observation >>> v_band = SpectralElement.from_filter('johnson_v') # doctest: +REMOTE_DATA - >>> sun_file = 'http://ssb.stsci.edu/cdbs/calspec/sun_reference_stis_002.fits' + >>> sun_file = 'https://archive.stsci.edu/hlsps/reference-atlases/cdbs/calspec/sun_reference_stis_002.fits' >>> sun_raw = SourceSpectrum.from_file(sun_file) # doctest: +REMOTE_DATA >>> sun = sun_raw.normalize(4.83 * units.VEGAMAG, v_band, vegaspec=stsyn.Vega) # doctest: +REMOTE_DATA >>> for obsmode in ['acs,wfc1,f555w', 'wfc3,uvis2,f336w', 'wfc3,ir,f160w']: diff --git a/stsynphot/config.py b/stsynphot/config.py index 001fc3e..5c0a684 100644 --- a/stsynphot/config.py +++ b/stsynphot/config.py @@ -1,7 +1,7 @@ # Licensed under a 3-clause BSD style license - see LICENSE.rst """``stsynphot`` configurable items. -The default configuration heavily depends on STScI CDBS structure +The default configuration heavily depends on STScI TRDS structure but it can be easily re-configured as the user wishes via `astropy.config`. @@ -35,8 +35,8 @@ class Conf(ConfigNamespace): # Root directory rootdir = ConfigItem( - os.environ.get('PYSYN_CDBS', '/grp/hst/cdbs/'), - 'CDBS data root directory') + os.environ.get('PYSYN_CDBS', '/grp/redcat/trds'), + 'TRDS data root directory') # Graph, optical component, and thermal component tables graphtable = ConfigItem('mtab$*_tmg.fits', 'Graph table') diff --git a/stsynphot/stio.py b/stsynphot/stio.py index 3eda133..026c9ce 100644 --- a/stsynphot/stio.py +++ b/stsynphot/stio.py @@ -101,7 +101,7 @@ def irafconvert(iraf_filename, sep='$'): Acceptable IRAF formats: * ``$path/file`` - ``path`` assumed to be environment variable. - * ``path$file`` - ``path`` is special IRAF shortcut for CDBS + * ``path$file`` - ``path`` is special IRAF shortcut for TRDS data directory (case-insensitive). Notes on special IRAF shortcut: @@ -201,8 +201,8 @@ def get_latest_file(template, raise_error=False, err_msg=''): if not path: path = os.curdir - # Remote HTTP directory - if path_lc.startswith('http:'): + # Remote HTTP/HTTPS directory + if path_lc.startswith('http'): from urllib import request from bs4 import BeautifulSoup diff --git a/stsynphot/stsynphot.cfg b/stsynphot/stsynphot.cfg index 75fc844..b0ccfc1 100644 --- a/stsynphot/stsynphot.cfg +++ b/stsynphot/stsynphot.cfg @@ -1,7 +1,7 @@ [config] ## This replaces the need to set PYSYN_CDBS environment variable -rootdir = /grp/hst/cdbs/ +rootdir = /grp/redcat/trds ## Graph, optical component, and thermal component tables graphtable = mtab$*_tmg.fits diff --git a/stsynphot/tests/test_stio.py b/stsynphot/tests/test_stio.py index 1138976..8399383 100644 --- a/stsynphot/tests/test_stio.py +++ b/stsynphot/tests/test_stio.py @@ -82,7 +82,7 @@ def setup_class(self): @pytest.mark.remote_data def test_http(self): """Remote HTTP path.""" - path = 'http://ssb.stsci.edu/cdbs_open/cdbs/mtab/OLD_FILES/' + path = 'https://ssb.stsci.edu/trds/mtab/OLD_FILES/' with warnings.catch_warnings(): # Warning issued from html5lib 1.0.1 warnings.filterwarnings( diff --git a/stsynphot/tests/test_tables.py b/stsynphot/tests/test_tables.py index 8372b6f..4c40463 100644 --- a/stsynphot/tests/test_tables.py +++ b/stsynphot/tests/test_tables.py @@ -4,7 +4,7 @@ .. note:: Uses local graph and component tables so that the tests - are not affected by CDBS changes. + are not affected by TRDS changes. """ From 81de59a5703c75151f2bdb0718ea840aa2ef551e Mon Sep 17 00:00:00 2001 From: Pey Lian Lim <2090236+pllim@users.noreply.github.com> Date: Wed, 29 Jul 2020 17:08:17 -0400 Subject: [PATCH 2/2] TRDS has tarfiles now [ci skip] --- docs/stsynphot/data_hst.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/stsynphot/data_hst.rst b/docs/stsynphot/data_hst.rst index fd19813..575561a 100644 --- a/docs/stsynphot/data_hst.rst +++ b/docs/stsynphot/data_hst.rst @@ -5,7 +5,7 @@ HST data files These data files are needed for calculations involving HST bandpasses. To install them locally, first download -https://ssb.stsci.edu/cdbs/tarfiles/synphot1.tar.gz . +https://ssb.stsci.edu/trds/tarfiles/synphot1.tar.gz . Move it to the appropriate location and then extract it:: $ tar -xzf synphot1.tar.gz