| 1 |
.. _pysynphot-refdata: |
| 2 |
|
| 3 |
************** |
| 4 |
Reference Data |
| 5 |
************** |
| 6 |
|
| 7 |
Reference data has its history in IRAF STSDAS SYNPHOT:: |
| 8 |
|
| 9 |
synphot> lpar refdata |
| 10 |
(area = 45238.93416) Telescope area in cm^2 |
| 11 |
(grtbl = "mtab$*_tmg.fits") Instrument graph table |
| 12 |
(cmptbl = "mtab$*_tmc.fits") Instrument component table |
| 13 |
(mode = "a") |
| 14 |
|
| 15 |
In **pysynphot**, reference data is expanded to manage the following: |
| 16 |
|
| 17 |
* Instrument graph table (``graphtable``) |
| 18 |
* Instrument component table (``comptable``) |
| 19 |
* Instrument thermal component table (``thermtable``) |
| 20 |
* :ref:`Telescope collecting area <pysynphot-area>` (``area``) |
| 21 |
* Default :ref:`wavelength set <pysynphot-wavelength-table>` (``waveset``) |
| 22 |
|
| 23 |
The current settings can be displayed with :func:`~pysynphot.refs.showref`. |
| 24 |
To use custom settings or reset any changes back to software default, you can |
| 25 |
use :func:`~pysynphot.refs.setref`. Meanwhile, :func:`~pysynphot.refs.getref` |
| 26 |
also returns the current settings, but as a Python :py:class:`dict` instead of |
| 27 |
printing to screen. For example: |
| 28 |
|
| 29 |
>>> S.showref() |
| 30 |
thermtable: /my/local/dir/trds/mtab/tae17277m_tmt.fits |
| 31 |
waveset: Min: 500, Max: 26000, Num: 10000.0, Delta: None, Log: True |
| 32 |
comptable: /my/local/dir/trds/mtab/yah1742rm_tmc.fits |
| 33 |
graphtable: /my/local/dir/trds/mtab/yah1742qm_tmg.fits |
| 34 |
area: 45238.93416 |
| 35 |
>>> S.setref(graphtable='new_tmg.fits', comptable='new_tmc.fits', area=1) |
| 36 |
>>> S.showref() |
| 37 |
thermtable: /my/local/dir/trds/mtab/tae17277m_tmt.fits |
| 38 |
waveset: Min: 500, Max: 26000, Num: 10000.0, Delta: None, Log: True |
| 39 |
comptable: new_tmc.fits |
| 40 |
graphtable: new_tmg.fits |
| 41 |
area: 1 |
| 42 |
>>> S.setref() # Reset to software default |
| 43 |
>>> S.showref() |
| 44 |
thermtable: /my/local/dir/trds/mtab/tae17277m_tmt.fits |
| 45 |
waveset: Min: 500, Max: 26000, Num: 10000.0, Delta: None, Log: True |
| 46 |
comptable: /my/local/dir/trds/mtab/yah1742rm_tmc.fits |
| 47 |
graphtable: /my/local/dir/trds/mtab/yah1742qm_tmg.fits |
| 48 |
area: 45238.93416 |
| 49 |
>>> S.refs.getref() |
| 50 |
{'area': 45238.93416, |
| 51 |
'comptable': '/my/local/dir/trds/mtab/yah1742rm_tmc.fits', |
| 52 |
'graphtable': '/my/local/dir/trds/mtab/yah1742qm_tmg.fits', |
| 53 |
'thermtable': '/my/local/dir/trds/mtab/tae17277m_tmt.fits', |
| 54 |
'waveset': 'Min: 500, Max: 26000, Num: 10000.0, Delta: None, Log: True'} |
| 55 |
|
| 56 |
Changing the default tables is not recommended unless you know what you are |
| 57 |
doing because **pysynphot** always uses the most up-to-date version in your |
| 58 |
``$PYSYN_CDBS/mtab/`` directory. |
| 59 |
|
| 60 |
The HST bandpass for available |
| 61 |
:ref:`observation modes <pysynphot-obsmode-bandpass>` |
| 62 |
are defined by ``graphtable`` and ``comptable``. In addition, for IR |
| 63 |
instruments, thermal component is defined by ``thermtable``. These files are |
| 64 |
described in detail in :ref:`Appendix C <pysynphot-appendixc>`. It is also |
| 65 |
possible to |
| 66 |
:ref:`provide your own tables and telescope area for other telescopes <pysynphot-other-telescopes>`. |
| 67 |
|
| 68 |
The tables decide which throughput files will be used for a particular |
| 69 |
observation mode. They can be displayed using |
| 70 |
:meth:`~pysynphot.obsbandpass.ObsModeBandpass.showfiles`. A bandpass that does |
| 71 |
not rely on the tables does not have this feature. For example: |
| 72 |
|
| 73 |
>>> bp_hst = S.ObsBandpass('wfc3,ir,f105w') |
| 74 |
>>> bp_hst.name |
| 75 |
'wfc3,ir,f105w' |
| 76 |
>>> bp_hst.showfiles() |
| 77 |
/my/local/dir/trds/comp/wfc3/wfc3_ir_primary_001_syn.fits |
| 78 |
/my/local/dir/trds/comp/wfc3/wfc3_ir_secondary_001_syn.fits |
| 79 |
/my/local/dir/trds/comp/wfc3/wfc3_pom_001_syn.fits |
| 80 |
/my/local/dir/trds/comp/wfc3/wfc3_ir_csm_001_syn.fits |
| 81 |
/my/local/dir/trds/comp/wfc3/wfc3_ir_fold_001_syn.fits |
| 82 |
/my/local/dir/trds/comp/wfc3/wfc3_ir_mir1_001_syn.fits |
| 83 |
/my/local/dir/trds/comp/wfc3/wfc3_ir_mir2_001_syn.fits |
| 84 |
/my/local/dir/trds/comp/wfc3/wfc3_ir_mask_001_syn.fits |
| 85 |
/my/local/dir/trds/comp/wfc3/wfc3_ir_rcp_001_syn.fits |
| 86 |
/my/local/dir/trds/comp/wfc3/wfc3_ir_f105w_004_syn.fits |
| 87 |
/my/local/dir/trds/comp/wfc3/wfc3_ir_win_001_syn.fits |
| 88 |
/my/local/dir/trds/comp/wfc3/wfc3_ir_qe_003_syn.fits |
| 89 |
/my/local/dir/trds/comp/wfc3/wfc3_ir_cor_004_syn.fits |
| 90 |
>>> bp_nonhst = S.ObsBandpass('johnson,v') |
| 91 |
>>> bp_nonhst.name |
| 92 |
'/my/local/dir/trds/comp/nonhst/johnson_v_004_syn.fits' |
| 93 |
>>> bp_nonhst.showfiles() |
| 94 |
AttributeError: 'TabularSpectralElement' object has no attribute 'showfiles' |
| 95 |
|
| 96 |
Every HST observation mode has an optimal binned wavelength set (``binset``) for |
| 97 |
constructing an :ref:`pysynphot-observation`. The ``binset`` is set according to |
| 98 |
a pre-defined wavelength catalog in ``pysynphot.locations.wavecat`` and can be |
| 99 |
accessed via :meth:`~pysynphot.observationmode.BaseObservationMode.bandWave`. |
| 100 |
The default ``waveset`` shown above is used for when such a ``binset`` is not |
| 101 |
available. The example below illustrate both situations: |
| 102 |
|
| 103 |
>>> S.locations.wavecat |
| 104 |
'/my/installation/path/pysynphot/data/wavecat.dat' |
| 105 |
>>> bp_hst.obsmode.bandWave() |
| 106 |
array([ 7000., 7001., 7002., ..., 17998., 17999., 18000.]) |
| 107 |
>>> bp_nonhst.obsmode.bandWave() |
| 108 |
AttributeError: 'TabularSpectralElement' object has no attribute 'obsmode' |
| 109 |
|
| 110 |
|
| 111 |
.. _pysynphot-area: |
| 112 |
|
| 113 |
Area |
| 114 |
==== |
| 115 |
|
| 116 |
Some calculations require the telescope collecting area in |
| 117 |
:math:`\mathrm{cm}^{2}`. For example, flux conversion involving counts or |
| 118 |
``obmag``, and :ref:`bandpass unit response <pysynphot-formula-uresp>` |
| 119 |
calculation. |
| 120 |
|
| 121 |
When an area is required, a spectrum object first looks in its ``primary_area`` |
| 122 |
class attribute. If it is undefined, the object then takes the value from |
| 123 |
``pysynphot.refs.PRIMARY_AREA``, which defaults to the area of the HST primary |
| 124 |
mirror but can be changed with :func:`~pysynphot.refs.setref` (see |
| 125 |
:ref:`pysynphot-refdata`). |
| 126 |
|
| 127 |
For non-HST calculations, you can set the primary area to the value of your |
| 128 |
telescope right after you import **pysynphot** and just leave it at that for the |
| 129 |
rest of the session. For HST calculations, you do not have to do anything |
| 130 |
because it is the default value. When in doubt, check the ``primary_area`` class |
| 131 |
attributes of your spectrum objects. |
| 132 |
|
| 133 |
Composite spectra (`~pysynphot.spectrum.CompositeSourceSpectrum` and |
| 134 |
`~pysynphot.spectrum.CompositeSpectralElement`) inherit their |
| 135 |
``primary_area`` values from either of the input spectra, if defined. If both |
| 136 |
input spectra have defined but different values, then an error is raised. |
| 137 |
|
| 138 |
Bandpass object constructed from observation mode string |
| 139 |
(`~pysynphot.obsbandpass.ObsModeBandpass`) inherits its ``primary_area`` value |
| 140 |
from `~pysynphot.tables.GraphTable`, which in turn read its value from |
| 141 |
``PRIMAREA`` keyword in the table primary header of the given ``*_tmg.fits`` |
| 142 |
file. |
| 143 |
|
| 144 |
`~pysynphot.observation.Observation` inherits its ``primary_area`` from the |
| 145 |
input bandpass. |
| 146 |
|
| 147 |
|
| 148 |
.. _pysynphot-wavelength-table: |
| 149 |
|
| 150 |
Wavelength Table |
| 151 |
================ |
| 152 |
|
| 153 |
The wavelength table is a feature inherited from IRAF STSDAS SYNPHOT, in which |
| 154 |
it is known as ``wavetab``. It is used to specify the name of a file containing |
| 155 |
a list of wavelength values that determine the wavelength grid to be used in the |
| 156 |
calculations and plotting. In **pysynphot**, this is equivalent to ``waveset``, |
| 157 |
``binwave``, or ``binset``, depending on the type of spectral objects that |
| 158 |
you are working with. |
| 159 |
|
| 160 |
The default ``waveset`` can be changed using :func:`~pysynphot.refs.setref`. |
| 161 |
This is used when a spectral object has no instrument-specific (see below) |
| 162 |
or custom wavelength set (e.g., a Gaussian source has its own values that |
| 163 |
tightly sample the peak). The default grid consists of 10000 points covering |
| 164 |
500 to 26000 Angstroms (sufficient for most HST calculations), spaced |
| 165 |
logarithmically with :func:`numpy.logspace` such that: |
| 166 |
|
| 167 |
.. math:: |
| 168 |
|
| 169 |
\log \lambda = \log \lambda_{min} + (\log \lambda_{max} - \log \lambda_{min}) \frac{i}{N} |
| 170 |
|
| 171 |
where |
| 172 |
|
| 173 |
* :math:`N` is the number of data points |
| 174 |
* :math:`i` is the index value, starting from 0 |
| 175 |
* :math:`\lambda_{min}` and :math:`\lambda_{max}` are the wavelength limits |
| 176 |
|
| 177 |
Instrument-specific wavelength sets (``binwave``) are stored in a data file |
| 178 |
defined by ``pysynphot.locations.wavecat``, which is "wavecat.dat" that comes |
| 179 |
with the software by default; The wavelength grid contains optimal coverage |
| 180 |
and resolution that is appropriate for each HST instrument. |
| 181 |
|
| 182 |
Instead of modifying ``wavecat``, which requires the knowledge of how |
| 183 |
`~pysynphot.wavetable` works, it is easier to just provide your own |
| 184 |
``binset``. You can generate wavelength values using :func:`numpy.arange` (also |
| 185 |
accessible as ``pysynphot.Waveset()``). If you wish to save the values in a |
| 186 |
file, follow the instructions in :ref:`pysynphot-io` but ignore the second |
| 187 |
column (for flux or throughput). The wavelength values must be monotonically |
| 188 |
increasing or decreasing. See :ref:`pysynphot_tutorial_6` for a working example. |