
Calculating WFC3 Zeropoints with STSynphot#
Learning Goals#
By the end of this tutorial, you will:
Calculate zeropoints and other photometric properties using
stsynphot.Create, plot, and save ‘total system throughput’ tables.
Table of Contents#
Introduction
1. Imports
2. Download throughput tables and define variables
3. Set up the ‘obsmode’ string
4. Basic usage for a single ‘obsmode’
5. Compute zeropoints and other photometric properties
6. Iterate over multiple ‘obsmodes’
7. Create and plot ‘total system throughput’ tables
8. Conclusions
Additional Resources
About the Notebook
Citations
Introduction#
This notebook shows how to calculate photometric zeropoints using the Python package stsynphot for any WFC3 detector, filter, date, or aperture. This tutorial is especially useful for calculating Vegamag zeropoints, which require an input spectrum. The notebook is also useful for computing time-dependent WFC3/UVIS zeropoints for any observation date, as the values listed in WFC3 ISR 2021-04 are defined for the reference epoch. As of mid-2021, the WFC3/IR zeropoints are not time-dependent.
More documentation on stsynphot is available here. Using stsynphot requires downloading the throughput curves for the HST instruments and optical path. One method of doing this is shown in Section 2. More information on the throughput tables can be found here.
1. Imports#
This notebook assumes you have created the virtual environment in WFC3 notebooks’ installation instructions.
We import:
os for setting environment variables
tarfile for extracting a .tar archive
numpy for handling array functions
matplotlib.pyplot for plotting data
astropy for astronomy related functions
synphot and stsynphot for evaluating synthetic photometry
We will need to set the PYSYN_CDBS environment variable before importing stsynphot. We will also create a custom Vega spectrum, as the stsynphot will supercede the usual synphot functionality regarding the Vega spectrum and would otherwise require a downloaded copy of the spectrum to be provided.
import os
import tarfile
import numpy as np
import matplotlib.pyplot as plt
from astropy.table import Table
from synphot import Observation
2. Download throughput tables and define variables#
This section obtains the WFC3 throughput component tables for use with stsynphot. This step only needs to be done once. If these reference files have already been downloaded, this section can be skipped.
!curl -O https://archive.stsci.edu/hlsps/reference-atlases/hlsp_reference-atlases_hst_multi_everything_multi_v11_sed.tar
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
0 796M 0 98304 0 0 183k 0 1:14:14 --:--:-- 1:14:14 182k
2 796M 2 18.6M 0 0 12.6M 0 0:01:02 0:00:01 0:01:01 12.6M
7 796M 7 58.3M 0 0 23.4M 0 0:00:33 0:00:02 0:00:31 23.4M
11 796M 11 89.3M 0 0 25.5M 0 0:00:31 0:00:03 0:00:28 25.5M
14 796M 14 113M 0 0 25.2M 0 0:00:31 0:00:04 0:00:27 25.2M
17 796M 17 137M 0 0 25.0M 0 0:00:31 0:00:05 0:00:26 27.6M
20 796M 20 159M 0 0 24.5M 0 0:00:32 0:00:06 0:00:26 27.9M
21 796M 21 172M 0 0 22.9M 0 0:00:34 0:00:07 0:00:27 22.7M
23 796M 23 186M 0 0 21.9M 0 0:00:36 0:00:08 0:00:28 19.4M
25 796M 25 200M 0 0 21.2M 0 0:00:37 0:00:09 0:00:28 17.5M
27 796M 27 215M 0 0 20.6M 0 0:00:38 0:00:10 0:00:28 15.7M
29 796M 29 231M 0 0 20.1M 0 0:00:39 0:00:11 0:00:28 14.4M
30 796M 30 246M 0 0 19.7M 0 0:00:40 0:00:12 0:00:28 14.8M
32 796M 32 258M 0 0 19.1M 0 0:00:41 0:00:13 0:00:28 14.4M
33 796M 33 269M 0 0 18.6M 0 0:00:42 0:00:14 0:00:28 13.7M
34 796M 34 277M 0 0 17.9M 0 0:00:44 0:00:15 0:00:29 12.2M
35 796M 35 282M 0 0 17.1M 0 0:00:46 0:00:16 0:00:30 10.1M
36 796M 36 287M 0 0 16.4M 0 0:00:48 0:00:17 0:00:31 8534k
36 796M 36 293M 0 0 15.8M 0 0:00:50 0:00:18 0:00:32 7187k
37 796M 37 299M 0 0 15.3M 0 0:00:51 0:00:19 0:00:32 6043k
38 796M 38 304M 0 0 14.8M 0 0:00:53 0:00:20 0:00:33 5621k
38 796M 38 309M 0 0 14.3M 0 0:00:55 0:00:21 0:00:34 5485k
39 796M 39 314M 0 0 13.9M 0 0:00:56 0:00:22 0:00:34 5418k
40 796M 40 318M 0 0 13.5M 0 0:00:58 0:00:23 0:00:35 5161k
40 796M 40 322M 0 0 13.1M 0 0:01:00 0:00:24 0:00:36 4855k
41 796M 41 327M 0 0 12.8M 0 0:01:01 0:00:25 0:00:36 4623k
41 796M 41 331M 0 0 12.5M 0 0:01:03 0:00:26 0:00:37 4628k
42 796M 42 336M 0 0 12.2M 0 0:01:05 0:00:27 0:00:38 4509k
42 796M 42 341M 0 0 11.9M 0 0:01:06 0:00:28 0:00:38 4573k
43 796M 43 345M 0 0 11.7M 0 0:01:07 0:00:29 0:00:38 4673k
43 796M 43 350M 0 0 11.4M 0 0:01:09 0:00:30 0:00:39 4696k
44 796M 44 354M 0 0 11.2M 0 0:01:10 0:00:31 0:00:39 4574k
44 796M 44 358M 0 0 11.0M 0 0:01:12 0:00:32 0:00:40 4475k
45 796M 45 361M 0 0 10.8M 0 0:01:13 0:00:33 0:00:40 4291k
45 796M 45 365M 0 0 10.6M 0 0:01:15 0:00:34 0:00:41 4059k
46 796M 46 369M 0 0 10.4M 0 0:01:16 0:00:35 0:00:41 3893k
46 796M 46 372M 0 0 10.2M 0 0:01:17 0:00:36 0:00:41 3869k
47 796M 47 376M 0 0 10.0M 0 0:01:19 0:00:37 0:00:42 3797k
47 796M 47 380M 0 0 9.8M 0 0:01:20 0:00:38 0:00:42 3819k
48 796M 48 383M 0 0 9952k 0 0:01:21 0:00:39 0:00:42 3722k
48 796M 48 385M 0 0 9763k 0 0:01:23 0:00:40 0:00:43 3426k
48 796M 48 388M 0 0 9590k 0 0:01:25 0:00:41 0:00:44 3157k
49 796M 49 390M 0 0 9426k 0 0:01:26 0:00:42 0:00:44 2906k
49 796M 49 393M 0 0 9271k 0 0:01:27 0:00:43 0:00:44 2658k
49 796M 49 396M 0 0 9120k 0 0:01:29 0:00:44 0:00:45 2564k
50 796M 50 399M 0 0 8983k 0 0:01:30 0:00:45 0:00:45 2679k
50 796M 50 402M 0 0 8855k 0 0:01:32 0:00:46 0:00:46 2781k
50 796M 50 405M 0 0 8736k 0 0:01:33 0:00:47 0:00:46 2903k
51 796M 51 407M 0 0 8610k 0 0:01:34 0:00:48 0:00:46 2892k
51 796M 51 410M 0 0 8497k 0 0:01:35 0:00:49 0:00:46 2948k
51 796M 51 413M 0 0 8391k 0 0:01:37 0:00:50 0:00:47 2993k
52 796M 52 416M 0 0 8292k 0 0:01:38 0:00:51 0:00:47 3035k
52 796M 52 420M 0 0 8194k 0 0:01:39 0:00:52 0:00:47 3039k
53 796M 53 423M 0 0 8102k 0 0:01:40 0:00:53 0:00:47 3168k
53 796M 53 426M 0 0 8010k 0 0:01:41 0:00:54 0:00:47 3243k
53 796M 53 428M 0 0 7915k 0 0:01:43 0:00:55 0:00:48 3129k
54 796M 54 431M 0 0 7819k 0 0:01:44 0:00:56 0:00:48 2975k
54 796M 54 433M 0 0 7726k 0 0:01:45 0:00:57 0:00:48 2790k
54 796M 54 436M 0 0 7636k 0 0:01:46 0:00:58 0:00:48 2629k
55 796M 55 438M 0 0 7546k 0 0:01:48 0:00:59 0:00:49 2443k
55 796M 55 440M 0 0 7464k 0 0:01:49 0:01:00 0:00:49 2464k
55 796M 55 443M 0 0 7387k 0 0:01:50 0:01:01 0:00:49 2513k
56 796M 56 446M 0 0 7318k 0 0:01:51 0:01:02 0:00:49 2633k
56 796M 56 449M 0 0 7250k 0 0:01:52 0:01:03 0:00:49 2742k
56 796M 56 452M 0 0 7187k 0 0:01:53 0:01:04 0:00:49 2899k
57 796M 57 455M 0 0 7131k 0 0:01:54 0:01:05 0:00:49 3081k
57 796M 57 458M 0 0 7070k 0 0:01:55 0:01:06 0:00:49 3153k
58 796M 58 462M 0 0 7017k 0 0:01:56 0:01:07 0:00:49 3254k
58 796M 58 465M 0 0 6968k 0 0:01:56 0:01:08 0:00:48 3395k
58 796M 58 469M 0 0 6920k 0 0:01:57 0:01:09 0:00:48 3485k
59 796M 59 473M 0 0 6878k 0 0:01:58 0:01:10 0:00:48 3563k
59 796M 59 477M 0 0 6836k 0 0:01:59 0:01:11 0:00:48 3722k
60 796M 60 481M 0 0 6795k 0 0:01:59 0:01:12 0:00:47 3818k
60 796M 60 484M 0 0 6757k 0 0:02:00 0:01:13 0:00:47 3873k
61 796M 61 488M 0 0 6722k 0 0:02:01 0:01:14 0:00:47 3972k
61 796M 61 493M 0 0 6691k 0 0:02:01 0:01:15 0:00:46 4063k
62 796M 62 497M 0 0 6658k 0 0:02:02 0:01:16 0:00:46 4131k
62 796M 62 501M 0 0 6624k 0 0:02:03 0:01:17 0:00:46 4149k
63 796M 63 505M 0 0 6597k 0 0:02:03 0:01:18 0:00:45 4247k
64 796M 64 510M 0 0 6574k 0 0:02:04 0:01:19 0:00:45 4377k
64 796M 64 515M 0 0 6554k 0 0:02:04 0:01:20 0:00:44 4492k
65 796M 65 520M 0 0 6533k 0 0:02:04 0:01:21 0:00:43 4616k
65 796M 65 524M 0 0 6513k 0 0:02:05 0:01:22 0:00:43 4795k
66 796M 66 529M 0 0 6494k 0 0:02:05 0:01:23 0:00:42 4881k
67 796M 67 534M 0 0 6476k 0 0:02:05 0:01:24 0:00:41 4925k
67 796M 67 539M 0 0 6461k 0 0:02:06 0:01:25 0:00:41 4971k
68 796M 68 544M 0 0 6446k 0 0:02:06 0:01:26 0:00:40 5038k
68 796M 68 548M 0 0 6424k 0 0:02:06 0:01:27 0:00:39 4945k
69 796M 69 553M 0 0 6406k 0 0:02:07 0:01:28 0:00:39 4938k
70 796M 70 558M 0 0 6395k 0 0:02:07 0:01:29 0:00:38 5015k
70 796M 70 564M 0 0 6382k 0 0:02:07 0:01:30 0:00:37 5025k
71 796M 71 569M 0 0 6373k 0 0:02:07 0:01:31 0:00:36 5105k
72 796M 72 574M 0 0 6364k 0 0:02:08 0:01:32 0:00:36 5321k
72 796M 72 580M 0 0 6356k 0 0:02:08 0:01:33 0:00:35 5465k
73 796M 73 585M 0 0 6347k 0 0:02:08 0:01:34 0:00:34 5498k
74 796M 74 591M 0 0 6341k 0 0:02:08 0:01:35 0:00:33 5591k
75 796M 75 597M 0 0 6337k 0 0:02:08 0:01:36 0:00:32 5677k
75 796M 75 602M 0 0 6324k 0 0:02:08 0:01:37 0:00:31 5585k
76 796M 76 607M 0 0 6313k 0 0:02:09 0:01:38 0:00:31 5512k
76 796M 76 612M 0 0 6308k 0 0:02:09 0:01:39 0:00:30 5556k
77 796M 77 618M 0 0 6302k 0 0:02:09 0:01:40 0:00:29 5565k
78 796M 78 624M 0 0 6301k 0 0:02:09 0:01:41 0:00:28 5605k
79 796M 79 630M 0 0 6301k 0 0:02:09 0:01:42 0:00:27 5848k
79 796M 79 636M 0 0 6301k 0 0:02:09 0:01:43 0:00:26 6069k
80 796M 80 642M 0 0 6301k 0 0:02:09 0:01:44 0:00:25 6170k
81 796M 81 649M 0 0 6300k 0 0:02:09 0:01:45 0:00:24 6250k
82 796M 82 653M 0 0 6288k 0 0:02:09 0:01:46 0:00:23 6010k
82 796M 82 659M 0 0 6280k 0 0:02:09 0:01:47 0:00:22 5846k
83 796M 83 665M 0 0 6276k 0 0:02:09 0:01:48 0:00:21 5758k
84 796M 84 671M 0 0 6277k 0 0:02:09 0:01:49 0:00:20 5769k
85 796M 85 677M 0 0 6277k 0 0:02:09 0:01:50 0:00:19 5805k
85 796M 85 683M 0 0 6278k 0 0:02:09 0:01:51 0:00:18 6070k
86 796M 86 689M 0 0 6279k 0 0:02:09 0:01:52 0:00:17 6253k
87 796M 87 695M 0 0 6276k 0 0:02:09 0:01:53 0:00:16 6277k
87 796M 87 700M
0 0 6265k 0 0:02:10 0:01:54 0:00:16 5993k
88 796M 88 705M 0 0 6258k 0 0:02:10 0:01:55 0:00:15 5814k
89 796M 89 711M 0 0 6256k 0 0:02:10 0:01:56 0:00:14 5760k
90 796M 90 717M 0 0 6256k 0 0:02:10 0:01:57 0:00:13 5746k
90 796M 90 724M 0 0 6256k 0 0:02:10 0:01:58 0:00:12 5816k
91 796M 91 728M 0 0 6245k 0 0:02:10 0:01:59 0:00:11 5808k
92 796M 92 734M 0 0 6239k 0 0:02:10 0:02:00 0:00:10 5809k
92 796M 92 739M 0 0 6236k 0 0:02:10 0:02:01 0:00:09 5769k
93 796M 93 745M 0 0 6235k 0 0:02:10 0:02:02 0:00:08 5740k
94 796M 94 751M 0 0 6236k 0 0:02:10 0:02:03 0:00:07 5745k
95 796M 95 757M 0 0 6235k 0 0:02:10 0:02:04 0:00:06 5984k
95 796M 95 762M 0 0 6225k 0 0:02:10 0:02:05 0:00:05 5888k
96 796M 96 768M 0 0 6219k 0 0:02:11 0:02:06 0:00:05 5805k
97 796M 97 772M 0 0 6204k 0 0:02:11 0:02:07 0:00:04 5448k
97 796M 97 776M 0 0 6192k 0 0:02:11 0:02:08 0:00:03 5113k
98 796M 98 781M 0 0 6180k 0 0:02:11 0:02:09 0:00:02 4805k
98 796M 98 786M 0 0 6170k 0 0:02:12 0:02:10 0:00:02 4783k
99 796M 99 789M 0 0 6146k 0 0:02:12 0:02:11 0:00:01 4312k
99 796M 99 791M 0 0 6117k 0 0:02:13 0:02:12 0:00:01 3906k
99 796M 99 793M 0 0 6088k 0 0:02:13 0:02:13 --:--:-- 3425k
99 796M 99 796M 0 0 6061k 0 0:02:14 0:02:14 --:--:-- 2986k
100 796M 100 796M 0 0 6059k 0 0:02:14 0:02:14 --:--:-- 2518k
Once the downloaded is complete, extract the file and set the environment variable PYSYN_CDBS to the path of the trds subdirectory. The next cell will do this for you, as long as the .tar file downloaded above has not been moved.
tar_archive = 'hlsp_reference-atlases_hst_multi_everything_multi_v11_sed.tar'
extract_to = 'hlsp_reference-atlases_hst_multi_everything_multi_v11_sed'
with tarfile.open(tar_archive, 'r') as tar:
tar.extractall(path=extract_to, filter='data')
os.environ['PYSYN_CDBS'] = 'hlsp_reference-atlases_hst_multi_everything_multi_v11_sed/grp/redcat/trds/'
Now, after having set up PYSYN_CDBS, we import stsynphot. A warning regarding the Vega spectrum is expected here.
import stsynphot as stsyn
WARNING: Failed to load Vega spectrum from hlsp_reference-atlases_hst_multi_everything_multi_v11_sed/grp/redcat/trds//calspec/alpha_lyr_stis_011.fits; Functionality involving Vega will be severely limited: FileNotFoundError(2, 'No such file or directory') [stsynphot.spectrum]
Rather than downloading the entire calspec database (synphot6.tar.gz), we can point directly to the latest Vega spectrum which is required for computing VEGAMAG.
vega_url = 'https://ssb.stsci.edu/trds/calspec/alpha_lyr_stis_010.fits'
stsyn.Vega = stsyn.spectrum.SourceSpectrum.from_file(vega_url)
3. Set up the ‘obsmode’ string#
Parameters to set in the obsmode string include:
detector,
filter,
observation date (WFC3/UVIS only), and
aperture size (in arcsec).
Note that a 6.0” aperture is considered to be “infinite”, thus containing all of the flux. The zeropoints posted on the WFC3 website are calculated for an infinite aperture, so when computing photometry for smaller radii, aperture corrections must be applied.
The inputs below can be changed to any desired obsmode, with examples of alternate parameters shown as commented lines.
First, here are some detector examples with WFC3/UVIS1 as the default, and other options including both WFC3/UVIS chips or the WFC3/IR detector.
Note: if the IR detector is chosen, the filtnames below must be updated.
detectors = ['uvis1']
# detectors = ['uvis1', 'uvis2']
# detectors = ['ir']
Next, here are some filter examples with all WFC3/UVIS filters as the default, and other options including just F606W and the WFC3/IR filters.
Note: if WFC3/IR filters is chosen, the detectors above must be set to [‘ir’].
filtnames = ['f200lp', 'f218w', 'f225w', 'f275w', 'f280n', 'f300x', 'f336w', 'f343n', 'f350lp',
'f373n', 'f390m', 'f390w', 'f395n', 'f410m', 'f438w', 'f467m', 'f469n', 'f475w',
'f475x', 'f487n', 'f502n', 'f547m', 'f555w', 'f600lp', 'f606w', 'f621m', 'f625w',
'f631n', 'f645n', 'f656n', 'f657n', 'f658n', 'f665n', 'f673n', 'f680n', 'f689m',
'f763m', 'f775w', 'f814w', 'f845m', 'f850lp', 'f953n']
# filtnames = ['f606w']
# filtnames = ['f098m', 'f105w', 'f110w', 'f125w', 'f126n', 'f127m', 'f128n', 'f130n',
# 'f132n', 'f139m', 'f140w', 'f153m', 'f160w', 'f164n', 'f167n']
Now, here are some date examples with the WFC3/UVIS reference epoch (55008 in MJD; 2009-06-26) as the default, and the other option being the time right now.
mjd = '55008'
# mjd = str(Time.now().mjd)
Finally, here are some aperture radius examples with 6.0” (151 pixels; “infinity”) as the default, and the other options including 0.396” (10 pixels for WFC3/UVIS) and 0.385” (3 pixels for WFC3/IR).
aper = '6.0'
# aper = '0.396'
# aper = '0.385'
4. Basic usage for a single ‘obsmode’#
The calculation of the zeropoints starts with creating a specific bandpass object. Bandpasses generally consist of at least an instrument name, detector name, and filter name, though other parameters (such as the MJD and aperture radius shown above) are optional.
The cell below defines obsmode and creates a bandpass object.
obsmode = 'wfc3,uvis1,f200lp'
bp = stsyn.band(obsmode)
Optional parameters are supplied on the end of the basic bandpass:
obsmode = 'wfc3,uvis1,f200lp,mjd#55008,aper#6.0'
bp = stsyn.band(obsmode)
In addition, we can use the parameters defined in Section 3.
obsmode = f'wfc3, {detectors[0]}, {filtnames[0]}, mjd#{mjd}, aper#{aper}'
bp = stsyn.band(obsmode)
5. Compute zeropoints and other photometric properties#
With the bandpass objects, we can now calculate zeropoints, pivot wavelengths, and photometric bandwidths. To calculate Vegamag zeropoints, we use the Vega spectrum to calculate the flux in a given bandpass.
def calculate_values(detector, filt, mjd, aper):
# parameters can be removed from obsmode as needed
obsmode = f'wfc3, {detector}, {filt}, mjd#{mjd}, aper#{aper}'
bp = stsyn.band(obsmode)
# STMag
photflam = bp.unit_response(stsyn.conf.area) # inverse sensitivity in flam
stmag = -21.1 - 2.5 * np.log10(photflam.value)
# Pivot Wavelength and bandwidth
photplam = bp.pivot() # pivot wavelength in angstroms
bandwidth = bp.photbw() # bandwidth in angstroms
# ABMag
abmag = stmag - 5 * np.log10(photplam.value) + 18.6921
# Vegamag
obs = Observation(stsyn.Vega, bp, binset=bp.binset) # synthetic observation of vega in bandpass using vega spectrum
vegamag = -1 * obs.effstim(flux_unit='obmag', area=stsyn.conf.area)
return obsmode, photplam.value, bandwidth.value, photflam.value, stmag, abmag, vegamag.value
obsmode, photplam, bandwidth, photflam, stmag, abmag, vegamag = calculate_values(detectors[0], filtnames[0], mjd, aper)
# print values
print('Obsmode PivotWave Photflam STMAG ABMAG VEGAMAG')
print(f'{obsmode}, {photplam:.1f}, {photflam:.4e}, {stmag:.3f}, {abmag:.3f}, {vegamag:.3f}')
Obsmode PivotWave Photflam STMAG ABMAG VEGAMAG
wfc3, uvis1, f200lp, mjd#55008, aper#6.0, 4971.9, 4.9157e-20, 27.171, 27.381, 26.931
6. Iterate over multiple ‘obsmodes’#
To calculate zeropoints for multiple detectors and/or filters, we can use the function defined above and loop through detectors and filters defined in Section 3.
oms, pivots, bws, pfs, st, ab, vm = [], [], [], [], [], [], []
print('Obsmode PivotWave Photflam STMAG ABMAG VEGAMAG')
for detector in detectors:
for filt in filtnames:
res = calculate_values(detector, filt, mjd, aper)
obsmode, photplam, bandwidth, photflam, stmag, abmag, vegamag = res # solely for readability
# print values
print(f'{obsmode}, {photplam:.1f}, {photflam:.4e}, {stmag:.3f}, {abmag:.3f}, {vegamag:.3f}')
oms.append(obsmode)
pivots.append(photplam)
bws.append(bandwidth)
pfs.append(photflam)
st.append(stmag)
ab.append(abmag)
vm.append(vegamag)
Obsmode PivotWave Photflam STMAG ABMAG VEGAMAG
wfc3, uvis1, f200lp, mjd#55008, aper#6.0, 4971.9, 4.9157e-20, 27.171, 27.381, 26.931
wfc3, uvis1, f218w, mjd#55008, aper#6.0, 2228.0, 1.4594e-17, 20.990, 22.942, 21.278
wfc3, uvis1, f225w, mjd#55008, aper#6.0, 2372.1, 4.5688e-18, 22.251, 24.067, 22.430
wfc3, uvis1, f275w, mjd#55008, aper#6.0, 2709.7, 3.2206e-18, 22.630, 24.158, 22.677
wfc3, uvis1, f280n, mjd#55008, aper#6.0, 2832.9, 5.7472e-17, 19.501, 20.932, 19.516
wfc3, uvis1, f300x, mjd#55008, aper#6.0, 2820.5, 1.4093e-18, 23.527, 24.968, 23.565
wfc3, uvis1, f336w, mjd#55008, aper#6.0, 3354.5, 1.2848e-18, 23.628, 24.692, 23.527
wfc3, uvis1, f343n, mjd#55008, aper#6.0, 3435.2, 2.5672e-18, 22.876, 23.889, 22.754
wfc3, uvis1, f350lp, mjd#55008, aper#6.0, 5873.9, 5.1638e-20, 27.118, 26.965, 26.810
wfc3, uvis1, f373n, mjd#55008, aper#6.0, 3730.2, 1.3488e-17, 21.075, 21.909, 21.036
wfc3, uvis1, f390m, mjd#55008, aper#6.0, 3897.2, 2.5524e-18, 22.883, 23.621, 23.545
wfc3, uvis1, f390w, mjd#55008, aper#6.0, 3923.7, 5.0142e-19, 24.649, 25.373, 25.174
wfc3, uvis1, f395n, mjd#55008, aper#6.0, 3955.2, 5.9589e-18, 21.962, 22.668, 22.712
wfc3, uvis1, f410m, mjd#55008, aper#6.0, 4109.0, 2.3481e-18, 22.973, 23.597, 23.771
wfc3, uvis1, f438w, mjd#55008, aper#6.0, 4326.2, 6.7475e-19, 24.327, 24.839, 25.003
wfc3, uvis1, f467m, mjd#55008, aper#6.0, 4682.6, 1.6498e-18, 23.356, 23.696, 23.859
wfc3, uvis1, f469n, mjd#55008, aper#6.0, 4688.1, 9.3089e-18, 21.478, 21.815, 21.981
wfc3, uvis1, f475w, mjd#55008, aper#6.0, 4773.1, 2.4962e-19, 25.407, 25.705, 25.810
wfc3, uvis1, f475x, mjd#55008, aper#6.0, 4940.7, 1.5343e-19, 25.935, 26.158, 26.216
wfc3, uvis1, f487n, mjd#55008, aper#6.0, 4871.4, 5.8860e-18, 21.975, 22.229, 22.050
wfc3, uvis1, f502n, mjd#55008, aper#6.0, 5009.6, 5.0824e-18, 22.135, 22.328, 22.421
wfc3, uvis1, f547m, mjd#55008, aper#6.0, 5447.5, 4.5847e-19, 24.747, 24.758, 24.761
wfc3, uvis1, f555w, mjd#55008, aper#6.0, 5308.4, 1.8272e-19, 25.746, 25.813, 25.841
wfc3, uvis1, f600lp, mjd#55008, aper#6.0, 7468.1, 8.6226e-20, 26.561, 25.887, 25.554
wfc3, uvis1, f606w, mjd#55008, aper#6.0, 5889.2, 1.1506e-19, 26.248, 26.090, 26.006
wfc3, uvis1, f621m, mjd#55008, aper#6.0, 6218.9, 4.0126e-19, 24.891, 24.615, 24.465
wfc3, uvis1, f625w, mjd#55008, aper#6.0, 6242.6, 1.7139e-19, 25.815, 25.530, 25.379
wfc3, uvis1, f631n, mjd#55008, aper#6.0, 6304.3, 4.8250e-18, 22.191, 21.885, 21.723
wfc3, uvis1, f645n, mjd#55008, aper#6.0, 6453.6, 3.3059e-18, 22.602, 22.245, 22.049
wfc3, uvis1, f656n, mjd#55008, aper#6.0, 6561.4, 1.6713e-17, 20.842, 20.450, 19.868
wfc3, uvis1, f657n, mjd#55008, aper#6.0, 6566.6, 2.1811e-18, 23.053, 22.659, 22.333
wfc3, uvis1, f658n, mjd#55008, aper#6.0, 6584.0, 9.7496e-18, 21.428, 21.027, 20.672
wfc3, uvis1, f665n, mjd#55008, aper#6.0, 6655.9, 1.9774e-18, 23.160, 22.736, 22.492
wfc3, uvis1, f673n, mjd#55008, aper#6.0, 6765.9, 2.1926e-18, 23.048, 22.588, 22.343
wfc3, uvis1, f680n, mjd#55008, aper#6.0, 6877.6, 6.8241e-19, 24.315, 23.820, 23.556
wfc3, uvis1, f689m, mjd#55008, aper#6.0, 6876.8, 3.7208e-19, 24.973, 24.479, 24.196
wfc3, uvis1, f763m, mjd#55008, aper#6.0, 7614.4, 3.8291e-19, 24.942, 24.226, 23.837
wfc3, uvis1, f775w, mjd#55008, aper#6.0, 7651.4, 2.0922e-19, 25.599, 24.872, 24.480
wfc3, uvis1, f814w, mjd#55008, aper#6.0, 8039.1, 1.4994e-19, 25.960, 25.126, 24.698
wfc3, uvis1, f845m, mjd#55008, aper#6.0, 8439.1, 4.5207e-19, 24.762, 23.823, 23.316
wfc3, uvis1, f850lp, mjd#55008, aper#6.0, 9176.1, 3.7052e-19, 24.978, 23.857, 23.326
wfc3, uvis1, f953n, mjd#55008, aper#6.0, 9530.6, 8.0946e-18, 21.630, 20.426, 19.803
Values can also be written into an astropy table.
tbl = Table([oms, pivots, bws, pfs, st, ab, vm],
names=['Obsmode', 'Pivot Wave', 'Bandwidth', 'Photflam', 'STMag', 'ABMag', 'VegaMag'])
We’ll also round columns to a smaller number of decimals.
for col in tbl.itercols():
if col.name == 'Photflam':
col.info.format = '.4e'
elif col.info.dtype.kind == 'f':
col.info.format = '.3f'
Let’s view our astropy table:
tbl
| Obsmode | Pivot Wave | Bandwidth | Photflam | STMag | ABMag | VegaMag |
|---|---|---|---|---|---|---|
| str40 | float64 | float64 | float64 | float64 | float64 | float64 |
| wfc3, uvis1, f200lp, mjd#55008, aper#6.0 | 4971.860 | 1742.198 | 4.9157e-20 | 27.171 | 27.381 | 26.931 |
| wfc3, uvis1, f218w, mjd#55008, aper#6.0 | 2228.039 | 128.941 | 1.4594e-17 | 20.990 | 22.942 | 21.278 |
| wfc3, uvis1, f225w, mjd#55008, aper#6.0 | 2372.053 | 177.430 | 4.5688e-18 | 22.251 | 24.067 | 22.430 |
| wfc3, uvis1, f275w, mjd#55008, aper#6.0 | 2709.689 | 164.435 | 3.2206e-18 | 22.630 | 24.158 | 22.677 |
| wfc3, uvis1, f280n, mjd#55008, aper#6.0 | 2832.862 | 200.689 | 5.7472e-17 | 19.501 | 20.932 | 19.516 |
| wfc3, uvis1, f300x, mjd#55008, aper#6.0 | 2820.469 | 316.561 | 1.4093e-18 | 23.527 | 24.968 | 23.565 |
| wfc3, uvis1, f336w, mjd#55008, aper#6.0 | 3354.492 | 158.422 | 1.2848e-18 | 23.628 | 24.692 | 23.527 |
| wfc3, uvis1, f343n, mjd#55008, aper#6.0 | 3435.151 | 86.713 | 2.5672e-18 | 22.876 | 23.889 | 22.754 |
| wfc3, uvis1, f350lp, mjd#55008, aper#6.0 | 5873.870 | 1490.060 | 5.1638e-20 | 27.118 | 26.965 | 26.810 |
| ... | ... | ... | ... | ... | ... | ... |
| wfc3, uvis1, f665n, mjd#55008, aper#6.0 | 6655.876 | 42.191 | 1.9774e-18 | 23.160 | 22.736 | 22.492 |
| wfc3, uvis1, f673n, mjd#55008, aper#6.0 | 6765.939 | 41.943 | 2.1926e-18 | 23.048 | 22.588 | 22.343 |
| wfc3, uvis1, f680n, mjd#55008, aper#6.0 | 6877.596 | 112.013 | 6.8241e-19 | 24.315 | 23.820 | 23.556 |
| wfc3, uvis1, f689m, mjd#55008, aper#6.0 | 6876.755 | 207.613 | 3.7208e-19 | 24.973 | 24.479 | 24.196 |
| wfc3, uvis1, f763m, mjd#55008, aper#6.0 | 7614.371 | 229.425 | 3.8291e-19 | 24.942 | 24.226 | 23.837 |
| wfc3, uvis1, f775w, mjd#55008, aper#6.0 | 7651.363 | 419.719 | 2.0922e-19 | 25.599 | 24.872 | 24.480 |
| wfc3, uvis1, f814w, mjd#55008, aper#6.0 | 8039.056 | 666.760 | 1.4994e-19 | 25.960 | 25.126 | 24.698 |
| wfc3, uvis1, f845m, mjd#55008, aper#6.0 | 8439.057 | 260.304 | 4.5207e-19 | 24.762 | 23.823 | 23.316 |
| wfc3, uvis1, f850lp, mjd#55008, aper#6.0 | 9176.126 | 470.529 | 3.7052e-19 | 24.978 | 23.857 | 23.326 |
| wfc3, uvis1, f953n, mjd#55008, aper#6.0 | 9530.579 | 71.190 | 8.0946e-18 | 21.630 | 20.426 | 19.803 |
We can finally save the table as a .txt file.
if not os.path.exists('./uvis_zp_tbl.txt'):
tbl.write('uvis_zp_tbl.txt', format='ascii.commented_header')
7. Create and plot ‘total system throughput’ tables#
The function below returns a tuple containing two objects, the first being an array of wavelengths, and the second being the throughput at each of those wavelengths.
def calculate_bands(bp, save=False, overwrite=True):
# Pass in bandpass object as bp
waves = bp.waveset
throughput = bp(waves)
if save:
tmp = Table([waves, throughput], names=['WAVELENGTH', 'THROUGHPUT'])
tmp.write(', '.join(bp.obsmode.modes)+'.txt', format='ascii.commented_header', overwrite=overwrite)
return (waves, throughput)
We’ll calculate the throughput table for WFC3/UVIS1 in F200LP.
obsmode = 'wfc3,uvis1,f200lp'
bp = stsyn.band(obsmode)
wl, tp = calculate_bands(bp)
Now, let’s plot our results.
fig = plt.figure(figsize=(10, 5))
plt.plot(wl, tp)
plt.xlim(1500, 11000)
plt.xlabel('Wavelength [Angstroms]')
plt.ylabel('Throughput')
plt.title('WFC3,UVIS1,F200LP')
Text(0.5, 1.0, 'WFC3,UVIS1,F200LP')
To save the curve in an ascii table, simply pass the argument save=True:
calculate_bands(bp, save=True)
(<Quantity [ 500., 1000., 1010., ..., 20002., 30000., 30010.] Angstrom>,
<Quantity [0., 0., 0., ..., 0., 0., 0.]>)
To save curves for all obsmodes defined in Section 3 in the input list, we can loop through detectors and filters.
for det in detectors:
for filt in filtnames:
obsmode = f'wfc3, {det}, {filt}'
bp = stsyn.band(obsmode)
calculate_bands(bp, save=True)
In addition, we’ll create a directory called obsmodes_curves and move all the saved files to that directory.
! mkdir obsmodes_curves
! mv wfc3*txt obsmodes_curves
! ls obsmodes_curves
mkdir: cannot create directory ‘obsmodes_curves’: File exists
'wfc3, uvis1, f200lp.txt' 'wfc3, uvis1, f438w.txt' 'wfc3, uvis1, f645n.txt'
'wfc3, uvis1, f218w.txt' 'wfc3, uvis1, f467m.txt' 'wfc3, uvis1, f656n.txt'
'wfc3, uvis1, f225w.txt' 'wfc3, uvis1, f469n.txt' 'wfc3, uvis1, f657n.txt'
'wfc3, uvis1, f275w.txt' 'wfc3, uvis1, f475w.txt' 'wfc3, uvis1, f658n.txt'
'wfc3, uvis1, f280n.txt' 'wfc3, uvis1, f475x.txt' 'wfc3, uvis1, f665n.txt'
'wfc3, uvis1, f300x.txt' 'wfc3, uvis1, f487n.txt' 'wfc3, uvis1, f673n.txt'
'wfc3, uvis1, f336w.txt' 'wfc3, uvis1, f502n.txt' 'wfc3, uvis1, f680n.txt'
'wfc3, uvis1, f343n.txt' 'wfc3, uvis1, f547m.txt' 'wfc3, uvis1, f689m.txt'
'wfc3, uvis1, f350lp.txt' 'wfc3, uvis1, f555w.txt' 'wfc3, uvis1, f763m.txt'
'wfc3, uvis1, f373n.txt' 'wfc3, uvis1, f600lp.txt' 'wfc3, uvis1, f775w.txt'
'wfc3, uvis1, f390m.txt' 'wfc3, uvis1, f606w.txt' 'wfc3, uvis1, f814w.txt'
'wfc3, uvis1, f390w.txt' 'wfc3, uvis1, f621m.txt' 'wfc3, uvis1, f845m.txt'
'wfc3, uvis1, f395n.txt' 'wfc3, uvis1, f625w.txt' 'wfc3, uvis1, f850lp.txt'
'wfc3, uvis1, f410m.txt' 'wfc3, uvis1, f631n.txt' 'wfc3, uvis1, f953n.txt'
8. Conclusions#
Thank you for walking through this notebook. Now using WFC3 data, you should be more familiar with:
Calculating zeropoints and other photometric properties using
stsynphot.Creating, plotting, and saving ‘total system throughput’ tables.
Congratulations, you have completed the notebook!#
Additional Resources#
Below are some additional resources that may be helpful. Please send any questions through the HST Helpdesk.
-
see sections 9.5.2 for reference to this notebook
About this Notebook#
Authors: Varun Bajaj, Jennifer Mack; WFC3 Instrument Team
Updated on: 2024-03-18
Citations#
If you use numpy, astropy, synphot, or stsynphot for published research, please cite the
authors. Follow these links for more information about citing the libraries below:
