Debian Codegraph @

doc/source/appendixc.rst

raw
1 .. _pysynphot-appendixc:
2
3 ***********************************
4 Appendix C: TMG, TMC, and TMT Files
5 ***********************************
6
7 **pysynphot** computes the combined throughput for an
8 :ref:`observing mode <pysynphot-obsmode-bandpass>` (``obsmode``) with the
9 following steps:
10
11 #. The comma-separated ``obsmode`` is broken into individual keywords,
12 each becoming a component of the ``obsmode``.
13 #. The individual components or keywords are used to search the
14 :ref:`graph table <pysynphot-graph>`, which has 6 columns, starting at the
15 row with the lowest ``INNODE`` value. All rows with this ``INNODE`` are
16 examined. The row whose keyword matches one of the keywords in the
17 ``obsmode`` is selected. If no such row is found, the row with the keyword
18 "default" is selected. If there is no such row and there is only one
19 entry with the current ``INNODE``, then this row is selected. Otherwise,
20 an exception is raised.
21 #. Once the row is selected, the component name that is not "clear" is saved
22 for its throughput lookup in a later step. "Clear" components are discarded
23 because their throughput will not modify the combined throughput.
24 #. The ``OUTNODE`` of the selected row becomes the new ``INNODE``, and the
25 process of searching the graph continues until the ``OUTNODE`` is not
26 found in the graph table. For example, see :ref:`Figure 1 <fig-tmg>`.
27 #. Once all of the component names are found in the instrument graph
28 table, the :ref:`component lookup table <pysynphot-master-comp>`
29 (i.e., the TMC table), which has 4 columns, is searched for the
30 actual names of the throughput tables, matching by the ``COMPNAME`` column.
31 For example, see :ref:`Figure 2 <fig-tmc>`.
32 #. Once the throughput values are read from the component throughput tables,
33 they are resampled onto the specified wavelength set (if necessary) and
34 multiplied together to form the combined throughput.
35
36 The :meth:`~pysynphot.obsbandpass.ObsModeBandpass.thermback` method actually
37 traverses the graph table *twice*; Once in the usual fashion, using the
38 ``COMPNAME`` column; And once to obtain the optical train necessary for thermal
39 calculations for IR detectors, using the ``THCOMPNAME`` column. These trains
40 differ because of the existence of opaque but emissive components in the optical
41 path, such as the spider that supports the HST secondary mirror.
42
43 The graph table is used to obtain the train of thermally emissive components in
44 the same way it is used for optical components, except that:
45
46 * ``obsmode`` keywords are compared to the thermal component name
47 (``THCOMPNAME``) instead of the usual ``COMPNAME``.
48 * Once all of the component names are found in the graph table, the thermal
49 component lookup table (i.e., the TMT table) is searched for the actual
50 filenames of the emissivity tables. This file has the same format as the
51 TMC file.
52
53 Further details and examples can be found in
54 :ref:`Diaz (2012) <synphot-ref-diaz2012>`.
55
56 .. _fig-tmg:
57
58 .. figure:: _static/tmg.png
59 :width: 600px
60 :alt: TMG file
61
62 This figure shows the path followed in the graph table (TMG) to gather the
63 components that make the "acs,wfc2,f435w" observing mode. In this example,
64 the keywords are mapped to the components "hst_ota", "acs_wfc_im123",
65 "acs_f435w_wfc", "acs_wfc_ebe_win12f", and "acs_wfc_ccd1".
66
67 .. _fig-tmc:
68
69 .. figure:: _static/tmc.png
70 :width: 600px
71 :alt: TMG file
72
73 This figure shows the component table (TMC) with the filenames of the
74 components mentioned in :ref:`Figure 1 <fig-tmg>`.
75
76
77 .. _pysynphot-graph:
78
79 Graph Table (TMG)
80 =================
81
82 The instrument graph table has 6 columns, as follow:
83
84 ============ ====================== =======================
85 Column Name Description Data Format
86 ============ ====================== =======================
87 COMPNAME Component name String of 20 characters
88 KEYWORD ``obsmode`` keyword String of 12 characters
89 INNODE Input node Integer
90 OUTNODE Output node Integer
91 THCOMPNAME Thermal component name String of 20 characters
92 COMMENT [1]_ Comment (not used) String of 68 characters
93 ============ ====================== =======================
94
95 .. [1] The comment column is not used by **pysynphot**.
96 It exists solely for documentation.
97
98 The ``COMPNAME`` column contains the name of the component. Each component
99 must have a unique name, as it is used as primary key for
100 :ref:`pysynphot-master-comp` lookup. The ``THCOMPNAME`` column is similar to
101 ``COMPNAME`` but for :ref:`pysynphot_thermal_em`.
102
103 The ``KEYWORD`` column is used to match the component keywords in the
104 ``obsmode`` string (also see :ref:`pysynphot-appendixb`). The same component
105 could be represented by multiple keywords; In that case, it will have multiple
106 row entries, all of which are identical except for the keywords, in the graph
107 table. The keyword values are not case-sensitive. The entry for a
108 :ref:`parameterized keyword <pysynphot-parameterized>` should contain the
109 keyword followed by a "#" at the end; For example, ``MJD#`` and ``aper#`` in
110 :ref:`Figure 3 <fig-3>`.
111
112 The ``INNODE`` and ``OUTNODE`` columns specify the light path through the HST.
113 They are used in the process of searching the graph, as explained
114 :ref:`above <pysynphot-appendixc>`. Node numbers in those columns should
115 increase as one goes down the light path in the instrument.
116
117 .. _fig-3:
118
119 ::
120
121 Column 1 2 3 4 5
122 Label _____COMPNAME_____ __KEYWORD___ __INNODE__ _OUTNODE__ _____THCOMPNAME_____
123 1791 clear default 8224 8225 clear
124 1792 stis_os21 default 8225 8230 clear
125 1793 stis_ng21_mjd MJD# 8230 8233 clear
126 1794 stis_ng21 default 8230 8233 clear
127 . . . .
128 2887 clear default 10100 10101 clear
129 2888 acs_wfc_aper aper# 10100 10101 clear
130 2889 acs_wfc_im123 default 10101 10130 clear
131 . . . .
132 3481 clear g141 12750 12752 clear
133 3482 wfc3_ir_g102_bkg bkg 12701 12800 wfc3_ir_g102_bkg
134 3483 wfc3_ir_g102_src default 12701 12800 wfc3_ir_g102_src
135 3484 wfc3_ir_g102_bkg bkg 12751 12800 wfc3_ir_g102_bkg
136
137 .. raw:: html
138
139 <div style="text-align:center">
140 Figure 3: Example contents of a graph (TMG) table.
141 </div>
142
143
144 .. _pysynphot-master-comp:
145
146 Component Table (TMC, TMT)
147 ==========================
148
149 TMC and TMT files are the master component and thermal component lookup tables,
150 respectively. Both of them have the same 4 columns, as follow:
151
152 ============ =============================== =======================
153 Column Name Description Data Format
154 ============ =============================== =======================
155 TIME [2]_ Insertion time (not used) String of 26 characters
156 COMPNAME Component name String of 18 characters
157 FILENAME Throughput file name and column String of 50 characters
158 COMMENT [1]_ Comment (not used) String of 68 characters
159 ============ =============================== =======================
160
161 .. [2] The insertion time column is used by the **pysynphot**.
162 It contains the time that the component file was delivered.
163 It is included for documentation and to simplify traceability of the
164 data files. The time format is ``yyyymmdd:HHMMSS``.
165
166 The ``COMPNAME`` column is used in TMC and TMT files to link from the
167 :ref:`pysynphot-graph` using the latter's ``COMPNAME`` and ``THCOMPNAME``
168 columns, respectively.
169
170 The ``FILENAME`` column provides the filename of the
171 :ref:`throughput table <pysynphot-throughput>`, which includes abbreviated
172 path names, as defined in ``pysynphot.locations.CONVERTDICT``.
173 The table must be in binary FITS format.
174 The entry for a :ref:`parameterized component <pysynphot-parameterized>`
175 should contain its filename followed by square brackets containing the
176 parameterized keyword; For example,
177 ``cracscomp$acs_cor_aper_002_syn.fits[aper#]`` in :ref:`Figure 4 <fig-4>`.
178 For thermal component, the throughput file should contain
179 :ref:`thermal emissivity <pysynphot_thermal_em>` information
180 (see :ref:`Figure 5 <fig-5>`).
181
182 The filenames are not stored directly in the graph table because the files
183 themselves change more frequently than instrument light paths. Therefore, by
184 doing this, we can avoid modifying the more complicated graph table every time
185 a new version of a component throughput is delivered to CRDS.
186
187 .. _fig-4:
188
189 ::
190
191 Column 1 2 3
192 Label _______TIME_________ ___COMPNAME____ ___________________FILENAME__________________ ____________________________COMMENT_____________________________
193 7 oct 30 2013 15:44:42 acs_blocking3 cracscomp$acs_blocking3_001_syn.fits throughput curve (all zeroes) for blocking3 filter
194 8 oct 30 2013 15:44:42 acs_blocking4 cracscomp$acs_blocking4_001_syn.fits throughput curve (all zeroes) for blocking3 filter
195 9 apr 03 2003 18:14:16 acs_cor_aper cracscomp$acs_cor_aper_002_syn.fits[aper#] acs coronagraph encircled energy table
196 1 aug 14 2009 18:13:04 acs_f115lp cracscomp$acs_f115lp_005_syn.fits updated files. setting throughput zero at end of curves
197 11 aug 14 2009 18:13:04 acs_f115lp_sbc cracscomp$acs_f115lp_sbc_004_syn.fits updated files. setting throughput zero at end of curves
198 . . . . .
199 2313 oct 01 2013 19:55:56 stis_ng22 crstiscomp$stis_ng22_016_syn.fits default date 57113 & end date 57480. turned mjd extrapolation on
200 2314 oct 01 2013 19:55:56 stis_ng22_mjd crstiscomp$stis_ng22_mjd_016_syn.fits[mjd#] default date 57113 & end date 57480. turned mjd extrapolation on
201 2315 oct 01 2013 19:55:56 stis_ng22b crstiscomp$stis_ng22b_010_syn.fits default date 57113 & end date 57480. turned mjd extrapolation on
202 2316 oct 01 2013 19:55:56 stis_ng22b_mjd crstiscomp$stis_ng22b_mjd_010_syn.fits[mjd#] default date 57113 & end date 57480. turned mjd extrapolation on
203 2317 oct 01 2013 19:55:56 stis_ng23 crstiscomp$stis_ng23_011_syn.fits default date 57113 & end date 57480. turned mjd extrapolation on
204 2318 oct 01 2013 19:55:56 stis_ng23_mjd crstiscomp$stis_ng23_mjd_011_syn.fits[mjd#] default date 57113 & end date 57480. turned mjd extrapolation on
205 2319 oct 01 2013 19:55:56 stis_ng24 crstiscomp$stis_ng24_011_syn.fits default date 57113 & end date 57480. turned mjd extrapolation on
206 2320 oct 01 2013 19:55:56 stis_ng24_mjd crstiscomp$stis_ng24_mjd_011_syn.fits[mjd#] default date 57113 & end date 57480. turned mjd extrapolation on
207 2321 oct 01 2013 19:55:56 stis_ng31 crstiscomp$stis_ng31_011_syn.fits default date 57113 & end date 57480. turned mjd extrapolation on
208
209 .. raw:: html
210
211 <div style="text-align:center">
212 Figure 4: Example contents of a TMC table, taken from
213 <i>z4k1425fm_tmc.fits</i>.
214 </div>
215
216 .. _fig-5:
217
218 ::
219
220 Column 1 2 3 4
221 Label __________TIME____________ ___COMPNAME____ __________________FILENAME_________________ __________________COMMENT___________________
222 116 aug 15 2006 8:00:00:000am wfc3_ir_fold crwfc3comp$wfc3_ir_fold_001_th.fits Reflectivity of IR fold mirror
223 117 aug 15 2006 8:00:00:000am wfc3_ir_mir1 crwfc3comp$wfc3_ir_mir1_001_th.fits Reflectivity of IR mirror 1
224 118 aug 15 2006 8:00:00:000am wfc3_ir_mir2 crwfc3comp$wfc3_ir_mir2_001_th.fits Reflectivity of IR mirror 2
225 119 aug 15 2006 8:00:00:000am wfc3_ir_rcp crwfc3comp$wfc3_ir_rcp_001_th.fits Transmission of refractive corrector plate
226 120 aug 15 2006 8:00:00:000am wfc3_ir_wmring crwfc3comp$wfc3_ir_wmring_001_th.fits WFC3 warm ring
227
228 .. raw:: html
229
230 <div style="text-align:center">
231 Figure 5: Example contents of a TMT table, taken from
232 <i>tae17277m_tmt.fits</i>.
233 </div>
234
235
236 .. _pysynphot-throughput:
237
238 Throughput Table
239 ================
240
241 The throughput table contains the component throughput as a function of
242 wavelength (see :ref:`pysynphot-io`). It may also contain an optional column
243 of estimated errors or uncertainties associated with the throughput values;
244 The error column must have the following naming convention:
245
246 +-----------+----------------+--------------------+
247 |Wavelength |Throughput |Error |
248 |Column Name|Column Name |Column Name |
249 +===========+================+====================+
250 |WAVELENGTH |THROUGHPUT |ERROR |
251 | +----------------+--------------------+
252 | |<other> |<other>_ERR |
253 | |(Example: DN1) |(Example: DN1_ERR) |
254 | +----------------+--------------------+
255 | |<other>#<value> |<other>_ERR#<value> |
256 | |(Example: |(Example: |
257 | |APER#0.1) |APER_ERR#0.1) |
258 +-----------+----------------+--------------------+
259
260 Wavelength values must be in monotonically ascending or descending order.
261 Wavelength unit must be specified for the column (see
262 :ref:`pysynphot-wave-units` for acceptable units).
263 Throughput and error columns do not need units, but you may specify them as
264 "transmission", "qe", "dn", or "photon" (or any of their unique abbreviations)
265 for documentation. Values in all columns must be 64-bit floating-point numbers.
266 :ref:`Figure 6 <fig-6>` shows an example of a simple throughput table.
267
268 A component throughput may also be parameterized, meaning that
269 the throughput is a function of some other variable besides
270 wavelength. In this case, the table has multiple throughput columns, each
271 named ``keyword#value``. Examples of such tables are shown in
272 :ref:`Figure 7 <fig-7>`, :ref:`Figure 8 <fig-8>`, and :ref:`Figure 9 <fig-9>`.
273 For more details, see :ref:`pysynphot-parameterized`.
274
275 .. _fig-6:
276
277 ::
278
279 Column 1 2 3
280 Label WAVELENGTH _THROUGHPUT_ ___ERROR____
281 1 1838.9 0. INDEF
282 2 1839.0 1. INDEF
283 3 1929.0 1. INDEF
284 4 1929.1 0. INDEF
285
286 .. raw:: html
287
288 <div style="text-align:center">
289 Figure 6: Example contents of a simple throughput table.
290 </div>
291
292 .. _fig-7:
293
294 ::
295
296 Column 1 2 3 4 5 6
297 Label WAVELENGTH FR647M#5366.0 FR647M#5586.8 FR647M#5807.6 FR647M#6028.4 FR647M#6249.2 ...
298 1 3500.0 0. 0. 0. 0. 0. ...
299 2 3500.2 1.00000E-6 1.00000E-6 1.00000E-6 1.00000E-6 1.00000E-6 ...
300 3 4829.0 1.96935E-4 8.76876E-5 7.62487E-5 7.39577E-5 7.32903E-5 ...
301 4 4834.0 2.09608E-4 9.15258E-5 7.94214E-5 7.70256E-5 7.63329E-5 ...
302
303 .. raw:: html
304
305 <div style="text-align:center">
306 Figure 7: Example contents of a throughput table parameterized for the
307 ACS FR647M ramp filter.
308 </div>
309
310 .. _fig-8:
311
312 ::
313
314 Column 1 2 3 4 5 6
315 Label __WAVELENGTH___ __THROUGHPUT___ _____ERROR_____ __MJD#50586.0__ __MJD#50959.0__ __MJD#51287.0__
316 1 1099. 0. 0. 0. 0. 0.
317 2 1100. 0.9446287 0. 1. 1.011037 1.020443
318 3 1150. 0.9446287 0. 1. 1.011037 1.020443
319
320 .. raw:: html
321
322 <div style="text-align:center">
323 Figure 8: Example contents of a throughput table parameterized for MJD
324 to characterize time-dependent change in STIS sensitivity.
325 </div>
326
327 .. _fig-9:
328
329 ::
330
331 Column 1 2 3 4 5 6
332 Label WAVELENGTH _APER#0.__ _APER#0.1_ _APER#0.2_ _APER#0.3_ _APER#0.4_
333 1 3500. 0.28 0.67 0.84 0.88 0.89 ...
334 2 4000. 0.22 0.68 0.85 0.88 0.9 ...
335 3 5000. 0.21 0.7 0.86 0.9 0.92 ...
336 4 6000. 0.22 0.69 0.85 0.9 0.92 ...
337
338 .. raw:: html
339
340 <div style="text-align:center">
341 Figure 9: Example contents of a throughput table parameterized for
342 encircled energy in ACS/WFC detector.
343 </div>
344
345
346 .. _pysynphot_thermal_em:
347
348 Thermal Emissivity Table
349 ========================
350
351 The thermal emissivity table contains the component emissivity
352 as a function of wavelength. This is only relevant for IR instruments with
353 non-negligible thermal background. It is similar to
354 :ref:`throughput table <pysynphot-throughput>`, except that it has the
355 following columns:
356
357 * WAVELENGTH
358 * EMISSIVITY
359 * ERROR (optional)
360
361 Unlike the throughput table, the ``keyword#`` parameterization syntax is
362 overridden for use with the thermal emissivity tables. Instead, this syntax
363 is used to specify a component temperature, overriding the default temperature
364 present in the ``DEFT`` header keyword (see below).
365
366 In addition, it must also contain the following keywords in its table
367 (extension 1) header:
368
369 * ``BEAMFILL`` specifies the fraction of the optical beam filled by this
370 component. This value is usually 1, but it depends on the precise optical
371 layout of the instrument.
372 * ``DEFT`` specifies the default temperature (in Kelvin) of the component. This
373 is the temperature that will be used in thermal calculations unless
374 it is overridden in the ``obsmode``.
375 * ``THTYPE`` specifies the type of thermal component that is described
376 by this file:
377
378 * "opaque" component is the type that partially obstructs the beam.
379 It emits radiation, but does not pass it.
380 * "thru" component is the type that has both throughput and emissivity.
381 This is the case for most optical elements.
382 * "numeric" component is the type that does not correspond to a physical
383 device in the instrument, but is represented as such for convenience.
384 For instance, the detector quantum efficiency.
385 * "clear" component is the type that does not contribute to either throughput
386 or emissivity. It is commonly used as a placeholder in the graph table
387 to organize the flow.
388
389 * ``THCOMPNAME`` and ``THMODE`` are the associated pair of values used
390 when traversing the :ref:`graph table <pysynphot-graph>`. ``THMODE`` contains
391 the ``obsmode`` keyword which points to the associated ``THCOMPNAME``.
392
393 The example below displays the header keywords mentioned above:
394
395 >>> from astropy.io import fits
396 >>> filename = os.path.join(
397 ... os.environ['PYSYN_CDBS'], 'comp', 'nicmos', 'nic2_f110w_002_th.fits')
398 >>> with fits.open(filename) as pf:
399 ... print(pf[1].header)
400 ....
401 BEAMFILL= 1. / Fraction of beam filled by this component
402 DEFT = 77.1 / Default temperature in kelvins
403 THTYPE = 'THRU ' / Thermal type (opaque/thru/numeric/clear)
404 THCMPNAM= 'nic2_f110w' / Name of thermal component
405 THMODE = 'f110w ' / Keyword in obsmode to specify temperature
406 ....
407
408
409 .. _pysynphot-parameterized:
410
411 Parameterized Keyword
412 =====================
413
414 Parameterized keywords are used to access
415 :ref:`throughput tables <pysynphot-throughput>` for which the throughput is a
416 function of some other variables in addition to wavelength.
417 The syntax for a parameterized keyword is ``keyword#value``, where value is a
418 numeric (integer or float) value for the keyword to take. The hash sign ``#``
419 indicates to **pysynphot** that a parameterized keyword is being used.
420
421 A parameterized throughput table contains several throughput columns,
422 each for a specified value of the parameterized component. When an arbitrary
423 value is given, **pysynphot** will linearly interpolate the throughput values
424 between the two closest keyword values; This is done using the
425 `~pysynphot.spectrum.InterpolatedSpectralElement` class. If the table's
426 primary (extension 0) header contains ``PARAMS=WAVELENGTH``, wavelength shift
427 will be done before the interpolation.
428
429 Extrapolation is only allowed if the table's primary header contains an
430 ``EXTRAP`` keyword *and* it is set to `True`. Otherwise, the default
431 ``THROUGHPUT`` column will be used (if available) or an exception will be
432 raised.
433
434 The parameterized keywords are also defined in both the
435 :ref:`TMG <pysynphot-graph>` and :ref:`TMC <pysynphot-master-comp>` files.
436 For TMG, the ``KEYWORD`` value will be followed by a "#"; For example, in
437 :ref:`Figure 3 <fig-3>`, "MJD#" indicates that the parameterization is
438 time dependent, while "aper#" indicates there is a variation in the encircled
439 energy with aperture size. For TMC, the ``FILENAME`` value will be followed
440 by a "[keyword#]"; For example, in :ref:`Figure 4 <fig-4>`, the
441 "cracscomp$acs_cor_aper_002_syn.fits" file is parameterized by aperture size.
442
443 The :ref:`ACS ramp filter <pysynphot_acs_parameterized_ramp>` is an example
444 of a parameterized component. The throughput of the ramp filter varies as
445 a function of position (wavelength) on the filter. Therefore, its throughput
446 table contains several throughput columns, each evaluated at a different
447 central wavelength. :ref:`Figure 7 <fig-7>` shows part of the throughput
448 table for ACS FR647M ramp filter, where the first throughput column is
449 for 5366 Angstroms, the second for 5586.8 Angstroms, and so forth. In this case,
450 a request for 5400 Angstroms will result in interpolation between the first
451 two columns.
452
453 Another example is the STIS :ref:`time-dependent <pysynphot-parameterized-mjd>`
454 change in sensitivity, as illustrated in :ref:`Figure 8 <fig-8>`. In this case,
455 when "mjd#value" is given as part of an ``obsmode``, the parameterized column(s)
456 will be used and interpolated, as needed. If "mjd#value" is not given, then the
457 default ``THROUGHPUT`` column is used.
458
459 Similarly, parameterization of
460 :ref:`encircled energy <pysynphot-parameterized-aper>` via aperture size is
461 shown in :ref:`Figure 9 <fig-9>` for ACS/WFC detector. In this case, the
462 throughput table is only used when "aper#value" is given in the ``obsmode``,
463 therefore, a default ``THROUGHPUT`` column is unnecessary.
464
465 All available parameterized keywords are listed in :ref:`pysynphot-appendixb`
466 as ``keyword#`` or ``keyword#value``.