Skip to content

Commit

Permalink
Merge pull request #121 from pllim/redcat-trds
Browse files Browse the repository at this point in the history
Change CDBS to TRDS
  • Loading branch information
pllim committed Jul 29, 2020
2 parents 92293ea + 81de59a commit 5cb3424
Show file tree
Hide file tree
Showing 12 changed files with 63 additions and 63 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci_workflows.yml
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
44 changes: 22 additions & 22 deletions docs/index.rst
Expand Up @@ -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

Expand All @@ -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:

Expand All @@ -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 <astropy:astropy_config>` to manage
Expand All @@ -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

::

Expand Down Expand Up @@ -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]
Expand All @@ -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::
Expand All @@ -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
Expand Down Expand Up @@ -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:

Expand Down
2 changes: 1 addition & 1 deletion docs/stsynphot/appendixa.rst
Expand Up @@ -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 <http://ssb.stsci.edu/cdbs/grid/k93models/AA_README>`_
`Kurucz 1993 atlas README file <https://archive.stsci.edu/hlsps/reference-atlases/cdbs/grid/k93models/AA_README>`_
for more details.

The models are in FLAM *surface* flux units. If the number of counts or the
Expand Down
2 changes: 1 addition & 1 deletion docs/stsynphot/data_hst.rst
Expand Up @@ -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/trds/tarfiles/synphot1.tar.gz .
Move it to the appropriate location and then extract it::

$ tar -xzf synphot1.tar.gz
Expand Down
14 changes: 7 additions & 7 deletions docs/stsynphot/obsmode.rst
Expand Up @@ -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*::

Expand All @@ -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
Expand Down
38 changes: 19 additions & 19 deletions docs/stsynphot/refdata.rst
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/stsynphot/tutorials.rst
Expand Up @@ -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']:
Expand Down
6 changes: 3 additions & 3 deletions 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`.
Expand Down Expand Up @@ -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')
Expand Down
6 changes: 3 additions & 3 deletions stsynphot/stio.py
Expand Up @@ -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:
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion 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
Expand Down
2 changes: 1 addition & 1 deletion stsynphot/tests/test_stio.py
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion stsynphot/tests/test_tables.py
Expand Up @@ -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.
"""

Expand Down

0 comments on commit 5cb3424

Please sign in to comment.