Skip to content

Commit

Permalink
Merge pull request #135 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 e20c5a6 + 2e9271f commit 51b88d3
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 56 deletions.
2 changes: 1 addition & 1 deletion doc/source/appendixa.rst
Original file line number Diff line number Diff line change
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
10 changes: 5 additions & 5 deletions doc/source/bandpass.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ To see which throughput tables are being used, as set by
:ref:`pysynphot-refdata`:

>>> bp_acs.showfiles()
/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 Down
2 changes: 1 addition & 1 deletion doc/source/how_works.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ they will be able to use **pysynphot**. This can be done in one of two ways:
:ref:`pysynphot-installation-setup`. This method offers the convenience of
automatically creating the necessary directory tree for the data.
* Individual CRDS files: An alternate method is to transfer the
individual tables using HTTP (``ssb.stsci.edu/cdbs``) to STScI
individual tables using HTTP (``ssb.stsci.edu/trds``) to STScI
from the directories given also in :ref:`pysynphot-installation-setup`.

The best method is perhaps a combination of the two: First-time
Expand Down
20 changes: 10 additions & 10 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,22 +71,22 @@ Data files for **pysynphot** are distributed 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 example 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/

These data files are needed for calculations involving HST bandpasses:

+----------------------------+------------------------------+--------------------------------------------------+
| Description | Directory name | Download |
+============================+==============================+==================================================+
|Master tables | $PYSYN_CDBS/mtab/ |http://ssb.stsci.edu/cdbs/tarfiles/synphot1.tar.gz|
|Master tables | $PYSYN_CDBS/mtab/ |http://ssb.stsci.edu/trds/tarfiles/synphot1.tar.gz|
+----------------------------+------------------------------+ |
|HST/ACS throughput tables | $PYSYN_CDBS/comp/acs/ | |
+----------------------------+------------------------------+ |
Expand Down Expand Up @@ -122,7 +122,7 @@ These data files are needed for calculations involving source spectra:
+------------------------------------------+----------------------------+--------------------------------------------------+
| Description | Directory name | Download |
+==========================================+============================+==================================================+
|Interstellar extinction curves |$PYSYN_CDBS/extinction/ |http://ssb.stsci.edu/cdbs/tarfiles/synphot2.tar.gz|
|Interstellar extinction curves |$PYSYN_CDBS/extinction/ |http://ssb.stsci.edu/trds/tarfiles/synphot2.tar.gz|
+------------------------------------------+----------------------------+ |
|AGN templates |$PYSYN_CDBS/grid/agn/ | |
+------------------------------------------+----------------------------+ |
Expand All @@ -146,13 +146,13 @@ These data files are needed for calculations involving source spectra:
+------------------------------------------+----------------------------+ |
|Pickles stellar atlas |$PYSYN_CDBS/grid/pickles/ | |
+------------------------------------------+----------------------------+--------------------------------------------------+
|Castelli & Kurucz (2004) stellar atlas |$PYSYN_CDBS/grid/ck04models/|http://ssb.stsci.edu/cdbs/tarfiles/synphot3.tar.gz|
|Castelli & Kurucz (2004) stellar atlas |$PYSYN_CDBS/grid/ck04models/|http://ssb.stsci.edu/trds/tarfiles/synphot3.tar.gz|
+------------------------------------------+----------------------------+--------------------------------------------------+
|Kurucz (1993) stellar atlas |$PYSYN_CDBS/grid/k93models/ |http://ssb.stsci.edu/cdbs/tarfiles/synphot4.tar.gz|
|Kurucz (1993) stellar atlas |$PYSYN_CDBS/grid/k93models/ |http://ssb.stsci.edu/trds/tarfiles/synphot4.tar.gz|
+------------------------------------------+----------------------------+--------------------------------------------------+
|Phoenix stellar atlas |$PYSYN_CDBS/grid/phoenix/ |http://ssb.stsci.edu/cdbs/tarfiles/synphot5.tar.gz|
|Phoenix stellar atlas |$PYSYN_CDBS/grid/phoenix/ |http://ssb.stsci.edu/trds/tarfiles/synphot5.tar.gz|
+------------------------------------------+----------------------------+--------------------------------------------------+
|HST calibration spectra |$PYSYN_CDBS/calspec/ |http://ssb.stsci.edu/cdbs/tarfiles/synphot6.tar.gz|
|HST calibration spectra |$PYSYN_CDBS/calspec/ |http://ssb.stsci.edu/trds/tarfiles/synphot6.tar.gz|
+------------------------------------------+----------------------------+--------------------------------------------------+

