Debian Codegraph @

doc/tsrs/bandpar_comparison/source/main.rst

raw
1 Comparison of Synphot and Pysynphot Bandpar Functionality
2 =========================================================
3
4 .. abstract::
5 :author: Matt Davis (SSB)
6 :date: 15 November 2011
7
8 Pysynphot attempts to replicate much of the functionality of the Synphot
9 `bandpar utility
10 <https://svn.stsci.edu/trac/ssb/stsci_python/browser/stsdas/trunk/stsdas/pkg/hst_calib/synphot/doc/bandpar.hlp>`_
11 but sometimes uses different formulae and algorithms.
12 This TSR collects the calculations used in Pysynphot, Synphot, the
13 formulae described in the `Synphot Manual`_ in Section 5.1 on page 42,
14 and the formulae in the Synphot help files.
15
16 .. _Synphot Manual: http://stsdas.stsci.edu/stsci_python_epydoc/SynphotManual.pdf
17
18 RMS Width - BANDW - PHOTBW
19 ==========================
20
21 Summary
22 -------
23
24 RMS width is added to image headers in the PHOTBW keyword.
25
26 **Pysynphot**
27
28 * *Function name*: `SpectralElement.rmswidth
29 <https://trac.assembla.com/astrolib/browser/trunk/pysynphot/lib/pysynphot/spectrum.py#L1083>`_
30 * *Source code*: `spectrum.py
31 <https://trac.assembla.com/astrolib/browser/trunk/pysynphot/lib/pysynphot/spectrum.py>`_
32 * *References*: :ref:`3: page 836 <ref3>`
33
34 **Synphot**
35
36 * *Bandpar name*: `BANDW
37 <https://svn.stsci.edu/trac/ssb/stsci_python/browser/stsdas/trunk/stsdas/pkg/hst_calib/synphot/doc/bandpar.hlp>`_
38 * *Function name*: `rmslam`_ called by `comppar`_ called by `bandpar`_.
39 * *Source code*: `rmslam.x
40 <https://svn.stsci.edu/trac/ssb/stsci_python/browser/stsdas/trunk/stsdas/lib/synphot/rmslam.x>`_
41 * *References*: :ref:`1: sections 5.1,7.1 <ref1>`, :ref:`2 <ref2>`,
42 :ref:`4: page 46 <ref4>`
43
44 .. _comppar: https://svn.stsci.edu/trac/ssb/stsci_python/browser/stsdas/trunk/stsdas/pkg/hst_calib/synphot/bandpar/comppar.x
45 .. _bandpar: https://svn.stsci.edu/trac/ssb/stsci_python/browser/stsdas/trunk/stsdas/pkg/hst_calib/synphot/bandpar/bandpar.x
46
47
48 Synphot Equations
49 -----------------
50
51 The `Synphot Manual`_ section 5.1 gives the equation for RMS bandwidth as
52
53 .. math::
54
55 \lambda_{rms}^2 = \bar{\lambda}^2 \frac{\int P_{\lambda} \ln(\lambda/\bar{\lambda})^2
56 \,d\lambda/\lambda}{\int P_{\lambda} \,d\lambda/\lambda}
57
58 where
59
60 .. math::
61
62 \bar{\lambda} = \exp \left[ \frac{\int P_{\lambda} \ln(\lambda) \,d\lambda/\lambda}
63 {\int P_{\lambda} \,d\lambda/\lambda} \right].
64
65 The Synphot function `rmslam`_ does appear to implement this procedure for
66 calculating the RMS width of the bandpass. The source code references the
67 `WF/PC-1 Instrument Handbook <http://www.stsci.edu/hst/wfpc/documents/HST_WFPC_Instrument_Handbook.pdf>`_
68 as the source of the equation for RMS width and references
69 Schneider, Gunn and Hoessel (1983 ApJ 264,337) as the source for the equation
70 for mean wavelength.
71
72 The
73 `bandpar help file
74 <https://svn.stsci.edu/trac/ssb/stsci_python/browser/stsdas/trunk/stsdas/pkg/hst_calib/synphot/doc/bandpar.hlp>`_
75 gives the same equations as above for the RMS width but the `Synphot Manual`_
76 in section 7.1 gives different equations when describing bandpar. The equations
77 in section 7.1 are the same as used by Pysynphot, shown below.
78
79 .. _rmslam: https://svn.stsci.edu/trac/ssb/stsci_python/browser/stsdas/trunk/stsdas/lib/synphot/rmslam.x
80
81 Pysynphot Equations
82 -------------------
83
84 The Pysynphot `rmswidth`_ source code references Koornneef et al 1987, page 836
85 as the source for its RMS width calculation, which is
86
87 .. math::
88
89 \lambda_{rms}^2 = \frac{\int P_{\lambda} (\lambda - \bar{\lambda})^2 \,d\lambda}
90 {\int P_{\lambda} \,d\lambda}
91
92 where
93
94 .. math::
95
96 \bar{\lambda} = \frac{\int \lambda P_{\lambda} \,d\lambda}
97 {\int P_{\lambda} \,d\lambda}.
98
99 .. _rmswidth: https://trac.assembla.com/astrolib/browser/trunk/pysynphot/lib/pysynphot/spectrum.py#L1106
100
101 Full Width Half-Max - FWHM
102 ==========================
103
104 Summary
105 -------
106
107 **Pysynphot**
108
109 * *Function name*: `SpectralElement.fwhm
110 <https://trac.assembla.com/astrolib/browser/trunk/pysynphot/lib/pysynphot/spectrum.py#L1462>`_
111 * *Source code*: `spectrum.py
112 <https://trac.assembla.com/astrolib/browser/trunk/pysynphot/lib/pysynphot/spectrum.py>`_
113 * *References*:
114
115 **Synphot**
116
117 * *Bandpar name*: `FWHM
118 <https://svn.stsci.edu/trac/ssb/stsci_python/browser/stsdas/trunk/stsdas/pkg/hst_calib/synphot/doc/bandpar.hlp>`_
119 * *Function name*: `fwhmlam
120 <https://svn.stsci.edu/trac/ssb/stsci_python/browser/stsdas/trunk/stsdas/lib/synphot/fwhmlam.x>`_
121 called by `comppar`_ called by `bandpar`_.
122 * *Source code*: `fwhmlam.x
123 <https://svn.stsci.edu/trac/ssb/stsci_python/browser/stsdas/trunk/stsdas/lib/synphot/fwhmlam.x>`_
124 * *References*: :ref:`1: section 5.1 <ref1>`
125
126 Synphot Equations
127 -----------------
128
129 The FWHM is simply defined relative to the RMS width above:
130
131 .. math::
132
133 fwhm = \sqrt{8\ln 2}\cdot rmswidth
134
135 Pysynphot Equations
136 -------------------
137
138 Pysynphot does not currently implement a FWHM calculation.
139 See https://trac.assembla.com/astrolib/ticket/139.
140
141 Equivalent Width - EQUVW
142 ========================
143
144 Summary
145 -------
146
147 **Pysynphot**
148
149 * *Function name*: `SpectralElement.equvwidth
150 <https://trac.assembla.com/astrolib/browser/trunk/pysynphot/lib/pysynphot/spectrum.py#L1126>`_
151 * *Source code*: `spectrum.py
152 <https://trac.assembla.com/astrolib/browser/trunk/pysynphot/lib/pysynphot/spectrum.py>`_
153 * *References*:
154
155 **Synphot**
156
157 * *Bandpar name*: `EQUVW
158 <https://svn.stsci.edu/trac/ssb/stsci_python/browser/stsdas/trunk/stsdas/pkg/hst_calib/synphot/doc/bandpar.hlp>`_
159 * *Function name*: `widthlam
160 <https://svn.stsci.edu/trac/ssb/stsci_python/browser/stsdas/trunk/stsdas/pkg/hst_calib/synphot/newlib/widthlam.x>`_
161 called by `comppar`_ called by `bandpar`_.
162 * *Source code*: `widthlam.x
163 <https://svn.stsci.edu/trac/ssb/stsci_python/browser/stsdas/trunk/stsdas/pkg/hst_calib/synphot/newlib/widthlam.x>`_
164 * *References*: :ref:`1: section 5.1 <ref1>`
165
166 Synphot Equations
167 -----------------
168
169 The equivalent width is simply the integral of the throughput:
170
171 .. math::
172
173 equvw = \int P_{\lambda}\,d\lambda
174
175 Pysynphot Equations
176 -------------------
177
178 Pysynphot calculates the equivalent width in the same manner as Synphot.
179
180 Rectangular Width - RECTW
181 =========================
182
183 Summary
184 -------
185
186 **Pysynphot**
187
188 * *Function name*: `SpectralElement.rectwidth
189 <https://trac.assembla.com/astrolib/browser/trunk/pysynphot/lib/pysynphot/spectrum.py#L1109>`_
190 * *Source code*: `spectrum.py
191 <https://trac.assembla.com/astrolib/browser/trunk/pysynphot/lib/pysynphot/spectrum.py>`_
192 * *References*:
193
194 **Synphot**
195
196 * *Bandpar name*: `RECTW
197 <https://svn.stsci.edu/trac/ssb/stsci_python/browser/stsdas/trunk/stsdas/pkg/hst_calib/synphot/doc/bandpar.hlp>`_
198 * *Function name*: `widthlam
199 <https://svn.stsci.edu/trac/ssb/stsci_python/browser/stsdas/trunk/stsdas/pkg/hst_calib/synphot/newlib/widthlam.x>`_
200 called by `comppar`_ called by `bandpar`_.
201 * *Source code*: `widthlam.x
202 <https://svn.stsci.edu/trac/ssb/stsci_python/browser/stsdas/trunk/stsdas/pkg/hst_calib/synphot/newlib/widthlam.x>`_
203 * *References*: :ref:`1: section 5.1 <ref1>`
204
205 Synphot Equations
206 -----------------
207
208 Synphot calculates the rectangular width at the same time it calculates the
209 equivalent width by simply dividing the equivalent width by the maximum
210 throughput of the passband:
211
212 .. math::
213
214 rectw = \frac{equvw}{\max(P_{\lambda})}
215
216 This is equivalent to the formula given in section 5.1 of the `Synphot Manual`_:
217
218 .. math::
219
220 rectw = \frac{\int P_{\lambda}\,d\lambda}{\max(P_{\lambda})}
221
222 Pysynphot Equations
223 -------------------
224
225 Pysynphot calculates the rectangular width in functionally the same way as
226 Synphot but does not defer any calculation to the equivalent width method.
227 Instead, Pysynphot directly calculates the integral of the throughput and
228 divides by the maximum within the `rectwidth method
229 <https://trac.assembla.com/astrolib/browser/trunk/pysynphot/lib/pysynphot/spectrum.py#L1109>`_.
230
231 Unit Response - URESP - PHOTFLAM
232 ================================
233
234 Summary
235 -------
236
237 Unit response is added to image headers in the PHOTFLAM keyword.
238
239 **Pysynphot**
240
241 * *Function name*: `SpectralElement.unit_response
242 <https://trac.assembla.com/astrolib/browser/trunk/pysynphot/lib/pysynphot/spectrum.py#L1429>`_
243 * *Source code*: `spectrum.py
244 <https://trac.assembla.com/astrolib/browser/trunk/pysynphot/lib/pysynphot/spectrum.py>`_
245 * *References*:
246
247 **Synphot**
248
249 * *Bandpar name*: `URESP
250 <https://svn.stsci.edu/trac/ssb/stsci_python/browser/stsdas/trunk/stsdas/pkg/hst_calib/synphot/doc/bandpar.hlp>`_
251 * *Function name*: `funit
252 <https://svn.stsci.edu/trac/ssb/stsci_python/browser/stsdas/trunk/stsdas/lib/synphot/funit.x>`_
253 called by `comppar`_ called by `bandpar`_.
254 * *Source code*: `funit.x
255 <https://svn.stsci.edu/trac/ssb/stsci_python/browser/stsdas/trunk/stsdas/lib/synphot/funit.x>`_
256 * *References*: :ref:`1: sections 5.1, 7.1 <ref1>`
257
258 Synphot Equations
259 -----------------
260
261 .. math::
262
263 U_{\lambda} = \frac{hc/A}{\int \lambda P_{\lambda}\,d\lambda}
264
265 where :math:`h` and :math:`c` are the usual fundamental constants and
266 :math:`A` is the area of the telescope primary mirror.
267
268 Pysynphot Equations
269 -------------------
270
271 Pysynphot calculates the unit response in the same way as Synphot.
272
273 Pivot Wavelength - PIVWV - PHOTPLAM
274 ===================================
275
276 Summary
277 -------
278
279 Pivot wavelength is added to image headers in the PHOTPLAM keyword.
280
281 **Pysynphot**
282
283 * *Function name*: `SpectralElement.pivot
284 <https://trac.assembla.com/astrolib/browser/trunk/pysynphot/lib/pysynphot/spectrum.py#L1060>`_
285 * *Source code*: `spectrum.py
286 <https://trac.assembla.com/astrolib/browser/trunk/pysynphot/lib/pysynphot/spectrum.py>`_
287 * *References*:
288
289 **Synphot**
290
291 * *Bandpar name*: `PIVWV
292 <https://svn.stsci.edu/trac/ssb/stsci_python/browser/stsdas/trunk/stsdas/pkg/hst_calib/synphot/doc/bandpar.hlp>`_
293 * *Function name*: `pivlam
294 <https://svn.stsci.edu/trac/ssb/stsci_python/browser/stsdas/trunk/stsdas/lib/synphot/pivlam.x>`_
295 called by `comppar`_ called by `bandpar`_.
296 * *Source code*: `pivlam.x
297 <https://svn.stsci.edu/trac/ssb/stsci_python/browser/stsdas/trunk/stsdas/lib/synphot/pivlam.x>`_
298 * *References*: :ref:`1: sections 5.1, 7.1 <ref1>`
299
300 Synphot Equations
301 -----------------
302
303 The pivot wavelength equation is recorded in sections 5.1 and 7.1 of the
304 `Synphot Manual`_ and matches in both places.
305
306 .. math::
307
308 \lambda_p = \sqrt{\frac{\int \lambda P_{\lambda}\,d\lambda}
309 {\int P_{\lambda}\,d\lambda/\lambda}}
310
311 Pysynphot Equations
312 -------------------
313
314 Pysynphot calculates the pivot wavelength in the same way as Synphot.
315
316 Wavelength at Peak Throughput - WPEAK
317 =====================================
318
319 Summary
320 -------
321
322 **Pysynphot**
323
324 * *Function name*:
325 * *Source code*:
326 * *References*:
327
328 **Synphot**
329
330 * *Bandpar name*: `WPEAK
331 <https://svn.stsci.edu/trac/ssb/stsci_python/browser/stsdas/trunk/stsdas/pkg/hst_calib/synphot/doc/bandpar.hlp>`_
332 * *Function name*: `peaklam2
333 <https://svn.stsci.edu/trac/ssb/stsci_python/browser/stsdas/trunk/stsdas/pkg/hst_calib/synphot/newlib/peaklam.x>`_
334 called by `comppar`_ called by `bandpar`_.
335 * *Source code*: `peaklam.x
336 <https://svn.stsci.edu/trac/ssb/stsci_python/browser/stsdas/trunk/stsdas/pkg/hst_calib/synphot/newlib/peaklam.x>`_
337 * *References*: :ref:`1: sections 5.1 <ref1>`
338
339 Synphot Equations
340 -----------------
341
342 Like the name implies, this is simply the wavelength at the point of peak
343 throughput. Synphot finds it by looping over the throughput.
344
345 Pysynphot Equations
346 -------------------
347
348 Pysynphot does not currently implement a peak wavelength calculation.
349 See https://trac.assembla.com/astrolib/ticket/139.
350
351 Peak Throughput - TPEAK
352 =======================
353
354 Summary
355 -------
356
357 **Pysynphot**
358
359 * *Function name*:
360 * *Source code*:
361 * *References*:
362
363 **Synphot**
364
365 * *Bandpar name*: `TPEAK
366 <https://svn.stsci.edu/trac/ssb/stsci_python/browser/stsdas/trunk/stsdas/pkg/hst_calib/synphot/doc/bandpar.hlp>`_
367 * *Function name*: `peaklam2
368 <https://svn.stsci.edu/trac/ssb/stsci_python/browser/stsdas/trunk/stsdas/pkg/hst_calib/synphot/newlib/peaklam.x>`_
369 called by `comppar`_ called by `bandpar`_.
370 * *Source code*: `peaklam.x
371 <https://svn.stsci.edu/trac/ssb/stsci_python/browser/stsdas/trunk/stsdas/pkg/hst_calib/synphot/newlib/peaklam.x>`_
372 * *References*: :ref:`1: sections 5.1 <ref1>`
373
374 Synphot Equations
375 -----------------
376
377 This is simply the maximum throughput of the passband. Synphot finds it by
378 looping over the throughput.
379
380 Pysynphot Equations
381 -------------------
382
383 Pysynphot does not currently implement a peak throughput calculation.
384 See https://trac.assembla.com/astrolib/ticket/139.
385
386 Average Wavelength - AVGWV
387 ==========================
388
389 Summary
390 -------
391
392 **Pysynphot**
393
394 * *Function name*: `SpectralElement.avgwave
395 <https://trac.assembla.com/astrolib/browser/trunk/pysynphot/lib/pysynphot/spectrum.py#L1039>`_
396 * *Source code*: `spectrum.py
397 <https://trac.assembla.com/astrolib/browser/trunk/pysynphot/lib/pysynphot/spectrum.py>`_
398 * *References*: :ref:`3: page 836 <ref3>`
399
400 **Synphot**
401
402 * *Bandpar name*: `AVGWV
403 <https://svn.stsci.edu/trac/ssb/stsci_python/browser/stsdas/trunk/stsdas/pkg/hst_calib/synphot/doc/bandpar.hlp>`_
404 * *Function name*: `avglam
405 <https://svn.stsci.edu/trac/ssb/stsci_python/browser/stsdas/trunk/stsdas/lib/synphot/avglam.x>`_
406 called by `comppar`_ called by `bandpar`_.
407 * *Source code*: `avglam.x
408 <https://svn.stsci.edu/trac/ssb/stsci_python/browser/stsdas/trunk/stsdas/lib/synphot/avglam.x>`_
409 * *References*: :ref:`1: sections 5.1, 7.1 <ref1>`
410
411 Synphot Equations
412 -----------------
413
414 .. math::
415
416 \lambda_0 = \frac{\int \lambda P_{\lambda}\,d\lambda}
417 {\int P_{\lambda}\,d\lambda}
418
419 Pysynphot Equations
420 -------------------
421
422 Pysynphot calculates the average wavelength in the same way as Synphot.
423
424 Dimensionless Efficiency - QTLAM
425 ================================
426
427 Summary
428 -------
429
430 **Pysynphot**
431
432 * *Function name*: `SpectralElement.efficiency
433 <https://trac.assembla.com/astrolib/browser/trunk/pysynphot/lib/pysynphot/spectrum.py#L1131>`_
434 * *Source code*: `spectrum.py
435 <https://trac.assembla.com/astrolib/browser/trunk/pysynphot/lib/pysynphot/spectrum.py>`_
436 * *References*:
437
438 **Synphot**
439
440 * *Bandpar name*: `QTLAM
441 <https://svn.stsci.edu/trac/ssb/stsci_python/browser/stsdas/trunk/stsdas/pkg/hst_calib/synphot/doc/bandpar.hlp>`_
442 * *Function name*: `qtlam
443 <https://svn.stsci.edu/trac/ssb/stsci_python/browser/stsdas/trunk/stsdas/pkg/hst_calib/synphot/newlib/qtlam.x>`_
444 called by `comppar`_ called by `bandpar`_.
445 * *Source code*: `qtlam.x
446 <https://svn.stsci.edu/trac/ssb/stsci_python/browser/stsdas/trunk/stsdas/pkg/hst_calib/synphot/newlib/qtlam.x>`_
447 * *References*: :ref:`1: section 5.1 <ref1>`, :ref:`5: page 152 <ref5>`
448
449 Synphot Equations
450 -----------------
451
452 .. math::
453
454 qtlam = \int P_{\lambda}\,d\lambda/\lambda
455
456 Pysynphot Equations
457 -------------------
458
459 Pysynphot calculates the efficiency in the same way as Synphot.
460
461 Throughput at Reference Wavelength - TLAMBDA
462 ============================================
463
464 Summary
465 -------
466
467 **Pysynphot**
468
469 * *Function name*:
470 * *Source code*:
471 * *References*:
472
473 **Synphot**
474
475 * *Bandpar name*: `TLAMBDA
476 <https://svn.stsci.edu/trac/ssb/stsci_python/browser/stsdas/trunk/stsdas/pkg/hst_calib/synphot/doc/bandpar.hlp>`_
477 * *Function name*: `monolam
478 <https://svn.stsci.edu/trac/ssb/stsci_python/browser/stsdas/trunk/stsdas/pkg/hst_calib/synphot/newlib/monolam.x>`_
479 called by `comppar`_ called by `bandpar`_.
480 * *Source code*: `monolam.x
481 <https://svn.stsci.edu/trac/ssb/stsci_python/browser/stsdas/trunk/stsdas/pkg/hst_calib/synphot/newlib/monolam.x>`_
482 * *References*: :ref:`1: sections 5.1 <ref1>`
483
484 Synphot Equations
485 -----------------
486
487 This is simply the bandpass throughput at a reference wavelength. By default
488 the reference wavelength is the average wavelength as defined above.
489
490 Pysynphot Equations
491 -------------------
492
493 The throughput of a Pysynphot SpectralElement object can be sampled at any
494 wavelength using the `sample() method
495 <https://trac.assembla.com/astrolib/browser/trunk/pysynphot/lib/pysynphot/spectrum.py#L1251>`_.
496 There is no function specifically for retrieving the throughput at the
497 average wavelength.
498
499 Equivalent Monochromatic Flux - EMFLX
500 =====================================
501
502 Summary
503 -------
504
505 **Pysynphot**
506
507 * *Function name*:
508 * *Source code*:
509 * *References*:
510
511 **Synphot**
512
513 * *Bandpar name*: `EMFLX
514 <https://svn.stsci.edu/trac/ssb/stsci_python/browser/stsdas/trunk/stsdas/pkg/hst_calib/synphot/doc/bandpar.hlp>`_
515 * *Function name*: `monolam
516 <https://svn.stsci.edu/trac/ssb/stsci_python/browser/stsdas/trunk/stsdas/pkg/hst_calib/synphot/newlib/monolam.x>`_
517 called by `comppar`_ called by `bandpar`_.
518 * *Source code*: `monolam.x
519 <https://svn.stsci.edu/trac/ssb/stsci_python/browser/stsdas/trunk/stsdas/pkg/hst_calib/synphot/newlib/monolam.x>`_
520 * *References*: :ref:`1: sections 5.1 <ref1>`
521
522 Synphot Equations
523 -----------------
524
525 The equivalent monochromatic flux is a combination of unit response,
526 rectangular width, peak throughput and throughput at the average wavelength:
527
528 .. math::
529
530 emflx = uresp \cdot rectw \cdot \frac{tpeak}{tlambda}
531
532 Pysynphot Equations
533 -------------------
534
535 Pysynphot does not currently implement an equivalent monochromatic flux
536 calculation. See https://trac.assembla.com/astrolib/ticket/139.
537
538 Reference Wavelength - REFWAVE
539 ==============================
540
541 See the section on average wavelength above.
542