Automated Photometry for Transients
Automated Photometry for Transients
1
School of Physics, O’Brien Centre for Science North, University College Dublin, Belfield, Dublin 4, Ireland
ABSTRACT
arXiv:2201.02635v4 [[Link]] 6 Sep 2023
We present the AUTOmated Photometry Of Transients (AutoPhOT) package, a novel automated pipeline that is designed for rapid,
publication-quality photometry of transients. AutoPhOT is built from the ground up using Python 3 - with no dependencies on legacy
software. Capabilities of AutoPhOT include aperture and PSF-fitting photometry, template subtraction, and calculation of limiting
magnitudes through artificial source injection. AutoPhOT is also capable of calibrating photometry against either survey catalogs (e.g.
SDSS, PanSTARRS), or using a custom set of local photometric standards. We demonstrate the ability of AutoPhOT to reproduce
lightcurves found in the published literature. AutoPhOT’s ability to recover source fluxes is consistent with commonly used software
e.g. DAOPHOT, using both aperture and PSF photometry. We also demonstrate that AutoPhOT can reproduce published lightcurves
for a selection of transients with minimal human intervention.
Key words. Methods: data analysis, Techniques: image processing, Techniques: photometric
neous photometric output. AutoPhOT is available on Github2 When AutoPhOT is run on an image from a new telescope,
and available for installation though Conda 3 . AutoPhOT will the software asks the User to clarify certain keywords using the
receive continued support, and one should refer to the online check_teledata package. For example, this may involve clar-
documentation for up-to-date information and further implemen- ifying whether “SDSS-U” refers to Sloan u or Johnson-Cousins
tations 4 . U. This is the only step in running autophot which requires hu-
The purpose of this paper is to briefly outline the AutoPhOT man intervention, but is necessary due to the ambiguous filter
package5 . We discuss the automated preprocessing within Au- naming conventions used by some telescopes.
toPhOT in Sect. 2 and how photometric measurements are made After the AutoPhOT telescope check function has run, the
in Sect. 3. We provide a brief outline of the photometric cali- results are saved as a human-readable Yaml file (see example in
bration in Sect. 4. We outline the limiting magnitude package in Listing 1) allowing for easy additions, alterations or corrections.
Sect. 6. Finally, we discuss the performance of AutoPhOT and When AutoPhOT is subsequently run on images from the same
its ability to provide science-ready results in Sect. 7. telescope and instrument, it will lookup filter names etc. in this
Yaml file.
2. Pre-processing Along with filter names, the Yaml database (shown in Listing
1) contains other instrument-specific information necessary for
2.1. Image reduction automated execution of AutoPhOT. The nested dictionary struc-
Due to the specific nuances of various CCDs, it is left to the ture allows for multiple instruments at the same telescope (in
User or observing facility to correctly reduce the images prior to the example shown information is given for both the ALFOSC
running AutoPhOT. These steps should typically include bias, and NOTCam instruments mounted on the Nordic Optical Tele-
flat-field and bad pixel corrections. For a general overview on scope).
these reduction steps, see Howell (2006). filter_key_0 gives the fits header key which gives the filter
names8 . To account for instruments with multiple filter wheels,
2.2. Image stacking
this keyword can be iterated i.e. filter_key_0, filter_key_1, etc. If
it finds an incompatible header value i.e. if the filter corresponds
AutoPhOT does not perform image stacking. Often multiple ex- to CLEAR or AIR, it is ignored unless requested otherwise by
posures will be taken in the same bandpass during the night, in the User9 .
particular when long exposures that are susceptible to cosmic AutoPhOT requires at minimum for an image to have the
rays are used. TELESCOPE and INSTRUME keywords. Both keywords are
It is difficult to produce a universal image stacking proce- standard fits keywords10 and are virtually ubiquitous across all
dure, and it is hence left to the User to stack images if they astronomical images. If not found, an error is raised and the User
so wish6 . AutoPhOT hence treats multiple images taken on the is asked for their intervention.
same night independently. The User is cautioned that if they
combine images, they should update the header keywords for A pre-populated Yaml file with information and keywords
gain and readout noise where necessary before running Au- for several commonly-used telescopes is provided as part of Au-
toPhOT. toPhOT.
2.3. Target Identification 2.5. Solving for the World Coordinate System
AutoPhOT implements the Transient Name Server7 (TNS)
Python API to obtain the most up-to-date coordinates of a par- Astronomical images require a World Coordinate System (WCS)
ticular transient. These coordinates are transformed from right to convert sky coordinates to X and Y pixel coordinates. Many
ascension (RA) and declination (Dec) into X and Y pixel coor- images may have WCS values written during the reduction pro-
dinates using the image World Coordinate System (WCS), see cess. However, it is not uncommon for an image to have an offset
Sec. 2.5. WCS or be missing WCS information entirely. AutoPhOT as-
If a transient is not known to the TNS then the RA and DEC sumes the WCS is unreliable when there is a significant (default
can be manually specifed by the User. is 2 × FWHM) offset between the catalog positions of sources in
the image, and their measured position. In such cases (and where
a WCS is missing entirely), AutoPhOT calls a local instance of
2.4. Parsing image and instrument metadata Astrometry.net11 (Lang et al. 2010). Source detection is per-
formed on the input image, and asterisms (sets of four or five
Flexible Image Transport System (FITS) files are commonly stars) are geometrically matched to pre-indexed catalogs. Solv-
used to store astronomical image. These files typically contain a ing for the WCS values typically takes from ∼ 5s to ∼ 30s per
2D image as well as the image metadata stored as keyword-value image12 .
pairs in a human-readable ASCII header. While FITS header
keywords contain critical information about the observation it-
self, such as exposure time, filter, telescope, these keywords are
8
often inconsistent between different observatories. At the time of writing these filters are Johnson-Cousins U, B, V, R,
I, Sloan- u, g, r, i, z and NIR- J, H, K
2 9
[Link] This is necessary in the case of unfiltered observations.
3 10
[Link] [Link]
4
[Link] [Link]
5 11
Version 1.0.2 [Link]
6 12
For example with CCDPROC (Craig et al. 2017) Using a 2017 MacBook Pro, with a 2.5 GHz Intel Core i7 processor
7
[Link] with 8 Gb DDR3 RAM.
Listing 1. Example of entry in [Link] for the Nordic Optical & Tewes 2019) which is a Python 3 adaptation of the commonly
Telescope (NOT). This entry includes instrument-specific information used LACosmic code (van Dokkum et al. 2012).
needed for header keyword translation (FILTER, AIRMASS, GAIN),
filter keywords (g_SDSS: g, B_Bes: B, etc) as well as location informa-
tion and extinction terms, discussed further in Sect. 4.3 2.7. Measuring image Full Width Half Maximum
The Full Width Half Maximum (FWHM) of point sources in an
NOT: image is determined by the astronomical seeing when the im-
INSTRUME: age was taken, as well as the telescope and instrument optics.
ALFOSC_FASU: AutoPhOT measures the FWHM of an image by fitting an an-
Name: NOT+ALFOSC alytical model (by default a Moffat function; Moffat 1969) to a
AIRMASS: AIRMASS few tens of bright isolated sources in the field.
GAIN: GAIN Firstly, AutoPhOT needs to adapt to the number of point
RDNOISE: READNOISE sources in an image. A deep image with a large field of view
filter_key_0: FILTER (FoV) will have considerably more sources than a shallow image
filter_key_1: FILTER1 with a small FoV. Too few sources may lead to poorly sampled
pixel_scale: 0.213 (or incorrect) values of the FWHM, while too many sources may
B_Bes: B indicate the detection threshold is too low (i.e. background noise
V_Bes: V is detected as a source) and needlessly increases the computa-
color_index: tion time. Fig. 1 illustrates the process for finding the FWHM
B: of an image. AutoPhOT’s FWHM function in the FIND package
B-V: aims to obtain a well sampled value for the FWHM of the im-
m: 0.014 age without any prior knowledge of the number of sources in the
m_err: 0.007 field. The process begins with a search for point-like searches
V: using the DAOFIND (Stetson 1987) algorithm, together with an
B-V: initial guess for the threshold value (that is, the minimum counts
m: -0.106 above the background level for a source to be considered). The
m_err: 0.012 first iteration returns a small set of bright sources, measures their
. FWHM and updates the initial guess for the FWHM value.
. The process continues to search for sources above the thresh-
. old value in the field. If too many sources are detected, the
NOTCAM: loop will rerun the algorithm with a higher threshold value. This
Name: NOT+NOTCAM change in threshold value is adaptively set based on the number
AIRMASS: AIRMASS of sources detected.
GAIN: GAIN We use sigma clipping is used to remove extended sources
. (e.g. faint galaxies, saturated sources, etc) which may have
. slipped through. In classical sigma clipping, if we have a me-
. dian value for the FWHM with a standard deviation, σ, then only
values with within ±nσ of the median is used, where n is some
extinction: value, which by default is set to n = 3. AutoPhOT uses a more
ex_B: 0.203 robust method to determine outliers via the median absolute de-
ex_I: 0.019 viation given by:
ex_R: 0.069
.
MAD
. σ MAD = ≈ 1.4826 · MAD
. Φ−1 (P)
where MAD = median(|Xi − µ|) (1)
location:
alt: 2327 where Φ−1 (P) is the normal inverse cumulative distribution func-
lat: 28.76 tion evaluated at probability P = 3/4. Assuming a normal dis-
lon: -17.88 tribution of FWHM values, n = 3 would mean that ∼ 99%
name: lapalma of FWHM measurement would fall within this value. Once a
FWHM value is found for an image it is then used henceforth
for this image for building the PSF model and photometric mea-
surements.
2.6. Cosmic Ray removal
Cosmic Rays (CRs) are high energy particles that impact the 3. Photometry
CCD detector and can result in bright points or streaks on the
CCD image. For images with long exposure times, CRs can be Fundamentally, photometry consists of the measuring the inci-
problematic as they may lie on top of regions or sources of inter- dent photon flux from an astronomical source and calibrating this
est. onto a standard system. We can define the difference in magni-
To mask and remove cosmic rays, AutoPhOT uses an in- tude between two sources m1 and m2 as
stance of Astroscrappy13 (van Dokkum et al. 2012; McCully !
F1
13
[Link]
m1 − m2 = −2.5 · Log10 (2)
F2
Article number, page 3 of 16
A&A proofs: manuscript no. autophot
*X +
Cleaned Image
mT = −2.5 · Log10 (FT ) + mcat,i + 2.5 · Log10 (Fi )
i
→ mT = minstrumental,T + ZP (4)
Source detection with where mT is the unknown apparent magnitude of the transient
Increase Decrease with a flux FT . The later term describes the magnitude offset
a threshold detection
threshold threshold or zeropoint (ZP) for the image and is found by subtracting
criteria
the catalog magnitude , mcat,i , from the measured magnitude,
−2.5 · log10 (Fi ). An average value for the zeropoint is typically
calculated using a few tens of sources in the field, typically close
Select isolated source to the transient position.
Too many Too few
away from image Applying simply a zeropoint will typically result in photom-
soures sources
boundary etry that is accurate to O ∼ 0.1 mag or better. For more precise
calibration, and in particular to ensure homogeneous measure-
ments across different instruments, one must apply additional
Fit analytical model to corrections beside the zeropoint. These include color correction
Too many (CCλ ) terms and aperture corrections, which we discuss in Sect.
obtain source FWHM poor fits
for each source 4.
Sigma clip to remove Inconsistent AutoPhOT can perform either aperture or PSF-fitting photom-
extended objects values etry on images. Both methods have their advantages and lim-
itations. Aperture photometry is a simple way to measure the
number of counts within a defined area around a source. This
technique makes no assumption about the shape of the source
and simply involves summing up the counts within a aperture of
Full Width Half a certain radius placed at the centroid of a source.
Maximum AutoPhOT begins by using aperture photometry as an ini-
tial guess to find the approximate magnitude of bright sources.
If PSF-fitting photometry is not used, for example if it fails due
Fig. 1. Flowchart showing the iterative process of finding the FWHM
of image using AutoPhOT. We do not show the adaptive threshold step to a lack of bright isolated sources in the field15 , aperture pho-
size for purpose of clarity. tometry is implemented. Aperture photometry can yield accurate
results for bright, isolated sources (flux dominated), but may give
measurements with larger uncertainties for faint sources (noise
where F1 and F2 are the measured fluxes (counts per second) dominated), see Appendix B.
from two sources. As Eq. 2 describes a relative system, we also To perform aperture photometry, AutoPhOT first finds the
need to define some fiducial stars with known magnitudes. One centroid of a point source by fitting a Gaussian function. To ac-
such definition is the “Vega” magnitude system, where the mag- curately measure the brightness of a source, the background flux
nitude of the star Vega in any given filter is taken to be 014 In this must be subtracted. This can be done in several ways in Au-
case, the magnitude of any other star is simply related to the flux toPhOT, including a local median subtraction or fitting a 2D
ratio of that star and Vega as follows: polynomial surface to the background region.
Choosing the optimum background subtraction requires
some prior knowledge of the FWHM. The median subtraction
! method is best for a cutout with a flat background (e.g. template
F1 subtracted images, see Sect. 5), or for a smoothly varying back-
m1 = −2.5 · Log10 (3)
FVega ground over the scale of a few FWHM. For a background with
strong variations (e.g. a on the edge of a extended source) the sur-
face fitting algorithm performs best. For consistency, AutoPhOT
When performing photometry on transients, we typically retains the same background subtraction method (surface fitting
measure the instrumental magnitude of the transient itself as well by default) for all point source measurements.
as several reference sources with known catalog magnitudes in We demonstrate the aperture photometry functionality in
the image. Comparing the magnitude offset with the literature Fig. 2. In this case the background counts have been found
values of these reference sources (which can be unique to each within an annulus centred on the source position. The counts
image due to varying nightly conditions) and applying it to the from the source can then be found using:
transient, we can place the measurement of the transient onto a
standard system. We define the apparent magnitude of the tran-
sient as Fλ × texp = countsap − ⟨counts sky ⟩ · n pix (5)
14 15
In practice, the modern definition of the Vega magnitude system im- Sources must have a signal to noise ratio of greater that 25 to be used
plies that Vega itself has a magnitude of 0.03. in the PSF model by default.
Probability Density
30 20
Y [ Pixel ]
15
20
10
10 5
0
0.10 0.08 0.06 0.04 0.02 0.00
0 Correction [ mag ]
1.7 1.8
Counts [103 ]
Counts [103 ]
1.8
Fig. 4. Histogram shows magnitude of the ratio of our large aperture
size with r = 2.5 × FWHM and normal aperture size with r = 1.6 ×
1.6 FWHM for a single image. This is the aperture correction used when
0 10 20 30 40 aperture photometry is employed.
X [ Pixel ]
0.6
To calculate the aperture correction, the bright sources found
in Sect. 2.7 are measured with a large aperture size and the
0.4 standard aperture size. AutoPhOT uses an large aperture size
with r = 2.5 × FWHM and normal aperture size with r =
0.2 COG 1.6 × FWHM 17 . Using Eq. 2, the ratio of these values gives a
Mean COG magnitude correction which compensates for the flux lost due to
0.0 Optimum Radius x 1.5 a finite aperture size. In Fig. 4 we plot the distribution of aperture
0 1 2 3 4 5 corrections for a sample of bright, isolated sources. The average
Aperture Size [ 1/FWHM ] value and standard deviation are taken as the aperture correction,
which is applied to all sources measured with standard aperture
Fig. 3. Sample of S/N values within a given aperture given in the major size during aperture photometry.
axis. Mean Curve Of Growth (COG) given as blue and optimum radius Aperture photometry has its drawbacks. It performs poorly in
taken as maximum of this curve, given by blue arrow. The optimum
radius is multiplied by 1.5 to allow for any discrepancy in centroiding.
crowded fields, where contamination from neighbouring sources
can interfere with measurements of a single point source. Addi-
tionally transients that occur close to their host may have com-
where countsap is the total counts within the aperture area, plex backgrounds which may contaminate measurements. Aper-
⟨counts sky ⟩ is the average counts due to the sky background and ture photometry is more susceptible to CCD detector defects
n pix is the number of pixels within our aperture. such as hot/cold and dead pixels and CRs. Moreover, aperture
photometry assumes a flat weight function across the aperture
There is a balance when selecting an optimum aperture size.
and is susceptible to centroiding discrepancies. Point sources in-
The aperture should be large such that most of the light from the
herently have a Gaussian-like weight function which can more
star is captured. However, it should be small enough so that con-
accurately account for the PSF.
tamination from the sky background and unrelated sources in
minimized. Fig. 3 demonstrates a search for optimum aperture Although aperture photometry can always be used (with
size in AutoPhOT16 . For a sample of bright sources found from varying results), modelling the PSF of a star can provide more
Sect. 2.7, the signal-to-noise ratio is measured within a series of accurate measurements and can be applied to more dynamic sce-
apertures of increasing radii. Typically the S/N will reach a max- narios, such as blended sources and high background scenarios.
imum at 1–2 times the FWHM, although this can vary depending
on the PSF. The aperture radius at which the S/N is maximized
16 17
This value can also be fixed and the default is taken as 1.6 × FWHM Both values are adjusted if an optimum aperture size is used
3.2. Point Spread Function Photometry for sub-pixel fitting. We can then simple multiply the fitted am-
plitude of the source with the counts under our normalised PSF
All point sources in an image, regardless of their brightness or model to find the counts for any given source.
colour have the same shape to their PSF18 . The amplitude of the In Fig. 6 we show an example of the residual image after
PSF will of course change with brightness. fitting our PSF model to a source and subtracting it off. In this
PSF-fitting photometry uses bright sources in the field to example the point source is almost symmetric. A signature of a
build a semi-analytical model which is then fitted to fainter suitable PSF model is that after subtraction, there is little to no
sources to find their instrumental magnitude. PSF photometry evidence of the prior point source.
is the method of choice for crowded fields and can give better
results for low S/N sources when compared to aperture photom-
etry. 4. Calibrating photometry
AutoPhOT assumes that the PSF is non-spatially varying
across the image, meaning points sources will in theory appear A crucial step in photometry is calibrating instrumental magni-
the same regardless of their location on the image. In practice tudes onto a standard photometric system. Due to the sparsity of
this may not be the case for images that cover a large FoV photometric nights (i.e. nights when there are no clouds or other
(Howell 2006). If AutoPhOT detects a significant variation in issues with atmospheric transparency), this zeropoint calibration
PSF shape across the images, if will only perform measurements must be obtained for each image. Furthermore, even on photo-
within a radius around the transient position where the PSF is ap- metric nights, there may be a gradual shift in zeropoint due to
proximately constant. the cleanliness/coating of the mirrors over time (for an example
The PSF package designed for AutoPhOT is based on the of this effect, see fig. 3 in Harbeck et al. 2018). We discuss the
work of Stetson (1987), Massey & Davis (1992) and Heasley zeropoint calibration in Sect. 4.1. In some cases it is sufficient
(1999). AutoPhOT uses “well-behaved” sources to build the PSF to apply the zeropoint correction alone to produce calibrated,
model which will then be used to measure the amplitude of publication-ready photometry.
sources in the field. These sources must be have a high S/N, iso- However, in cases where multiple instruments have been
lated from their neighbours and have a relatively smooth back- used to observe a supernova measurements, one must account
ground. This is done by building a compound model comprised for differences between telescopes. In particular, we must con-
of an analytical component (such as Gaussian or Moffat) along sider effects due slight manufacturing differences between filter
with a numerical residual table obtained during the fitting pro- sets which may give systematic offsets for the same transients
cess. Although sources are selected from Sect. 2.7, the User may measured using different instruments. These effects typically ac-
supply the coordinates of PSF stars. counts for ∼ 0.1 mag corrections to photometry.
If a FWHM of an image is comparable to the pixel size, the
image is said to be under sampled. In this case PSF-fitting pho- 4.1. Zeropoint Calibration
tometry is particularly susceptible to centroiding errors (Wildey
1992; Lauer 1999). If AutoPhOT finds a very small FWHM for The zeropoint is used to calibrate an instrumental magnitude to
an image (default is 2 pixels) aperture photometry is used in- a standard magnitude system using Eq. 4. For a given image,
stead. AutoPhOT will search for a catalog covering the field of inter-
Figure 5 illustrates the process of building a PSF model in est with the correct filters available. Alternatively, the User can
AutoPhOT. Bright isolated sources are located and fitted with an specify their desired catalog, or provide a custom catalog for the
analytical function (first panel). The best fit location is noted and field.
the analytic model is subtracted to leave a residual image (second Fig. 7 illustrates how sources are identified in an image to
panel). The residual image is resampled onto a finer pixel grid determine the zeropoint as well to build the PSF model. In this
and shifted (third panel and fourth panel). The compound (ana- example a local region 3′ around the target position is selected. If
lytic and residual) PSF model is then normalized to unity. This the image contained many sources, this can reduce computation
process is repeated for several (typically ∼ 10 sources) bright times considerably.
isolated sources, to create an average residual image. The final We show the zeropoint calibration for the image shown in 7
step is to resample the average residual image back to to the orig- in Fig. 8. In this example we include sigma-clipping (see Sect.
inal pixel scale. We ensure flux in conserved during this process. 2.7) to remove any outliers as well as a S/N cutoff. The result
Our final PSF model is then simply: shows a distribution with a well defined peak which is used as
the zeropoint for this image.
Fig. 5. Demonstration of the steps taken to build residual table for PSF photometry. Bright isolated sources are located as in Sect. 2.7. A cutout
is taken around the source, and an analytical function is fitted and subtracted. The image is then resampled to a finer pixel grid (default: ×10).
The residual image is then rolled (discretely shifted along x and y) such that the location of best fit is at the image center. This is repeated for
several bright isolated sources to obtain an average residual. This figure can be produced in AutoPhOT using the plots_PSF_model_residual
command.
Best fit Fitted FWHM [5.905 pixels] 1D projection Background Fit PSF
0 10 20 30 40 0 10 20 30 40
1.7
1.8
1.9
1.7
1.8
1.9
40 40 40
35 35 35
30 30 30
25 25 25
Y Pixel
20 20 20
15 15 15
10 10 10
5 5 5
0 0 0
Counts [103 ] Counts [103 ]
Counts [103 ]
Counts [103 ]
1.8 1.8
1.6 1.6
0 10 20 30 40 0 10 20 30 40
X Pixel X Pixel
Fig. 6. Example of PSF subtraction. The main panels show a cutout of the transient location before (left) and after (right) PSF subtraction, while
projections along the x and y axis are also shown for each panel. The source is cleanly subtracted and there is no sign of a residual in the subtracted
panel. This figure is can be reproduced using the plot_PSF_residuals command.
term for each instrument individually to a produce a homoge- telescope must be known. This can be found using stars in the
neous dataset. field with standard magnitudes in literature to determine the ef-
We demonstrate the effect of neglecting any colour informa- fect of stellar color i.e. the fitted line given in Fig. 9. The slope
tion when determining the zeropoint of an image in Fig. 9 and of this line (CT BV ) is then used to correct for the zeropoint for
Fig. 10. A clear discrepancy is seen and is correlated with the each image where appropriate color information is available. As
color of the sequence stars used; in this case, the zeropoint under we have more unknowns variables than known, we can iterate
represents blue sources and slightly overestimates redder sources through Eq. 7 to solve for the true, color corrected magnitude.
by ∼ 0.1-mag. In Fig. 10, we see a shift of ∼ 0.1-mag in the ze-
ropoint magnitude as well as smaller scatter among sources in
the field.
MT rue, B, i = minst, B + ZPB + CT B,BV (MT rue, B, i−1 − MT rue, V, i−1 )
For transient measurements, observations in two closely
spaced filters are required e.g. B-V, taken at approximately the MT rue, V, i = minst, V + ZPV + CT V,V B (MT rue, B, i−1 − MT rue, V, i−1 )
same time. Additionally the color term of the instrument and (7)
Article number, page 7 of 16
A&A proofs: manuscript no. autophot
Local Radius [592 px] Target: SN 2018cow Before clipping After clipping [3 ] Mean PDF
Recentering [36] PSF Sources [5]
Sequence Stars [36] 14 14
12 12
1750
10 10
1500
8
Probability Density
8
1250 25.0 27.5 30.0 32.5
Zeropoint Magnitude [mag]
6
1000
12
4
750
10
2
500
8
0
250 26.8 27.0 26.9 27.0
Zeropoint [mag] Zeropoint [mag]
0
0 250 500 750 1000 1250 1500 1750 Fig. 8. Zeropoint diagnostic plot from AutoPhOT. Left panels show
X Pixel zeropoint measurements before (upper left) and after (lower left) a 3σ
clipping. Upper left panel shows a skewed tail for fainter instrumental
Fig. 7. Demonstration of source detection for catalog sources. PSF stars magnitudes (notice the different y-axis between the two subplots). Right
(blue circles) are selected on the basis of their brightness and isolation. panel shows zeropoint distribution with a probability density function
In this example we only consider sources close to the transient location with a well defined peak.
(< 3′ )
f(x) = 0.167+0.015
0.016 x 0.106 0.013
+0.013
The above equation demonstrates the process of applying a Binnned Data
colour correction to two measurements in filters B and V. Both 0.3
filters have a colour term known a priori, where CT B,BV is the
slope of MB - MV v.s. MB - MB,inst and similarly for CT B,BA . For 0.2
convenience and stability, AutoPhOT solves for the color term
Mg, Cat Mg, Inst ZPg
0.25
Mλ,corrected = Mλ + κλ · sec(z) (9) 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6
where Mλ is the magnitude in a given filter, λ, κλ is the extinction Mg, Cat Mr, Cat
coefficient in magnitudes per unit airmass and sec(z) is simply
the secant of the zenith angle z. Taking account of the airmass Fig. 9. Demonstration of the effect of point source colour on zeropoint
correction is particularly necessary when calibrating photome- calibration. X-axis shows the catalog colour of sources, while the Y-
try to standard fields (e.g. Landolt 1992). An observer may wish axis shows the g-band magnitudes minus their instrumental magnitude
to obtain a more precise set of sequence stars for their transient and image zeropoint. Red squares are binned magnitudes with errorbars
equal to the standard deviation of magnitudes in each bin. The solid
measurements. This will involve observing a standard field on a
black line shows the best fit using EMCEE (Foreman-Mackey et al.
night that is photometric, as well as the transient location. The 2013). The lower panel shows the same points with the color correction
zeropoint measurements of the standard field will be at a dif- applied.
ferent airmass than the transient. Using Eq. 9, and the standard
field measurement, an observer can perform photometry on a set
Article number, page 8 of 16
S. J. Brennan & M. Fraser: The AUTOmated Photometry Of Transients pipeline
0.2 0.2
Mz Mz, cat [ mag ]
0.0 0.0
0.2 0.2
14 15 16 17 18 19 20 0 2 4
Mz, cat [ mag ] Limit = 19.4 [ mag ] Probability Density
Fig. 11. Difference between measured magnitude versus catalog magnitude for sequence sources in an image. We adopt a 3σ threshold for source
detection corresponding to δ(M) ≈ 0.31 mag using Eq. B.2.
FUL,
bkg
bkg
bkg
0.004
= 0.75
Mlim 21.8[mag]
0.002 0.4 40%
Counts
0 0 10 10
20
20 20
0 0 0
10 20 10 20 0 20 40 0 10 20 0 10 20
25.5
25.0
0.2
MAP [mag]
0.0
24.5
0.1
24.0 0.2
s
Transient Images Time taken [hr] Time per image [ image ] Mean Residual [mag] Mean Error Residual [mag]
AT 2018cow 187 3.32 64 0.041 0.008
SN 2016iae 259 4.69 65 0.007 0.020
SN 2018coi 25 0.35 34 0.011 0.039
Table 1. Performance of AutoPhOT computing r-band lightcurves from Fig. [Link] for AT 2018cow was performed using template sub-
traction and aperture photometry (similar to the Perley et al. 2018, although a custom host subtraction pipeline was used in this case.), whereas SN
2016coi (Prentice et al. 2018a) and 2016iae (Prentice & Mazzali 2017) were reduced without subtraction using both PSF and aperture photometry
where appropriate. Photometry performed using a 2017 MacBook Pro, using a 2.5 GHz Intel Core i7 processor with 8 Gb DDR3 RAM.
17
18
19
20
25
20
15
SNR
10
5 SNR = 3
0
22 21 20 19 18 17
Catalog Magnitude [mag]
Literature AutoPHoT
15 AT 2018cow 0.2 AT2018cow
Apparent Magnitude [mag]
Mag [ mag ]
16 0.0
17 0.2
18 0 10 20 30 40
19
0.2
Magerr [ mag ]
20
0.0
21
0.2
0 10 20 30 40 0 10 20 30 40
MJD - 58286.9 [days]
14 0.2
SN 2016coi SN2018coi
Apparent Magnitude [mag]
Mag [ mag ]
15 0.0
0.2
16 0 25 50 75 100 125 150 175
17
0.2
Magerr [ mag ]
18
0.0
19 0.2
0 25 50 75 100 125 150 175 200 0 25 50 75 100 125 150 175
MJD - 57549.2 [days]
SN 2016iae 0.2 SN2016iae
Apparent Magnitude [mag]
Mag [ mag ]
16 0.0
0.2
17 0 10 20 30 40 50 60 70 80
0.2
Magerr [ mag ]
18
0.0
19 0.2
0 10 20 30 40 50 60 70 80 0 10 20 30 40 50 60 70 80
MJD - 57711.0 [days]
Fig. 17. r-band light curves produced by AutoPhOT compared to those found in literature. AutoPhOT points are given as points with error bars and
literature values given as shaded band with width equal to the error at each point. In descending order, we compare the output from AutoPhOT for
AT 2018cow (Perley et al. 2018; Prentice et al. 2018b) using template subtraction and aperture photometry, SN 2016coi (Prentice et al. 2018a) and
SN 2016iae (Prentice & Mazzali 2017) without subtraction using both PSF and aperture photometry. Center panels compare both measurements
with the upper panel showing the difference between measurements (∆ Mag = AutoPhOT − literature) and lower panel showing the difference in
error (∆ Magerr = AutoPhOTerr − literatureerr ) for each transient. Right panels highlight the site of the transient event.
[Mag Airmass 1 ]
at different airmasses. Fitting a slope to the data should show , Rayleigh + , Ozone + , Aerosol [2600m]
a clear trend of zeropoint magnitude versus airmass, being more
extreme in the bluer bands than in the red. AutoPhOT can accept 10 1
Listing 2. Example of AutoPhOT execution used to produce the Appendix D: Computing flux upper limits
lightcurve for SN 2016iae in Fig. 17.
As a transient fades to a magnitude which is comparable to the
background brightness, it is necessary to compute detection cri-
# Import AutoPhoT package teria to determine whether a measured flux can be confidently
import autophot associated with the transient. Detection significance is usually
defined in terms of the maximum probability of a false positive
# Load command dictionary (a spurious detection of background noise), which we define as
from autophot.prep_input import load α. Alpha can also be related to σ, e.g. a 3σ upper limit will cor-
autophot_input = load() respond to a 0.135% probability (i.e. α) of a false positive.
As part of AutoPhOT, we include a false negative criteria,
# location of work directory β, which signifies the fraction of real sources that go undetected.
autophot_input[’wdir’] = ’/Users/seanbrennan/ This β value can be defined in terms of a flux upper limit, fUL ,
,→ Desktop/autophot_db’ which indicates the maximum incompleteness of a sample of
sources with f source = fUL . In other words, 100(1 − β)% of
# Location of fits images for SN2016iae the sources with flux fUL will have flux measurements with a
autophot_input[’fits_dir’] = ’/Users/seanbrennan S /N > nσ. We follow the discussion of FUL in Masci (2011)
,→ /Desktop/SN2016iae’ and further detailed in Kashyap et al. (2010). We describe the
probability of detection as β′ = 1 − β, which we want to max-
# IAU name of target for TNS retrieval imise. The probability of detecting a source with a f source = ful
autophot_input[’target_name’] = ’2016iae’ can be written as:
texp , and D are taken from the image header, if available while the Using Eq. D.2, we see that using the common fUL = 3σbkg gives
remaining terms are calculated during the photometric reduction. a β’ of 50%, which means that roughly half of the sources in-
Additionally we must consider the error associated with the jected at f source = 3σbkg will go undetected. For 95% percent
fitting process itself. If PSF photometry is performed, we in- confidence that a source is genuine for S/N = 3, Eq. D.2 gives an
clude an error estimate from artificial star experiments similar to value for fUL ≈ 5σbkg .
those in SNOoPY. If the User desires this additional error anal- We demonstrate the applicability of this β criteria in Fig. D.1.
ysis, an artificial source with the same magnitude as the target We inject artificial sources in an empty part of the sky, and while
star, is placed in the PSF-subtracted residual image in a position noting the injected source parameters, we assess whether or not
close to the real source (e.g. lower left panel of Fig. 13). The in- the sources can be recovered to an appropriated S/N, see caption
jected sources are then recovered using an identical fitting pro- of Fig. D.1 for further details.
cedure. The standard deviation of measurements is taken as an AutoPhOT defaults to β′ = 0.75 to provide a conservative
estimate of the instrumental magnitude error. This is combined upper limit to any reported limiting magnitudes. The User may
(in quadrature) with the PSF-fit error returned by LMFIT to give also opt for a more traditional detection criteria of using the
δ minst . S /N > n where n is the level above σbkg .
At the time of writing, AutoPhOT is only concerned with
these terms given in Eq. B.1 as these terms are expected to dom-
inate. Acknowledgements
SJB would like to acknowledge the support of Science Founda-
tion Ireland and the Royal Society (RS-EA/3471). MF is sup-
ported by a Royal Society - Science Foundation Ireland Univer-
Appendix C: Execution Example sity Research Fellowship. We thank Simon Prentice for sharing
data for AT 2018cow, SN 2016coi, and SN 2016iae, and com-
In listing. 2 we provide a snippet of code that will execute Au-
ments on AutoPhOT during its early phase of development. We
toPhOT on a dataset27 .
thank Kim Phan for correcting an error with the color term cor-
rect. We thank Emma Callis, Robert Byrne, Beth Fitzpatrick,
27
Example of AutoPhOT’s execution can be found at https:// Shane Moran, Kate Maguire, and Lluís Galbany for their com-
[Link]/Astro-Sean/autophot ments and feedback while AutoPhOT was under development.
Article number, page 15 of 16
A&A proofs: manuscript no. autophot
fsource 3.7
fsource 3.0
Kashyap, V. L., van Dyk, D. A., Connors, A., et al. 2010, The Astrophysical
50% 25% Journal, 719, 900–914
0% Landolt, A. U. 1992, AJ, 104, 340
6 5 4 3 2 Lang, D., Hogg, D. W., Mierle, K., Blanton, M., & Roweis, S. 2010, The Astro-
25% nomical Journal, 139, 1782–1800
Theoretical ( )
Lauer, T. R. 1999, Publications of the Astronomical Society of the Pacific, 111,
Measured (CCD eq)
0% 1434
Masci, F. 2011, Computing flux upper-limits for non-detections
25 Massey, P. & Davis, L. 1992, Pdf, 112, 211
20 McCully, C. & Tewes, M. 2019, Astro-SCRAPPY: Speedy Cosmic Ray Annihi-
S/NCCD
References
Alard, C. & Lupton, R. H. 1998, ApJ, 503, 325
Astropy Collaboration, Price-Whelan, A. M., SipHocz, B. M., et al. 2018, aj,
156, 123
Astropy Collaboration, Robitaille, T. P., Tollerud, E. J., et al. 2013, A&A, 558,
A33
Becker, A. 2015, HOTPANTS: High Order Transform of PSF ANd Template
Subtraction
Beroiz, M. I. 2019, Astrophysics Source Code Library
Bertin, E. & Arnouts, S. 1996, A&AS, 117, 393
Brennan, S. J., Fraser, M., Johansson, J., et al. 2021a, arXiv e-prints,
arXiv:2102.09572
Brennan, S. J., Fraser, M., Johansson, J., et al. 2021b, arXiv e-prints,
arXiv:2102.09576
Chen, T. W., Brennan, S. J., Wesson, R., et al. 2021, arXiv e-prints,
arXiv:2109.07942
Craig, M., Crawford, S., Seifert, M., et al. 2017, astropy/ccdproc: v1.3.0.post1
Foreman-Mackey, D., Hogg, D. W., Lang, D., & Goodman, J. 2013, Publications
of the Astronomical Society of the Pacific, 125, 306–312
Fraser, M., Stritzinger, M. D., Brennan, S. J., et al. 2021, arXiv e-prints,
arXiv:2108.07278
Harbeck, D.-R., McCully, C., Pickles, A., et al. 2018, Long-Term Monitoring of
Throughput in Las Cumbres Observatory’s Fleet of Telescopes
Hayes, D. S. & Latham, D. W. 1975, ApJ, 197, 593
28
[Link]
29
[Link]
30
[Link]