Throughout this document, unless explicitly stated otherwise, the examples
Expand All @@ -161,7 +161,7 @@ packages are already imported:

>>> import os
>>> os.environ['PYSYN_CDBS']
'/my/local/dir/cdbs/'
'/my/local/dir/trds/'
>>> import numpy as np
>>> import pysynphot as S

Expand Down
48 changes: 24 additions & 24 deletions doc/source/refdata.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,30 @@ also returns the current settings, but as a Python :py:class:`dict` instead of
printing to screen. For example:

>>> S.showref()
thermtable: /my/local/dir/cdbs/mtab/tae17277m_tmt.fits
thermtable: /my/local/dir/trds/mtab/tae17277m_tmt.fits
waveset: Min: 500, Max: 26000, Num: 10000.0, Delta: None, Log: True
comptable: /my/local/dir/cdbs/mtab/yah1742rm_tmc.fits
graphtable: /my/local/dir/cdbs/mtab/yah1742qm_tmg.fits
comptable: /my/local/dir/trds/mtab/yah1742rm_tmc.fits
graphtable: /my/local/dir/trds/mtab/yah1742qm_tmg.fits
area: 45238.93416
>>> S.setref(graphtable='new_tmg.fits', comptable='new_tmc.fits', area=1)
>>> S.showref()
thermtable: /my/local/dir/cdbs/mtab/tae17277m_tmt.fits
thermtable: /my/local/dir/trds/mtab/tae17277m_tmt.fits
waveset: Min: 500, Max: 26000, Num: 10000.0, Delta: None, Log: True
comptable: new_tmc.fits
graphtable: new_tmg.fits
area: 1
>>> S.setref() # Reset to software default
>>> S.showref()
thermtable: /my/local/dir/cdbs/mtab/tae17277m_tmt.fits
thermtable: /my/local/dir/trds/mtab/tae17277m_tmt.fits
waveset: Min: 500, Max: 26000, Num: 10000.0, Delta: None, Log: True
comptable: /my/local/dir/cdbs/mtab/yah1742rm_tmc.fits
graphtable: /my/local/dir/cdbs/mtab/yah1742qm_tmg.fits
comptable: /my/local/dir/trds/mtab/yah1742rm_tmc.fits
graphtable: /my/local/dir/trds/mtab/yah1742qm_tmg.fits
area: 45238.93416
>>> S.refs.getref()
{'area': 45238.93416,
'comptable': '/my/local/dir/cdbs/mtab/yah1742rm_tmc.fits',
'graphtable': '/my/local/dir/cdbs/mtab/yah1742qm_tmg.fits',
'thermtable': '/my/local/dir/cdbs/mtab/tae17277m_tmt.fits',
'comptable': '/my/local/dir/trds/mtab/yah1742rm_tmc.fits',
'graphtable': '/my/local/dir/trds/mtab/yah1742qm_tmg.fits',
'thermtable': '/my/local/dir/trds/mtab/tae17277m_tmt.fits',
'waveset': 'Min: 500, Max: 26000, Num: 10000.0, Delta: None, Log: True'}

Changing the default tables is not recommended unless you know what you are
Expand All @@ -74,22 +74,22 @@ not rely on the tables does not have this feature. For example:
>>> bp_hst.name
'wfc3,ir,f105w'
>>> bp_hst.showfiles()
/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
>>> bp_nonhst = S.ObsBandpass('johnson,v')
>>> bp_nonhst.name
'/my/local/dir/cdbs/comp/nonhst/johnson_v_004_syn.fits'
'/my/local/dir/trds/comp/nonhst/johnson_v_004_syn.fits'
>>> bp_nonhst.showfiles()
AttributeError: 'TabularSpectralElement' object has no attribute 'showfiles'

Expand Down
14 changes: 7 additions & 7 deletions doc/source/tutorials.rst
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,17 @@ filter:
Show all the components in the light path used to create the bandpass:

>>> bp1.showfiles()
/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

Read the OTA and CCD transmissions from files, then multiply them:

>>> ota = S.FileBandpass('/my/local/dir/cdbs/comp/ota/hst_ota_007_syn.fits')
>>> ota = S.FileBandpass('/my/local/dir/trds/comp/ota/hst_ota_007_syn.fits')
>>> ccd = S.FileBandpass(
... '/my/local/dir/cdbs/comp/acs/acs_wfc_ccd1_mjd_021_syn.fits')
... '/my/local/dir/trds/comp/acs/acs_wfc_ccd1_mjd_021_syn.fits')
>>> bp2 = ota * ccd

Plot the bandpass and overlay its two components from above:
Expand Down
11 changes: 5 additions & 6 deletions pysynphot/locations.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
**Global Variables**
* ``pysynphot.locations.rootdir`` - Root directory for CDBS/CRDS
* ``pysynphot.locations.rootdir`` - Root directory for TRDS/CRDS
data files. By default, it is extracted from your ``PYSYN_CDBS``
environment variable.
Expand Down Expand Up @@ -40,15 +40,14 @@
from astropy.io import fits as pyfits
from bs4 import BeautifulSoup

# Replace cdbs_roots lookup with an environment variable
try:
rootdir = os.environ['PYSYN_CDBS']
except KeyError:
warnings.warn("PYSYN_CDBS is undefined; functionality will be SEVERELY "
"crippled.")
rootdir = ''

ftp_rootdir = 'http://ssb.stsci.edu/cdbs_open/cdbs'
ftp_rootdir = 'https://ssb.stsci.edu/trds'

# Data directory is now installed locally
specdir = os.path.join(os.path.dirname(__file__), 'data')
Expand Down Expand Up @@ -222,7 +221,7 @@ def get_data_filename(filename):
VegaFile = get_data_filename('alpha_lyr_stis_010.fits')


# CDBS moved extinction files to $PYSYN_CDBS/extinction .
# RedCat moved extinction files to $PYSYN_CDBS/extinction .
# The old location $PYSYN_CDBS/grid/extinction is no longer used.
EXTDIR = 'extinction'

Expand Down Expand Up @@ -264,7 +263,7 @@ def get_latest_file(template, raise_error=False, err_msg=''):
path_lowercase = path.lower()

# Remote HTTP directory
if path_lowercase.startswith('http:'):
if path_lowercase.startswith('http'):
try:
response = request.urlopen(path) # PY2 has no context manager
soup = BeautifulSoup(response, 'html.parser')
Expand Down Expand Up @@ -328,7 +327,7 @@ def _get_RedLaws():
# get all the fits files in EXTDIR
globstr = os.path.join(extdir, '*.fits')

if extdir_lowercase.startswith('http:'):
if extdir_lowercase.startswith('http'):
response = request.urlopen(extdir) # PY2 has no context manager
soup = BeautifulSoup(response, 'html.parser')
files = list(set([x.text for x in soup.find_all("a")
Expand Down
4 changes: 2 additions & 2 deletions pysynphot/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def __init__(self, CFile=None):
# None is common for various errors.
# the default value of None is not useful; pyfits.open(None) does not work.
if CFile is None :
raise TypeError('initializing CompTable with CFile=None; possible bad/missing CDBS')
raise TypeError('initializing CompTable with CFile=None; possible bad/missing PYSYN_CDBS')

cp = pyfits.open(CFile)

Expand Down Expand Up @@ -82,7 +82,7 @@ def __init__(self, GFile=None):
# None is common for various errors.
# the default value of None is not useful; pyfits.open(None) does not work.
if GFile is None :
raise TypeError('initializing GraphTable with GFile=None; possible bad/missing CDBS')
raise TypeError('initializing GraphTable with GFile=None; possible bad/missing PYSYN_CDBS')

gp = pyfits.open(GFile)

Expand Down

0 comments on commit 51b88d3

Please sign in to comment.