spacetelescope / pysynphot

Synthetic Photometry.
http://pysynphot.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
23 stars 20 forks source link

Specifying an aperture changes effective wavelength of observation #64

Open jryon opened 6 years ago

jryon commented 6 years ago

If I create two Observation objects, one with an aperture size specified in the bandpass, and one without an aperture size specified, the effective wavelength of the two observations is different. I would expect that the effective wavelength of an observation would not depend on the aperture size used, only on the source spectrum and the system throughput.

Example:

In [1]: import pysynphot as S

In [2]: S.__version__
Out[2]: '0.9.8.8'

In [3]: bp = S.ObsBandpass('acs,wfc1,f850lp')

In [4]: source = S.Vega

In [5]: obs_no_aper = S.Observation(source, bp)

In [6]: obs_no_aper.efflam()
Out[6]: 9008.7060072214936

In [7]: bp_aper = S.ObsBandpass('acs,wfc1,f850lp,aper#0.4')

In [8]: obs_aper = S.Observation(source, bp_aper)

In [9]: obs_aper.efflam()
Out[9]: 8967.1107575100523

Note also that specifying the largest recommended aperture size for this detector, 4.0 arcsec, gives the same effective wavelength as omitting the aperture size:

In [51]: bp_aper = S.ObsBandpass('acs,wfc1,f850lp,aper#4.0')

In [52]: obs_aper = S.Observation(source, bp_aper)

In [53]: obs_aper.efflam()
Out[53]: 9008.7060072214936

Edit: Syntax highlighting

pllim commented 6 years ago

Please also provide your bp.showfiles() and bp_aper_showfiles() outputs. Thanks!

jryon commented 6 years ago
In [63]: bp = S.ObsBandpass('acs,wfc1,f850lp')

In [64]: bp.showfiles()
/grp/hst/cdbs/comp/ota/hst_ota_007_syn.fits
/grp/hst/cdbs/comp/acs/acs_wfc_im123_004_syn.fits
/grp/hst/cdbs/comp/acs/acs_f850lp_wfc_007_syn.fits
/grp/hst/cdbs/comp/acs/acs_wfc_ebe_win12f_005_syn.fits
/grp/hst/cdbs/comp/acs/acs_wfc_ccd1_022_syn.fits

In [65]: bp_aper = S.ObsBandpass('acs,wfc1,f850lp,aper#0.4')

In [66]: bp_aper.showfiles()
/grp/hst/cdbs/comp/ota/hst_ota_007_syn.fits
/grp/hst/cdbs/comp/acs/acs_wfc_aper_002_syn.fits[aper#]
/grp/hst/cdbs/comp/acs/acs_wfc_im123_004_syn.fits
/grp/hst/cdbs/comp/acs/acs_f850lp_wfc_007_syn.fits
/grp/hst/cdbs/comp/acs/acs_wfc_ebe_win12f_005_syn.fits
/grp/hst/cdbs/comp/acs/acs_wfc_ccd1_022_syn.fits
philhodge commented 6 years ago

If you look at the wavelengths and throughputs in acs_wfc_aper_002_syn.fits for aperture APER#0.4, you'll see that the throughput of the aperture is changing in the neighborhood of 9000 angstroms. Here are a few numbers:

wavelength throughput

  1. 0.92
  2. 0.88
    1. 0.71
pllim commented 6 years ago

@philhodge is right, APER throughput is not uniform across wavelength (see plot below). It is effectively shifting effective wavelength to bluer side. ETC claims that they don't use APER but rather just apply a scalar aperture correction (if I understood @vglaidler correctly), so that is why ETC result shows no change in effective wavelength.

untitled

If you want PySynphot's aper# to produce the same result as ETC, you have to make the APER# throughput uniform. But is that what you really want to do here? Why are they not uniform in the first place?

jryon commented 6 years ago

Maybe the issue here is the order of operations. Shouldn't the aperture correction be applied AFTER the source and bandpass have been convolved? It sounds like maybe pysynphot is including the aperture correction table in the total system throughput.

My understanding of what the ETC does is to calculate the effective wavelength of the observation (not including aperture correction), then use that effective wavelength to select a value from their encircled energy table (which is the same as the table in 'acs_wfc_aper_002_syn.fits'), and apply the result to the count rates.

pllim commented 6 years ago

AFAIK the current behavior was inherited from IRAF SYNPHOT. @vglaidler could confirm since she did a very comprehensive commissioning campaign comparing the two.

What you are suggesting is a completely different way of treating aperture correction within PySynphot. I am not sure whether I want to support this here or not since this package is no longer being actively developed. :grimacing:

Aperture correction is documented at http://pysynphot.readthedocs.io/en/latest/appendixb.html#pysynphot-parameterized-aper but it is unclear from the text on how it is applied technically.