0% found this document useful (0 votes)
71 views16 pages

Automated Photometry for Transients

The AUTOmated Photometry Of Transients (AutoPhOT) is a new Python 3-based pipeline designed for rapid, high-quality photometry of transient astronomical events. It offers features such as aperture and PSF-fitting photometry, template subtraction, and calibration against survey catalogs, while minimizing human intervention. AutoPhOT has been shown to effectively reproduce lightcurves from published literature, demonstrating its reliability and efficiency for astronomers studying transient phenomena.

Uploaded by

waffle
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
71 views16 pages

Automated Photometry for Transients

The AUTOmated Photometry Of Transients (AutoPhOT) is a new Python 3-based pipeline designed for rapid, high-quality photometry of transient astronomical events. It offers features such as aperture and PSF-fitting photometry, template subtraction, and calibration against survey catalogs, while minimizing human intervention. AutoPhOT has been shown to effectively reproduce lightcurves from published literature, demonstrating its reliability and efficiency for astronomers studying transient phenomena.

Uploaded by

waffle
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Astronomy & Astrophysics manuscript no.

autophot ©ESO 2023


September 7, 2023

The AUTOmated Photometry Of Transients pipeline


AutoPhOT
S. J. Brennan1 and M. Fraser1

1
School of Physics, O’Brien Centre for Science North, University College Dublin, Belfield, Dublin 4, Ireland

Received XXX ; accepted XXX

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

1. Introduction ipeline (Mommert 2017), that mainly perform aperture photom-


etry on ground based images.
For over three decades, the most commonly used packages for
Photometry tools have also been developed as part of AS-
photometry are part of the Image Reduction and Analysis Fa-
TROPY (Astropy Collaboration et al. 2013, 2018), which is a
cility (IRAF)1 (Tody 1986, 1993). Within IRAF, DAOPHOT
community led project to develop a set of core software tools for
(Stetson 1987) is a suite of packages designed to perform pho-
astronomy in Python 3.
tometry in crowded fields (i.e when sources are closely spaced
together). In this paper we present the AUTOmated PHotometry of
Transients Pipeline (hereafter refereed to as AutoPhOT). Au-
In 2013, the National Optical Astronomy Observatories
toPhOT was designed to provide a fast, precise, and accurate
(NOAO) suspended further development of IRAF, and since
means to measure the magnitude of astronomical point sources
then a community of astronomers has worked on maintaining the
with little human interaction. The software has been built from
packages and adapting the current version (V2.16 / March 22,
the ground up, removing any dependence on the commonly used
2012) to work on modern hardware. However, a large portion of
IRAF or any deprecated Python packages (for example those
IRAF code cannot be compiled as a 64-bit executable, and must
that rely on Python 2).
be built as a 32-bit program. Recently, several popular operat-
ing systems (e.g. MacOS) have dropped 32-bit support, which AutoPhOT is designed to address some of the specific needs
is required for IRAF. With continued development, as well as to astronomers working of transient phenomena such as super-
the emergence of new programming languages, IRAF has be- novae. Observational campaigns for transients often yield het-
come more and more difficult to build and maintain on current erogeneous datasets, which include images spanning several
architectures. Furthermore, PyRAF (Science Software Branch at nights to decades, taken in a variety of photometric bands, and
STScI 2012), the main Python 2.7 wrapper for IRAF, has lost using different telescope and instrument configurations. For pre-
support and, as of January 1 2020, Users have been encourage to cise photometry, careful extraction of photometric data is re-
move to the currently supported Python 3 framework. quired. However, the effect of different instruments and slightly
Besides IRAF/ DAOPHOT there are a number of other pho- different filter throughputs can increase the overall scatter in
tometry packages in use today. SExtractor (Bertin & Arnouts photometric data. Furthermore, photometry performed by dif-
1996) is a source detection and deblending tool used extensively ferent astronomers may show discrepancies based on the choice
for photometric measurements and is the basis for many mod- of parameters used e.g. quality/number of sequence stars used,
ern photometric pipelines (e.g. Mommert 2017; Merlin et al. aperture size, background subtraction etc.
2019). Other stand-alone photometry packages have been devel- AutoPhOT uses ASTROPY packages extensively. As AS-
oped such as A-PHOT (Merlin et al. 2019) and PhotometryP- TROPY is community driven, widely used, and written in
Python 3, AutoPhOT is likely to have support from these pack-
1 ages for the foreseeable future.
IRAF is distributed by the National Optical Astronomy Observatory,
which is operated by the Association of Universities for Research in As- AutoPhOT can accept astronomical images from most
tronomy (AURA) under cooperative agreement with the National Sci- ground based telescopes and cameras, and will adapt to im-
ence Foundation age quality and/or telescope parameters to provide a homoge-
Article number, page 1 of 16
A&A proofs: manuscript no. autophot

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.

Article number, page 2 of 16


S. J. Brennan & M. Fraser: The AUTOmated Photometry Of Transients pipeline

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.

3.1. Aperture Photometry

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.

Article number, page 4 of 16


S. J. Brennan & M. Fraser: The AUTOmated Photometry Of Transients pipeline

Aperture Background Background Annulus 35


PDF
30 Aperture Correction
40
25

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 ]

Fig. 2. Aperture photometry of an isolated point source showing the


aperture radius (solid red line) as well as the background annulus (faded is then multiplied by 1.5 to allow for any error in centroiding and
regions) and assumed background value (green solid line, taken as the used as new aperture radius for the image.
median annulus value). We also include projections along the X and Y
axes. To account for any discrepancy in aperture size (e.g. missing
flux due to finite aperture size) we employ an aperture correction
to account for noise dominated wings of faint sources, which will
1.0 miss counts due to lower S/N of the PSF wings. A smaller aper-
ture will lead to a larger aperture correction and vice-versa, with
0.8 typical corrections being less ∼ 0.1 mag. This is not necessary if
PSF photometry is used.
SNR (normalised)

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

Article number, page 5 of 16


A&A proofs: manuscript no. autophot

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.

PS F(x, y, A) = M(x0 , y0 , A, FWHM) + R(x0 , y0 , A) (6) 4.2. Color terms


where M is the a 2D Moffat function (or Gaussian function if Along with the zeropoint, it is usually necessary to apply colour
selected) and R is the residual image. We can fix the FWHM to terms when calibrating instrumental magnitudes. Colour terms
the value found for the image as discussed in Sect. 2.7, so the are a consequence of filters and CCDs having a non-uniform
PSF model can be fitted with three parameters, x0 and y0 (the response over the bandpass of a filter. For example, a z-band
centroid of the sources), and A its amplitude. filter may transmit light with wavelengths between 8200 and
We integrate under the analytical model between bounds set 9200 Å. However, if this filter is used with a CCD that has a
by the FWHM and aperture size, and perform aperture photome- much lower quantum efficiency in the red, then we will detect
try on the residual table with the same bounds. This is the counts more counts from a blue source than a red, even if they have the
in a PSF model with amplitude equal to 1. When fitting the PSF same z-band magnitude. This effect, which manifests itself as a
model we implement the same re-sampling technique to allow colour-dependent shift in zeropoint, can be as much as 0.1 mag.
Moreover due to small differences in the effective pass band of
18
As long as the sources are unresolved and not saturated. different observatory filter system, we must determine the color
Article number, page 6 of 16
S. J. Brennan & M. Fraser: The AUTOmated Photometry Of Transients pipeline

Best Fit Image center Regrid Roll


Bright isolated source Subtract Model

Regriding size = x10

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

Instrumental Magnitude [mag]


2000

12 12
1750
10 10
1500
8

Probability Density
8
1250 25.0 27.5 30.0 32.5
Zeropoint Magnitude [mag]
6

Instrumental Magnitude [mag]


Y Pixel

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

corrections using the iterative Jacobi method. We rearrange Eq. 0.1


7 into the form Ax = b which gives:
0.0
+ ZPB
" #" # " #
1 − CT B,BV CT B,BV MT rue, B, i m
= inst, B (8) 0.1
−CT V,V B 1 + CT V,V B MT rue, V, i minst, V + ZPV
This is a quick method to apply a colour correction and typically 0.2
converges in ∼10 iterations.
Mg, Cat Mg, Inst ZPg + CC

4.3. Atmospheric Extinction


We can account for the effect of atmospheric extinction using the 0.25
following:
0.00

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

Fig. 11 we show the difference between the recovered magnitude


ZPg w/ CC : 28.133 +/- 0.022 of sources in an image and their catalog magnitude. The differ-
10 ZPg : 28.260 +/- 0.032 ence is close to zero for the majority of brighter sources, but then
becomes significant for fainter sources with MCatalog > 18.1. Au-
8 toPhOT will calculate the limiting magnitude from the first mag-
Probability Denisty

nitude bin where the difference exceeds a specified threshold (set


6 using the equations in Appendix B). Although this is relatively
straightforward, it can fail in sparse fields, and of course is not
4 feasible when the image is deeper than the catalog.
The second way that AutoPhOT can calculate the limiting
2 magnitude is through what we refer to as the “probabilistic lim-
iting magnitude” illustrated in Fig. 12. We assume that the pixels
0 are uncorrelated, and contain only noise from a uniform back-
27.25 27.50 27.75 28.00 28.25 28.50 28.75 29.00 ground sky. After excising the expected position of the transient,
Zeropoint [ mag ] we proceed to select n pixels at random (where n = πr2 ), and
sum together the counts in these n pixels from a background
Fig. 10. Discrepancy of zeropoint measurements when ignoring color subtracted cutout of the transient location. Repeating this many
correction (black) and including it (red). times for different random sets of n pixels, we obtain a distri-
bution of summed counts (shown in the upper panel in Fig. 12).
We can then ask the question “what is the probability we would
of sequence stars around the transient location and place them obtain this number of counts or greater by chance?”. Setting the
on a standard system. This can be used for future measurements threshold to 3σ, in the example shown we can see that we are
of the transient. unlikely to find a source with more than ∼ 3, 500 counts, and we
There is no trivial way to approximate the extinction at a hence adopt this as our limiting magnitude.
specific telescope site. We provide an approximation which Au- Finally, the most rigorous limiting magnitude is determined
toPhOT uses in Appendix A, although for accurate photometry, though injecting and recovering artificial sources. Using an ini-
the User should provide the known extinction curve for a given tial guess from the probabilistic limiting magnitude described
site. above, artificial sources built from the PSF model (see Sect.3.2)
and with realistic noise are injected in set positions (default
3 × FWHM) around the target location. The magnitudes of
5. Image Subtraction
the injected sources are then gradually adjusted until they are no
If a transient is close to its host nucleus, occurs near another longer recovered by AutoPhOT above 3σ (or some other crite-
point source, or has faded to a level comparable to the back- ria).
ground, it may be necessary to perform difference imaging (e.g. Fig. 13 demonstrates the artificial source injection package.
Alard & Lupton 1998). Difference imaging involves scaling and In this example the image is template subtracted and we use
subtracting a template images (assumed to have no transient the β′ detection criteria (see Appendix D). Starting with an ini-
flux) from a science images, removing a strong bright or host tial guess from the probabilistic limiting magnitude, the injected
contamination. Prior to subtraction images must be precisely magnitude is adjusted incrementally until it meets our detection
aligned (i.e. to subpixel precision), scaled to a common inten- criteria, which it will typically overshoot. The magnitude incre-
sity, and be convolved with a kernel so that their PSFs match. ment is then reversed, using a smaller step size until the detection
Currently, AutoPhOT includes HOTPANTS1920 (Becker criteria is again fulfilled. Sources are deemed lost when where
2015) and PyZogy21 (Zackay et al. 2016) for image subtrac- their individual recovered measurements give a β < 0.75. We
tion. The User can select what package they require, with HOT- take the limiting magnitude to be the magnitude at which 80%
PANTS set as the default. Prior to template subtraction, Au- of sources are lost.
toPhOT aligns the science and template images using WCS
alignment22 or point source alignment23 (Beroiz 2019). Further-
more both images are cropped to exclude any regions with no 7. Testing and validation
flux after alignment. 7.1. Testing of photometry packages
In this section we demonstrate AutoPhOT’s ability to recover
6. Limiting Magnitude the magnitude of sequence stars in the field. As this is a novel
PSF-fitting package, we compare against the aperture photom-
A limiting magnitude is the brightest magnitude a source could
etry package available in AutoPhOT as well as from the well
have and remain undetected at a given significance level. Even
established photometry package DAOPHOT (Stetson 1987).
when a transient is not visible in an image, a limiting magnitude
Fig. 14 shows both aperture and PSF photometry can ac-
can help constrain explosion times in SNe or decay rates of GW
curately determine the magnitude of relatively bright sources
merger events.
(M ⪅ 19 mag). However, at fainter magnitudes, aperture pho-
A relatively crude method to find the limiting magnitude of
tometry can longer performs as well, as seen in the larger scatter.
an image is to attempt to recover known sources in the FoV. In
Incorrect centroiding may become an issue with aperture pho-
19
High Order Transform of PSF ANd Template Subtraction tometry when the source flux is comparable to the background.
20
[Link] PSF photometry can perform much better at fainter magnitudes.
21
[Link] Unlike aperture photometry, the PSF model attempts to measure
22
[Link] shape of a point-like source using more information on the shape
23
[Link] of the PSF.
Article number, page 9 of 16
A&A proofs: manuscript no. autophot

SNR error (3) Median Bins

0.4 Over Luminous 0.4

0.2 0.2
Mz Mz, cat [ mag ]

0.0 0.0

0.2 0.2

0.4 Under Luminous 0.4

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.

Gaussian Fit Pseudo-Counts Encluded areas Injected Source 1.0 100%


Distribution
0.8 80%
1

FUL,

Detection Probability [1- ]


Probability Distribution

bkg

bkg

bkg

0.004
= 0.75

Sources lost [%]


0.6 60%

Mlim 21.8[mag]
0.002 0.4 40%

0.000 0.2 20%


200 100 0 100 200 300
Pseudo-Counts [counts] 0.0 0%
20 21 22
Image - Surface Injected PSF Sources MInjected [mag]

50 50 No fake sources Position: 0 Position: 1


40 20 40 20 20 20
40
30 30
Counts

Counts

0 0 10 10
20
20 20
0 0 0
10 20 10 20 0 20 40 0 10 20 0 10 20

0 0 Randomly Injected sources Position: 2 Position: 3


0 20 40 0 20 40
2 20 20
40 3
Fig. 12. The upper panel shows the distribution of summed counts for 0
20 10 10
a random set of pixels close to the expected source location. Bottom 1
left shows a cutout of the transient location; pixels marked in red are
0 0 0
excluded when creating the distribution. Bottom right is the same image 0 20 40 0 10 20 0 10 20
with injected PSF sources (marked with red circles) with magnitude
equal to the FUL,β=0.75 limiting magnitude,see Appendix. D
Fig. 13. Diagnostic plot from AutoPhOT’s artificial source injection
package. Top panel shows the change in the detection probability (1−β′ )
for artificially injected sources. In this example the sources are consid-
Fig. 15 compares the PSF and aperture photometry from Au- ered lost at β = 0.75 and the detection cutoff is reached when 80% of
toPhOT and DAOPHOT (Stetson 1987). The PSF fitting pack- sources are lost (black line with circles). The leftmost image cutouts
age from AutoPhOT can match the recovered instrumental mag- illustrate locations around the target location before (upper) and after
nitude from DAOPHOT, even at faint magnitudes where the flux (lower) sources were injected randomly at the limiting magnitude. The
from the source becomes comparable to the sky background. remaining four panels demonstrate closes up of these injected sources
Aperture photometry can result in similar magnitudes but suf-
fers from centroiding errors at fainter magnitudes. However for
such low fluxes, PSF-fitting photometry should be used.
We test the effectiveness of the AutoPhOT limiting magni- low the computed upper limit of ∼ 18.5 mag, sources are not
tude packages in Fig. 16. We use a relatively shallow image, and detected. Brighter than ∼ 18.5 mag, we recover sources at mag-
a reference catalog containing fainter sources. We see that be- nitudes consistent with their catalog values.
Article number, page 10 of 16
S. J. Brennan & M. Fraser: The AUTOmated Photometry Of Transients pipeline

25.5

25.0
0.2
MAP [mag]

Minst, DAOPHOT [mag]


0.1
24.5
0.0
0.1
24.0
0.2
25.5
0.1

MPSF, Err [mag]


25.0
MPSF [mag]

0.0

24.5
0.1

24.0 0.2

Minst, DAOPHOT [mag]


14 15 16 17 18 19 20 21 22 23
0.1
Mcat [mag]
0.0
0.1
Fig. 14. Demonstration of recovered magnitude using aperture photom-
etry (upper panel) and the PSF-fitting package (lower panel) from Au- 0.2
toPhOT. Y-axis shoes the derived zeropoint magnitude for each source. 0.1
Solid lines show a moving mean value with dashed lines indicating the

MAP, Err [mag]


standard deviation in each bin. Horizontal errorbars show the uncer-
tainty on catalog magnitudes, vertical errorbars are uncertainties on re- 0.0
covered magnitudes from AutoPhOT.
0.1
11 10 9 8 7 6 5 4
7.2. Performance Minst, AutoPHoT [mag]

Fig. 17 shows a comparison of AutoPhOT photometry against


published lightcurves in the literature for three transients found Fig. 15. Comparison of measured instrumental magnitude using
in three different environments, namely AT 2018cow (Perley DAOPHOT and AutoPhOT. The upper two panels show the difference
et al. 2018; Prentice et al. 2018b), SN 2016coi (Prentice et al. in recovered magnitude using PSF-fitting photometry with AutoPhOT
2018a) and 2016iae (Prentice & Mazzali 2017). AutoPhOT was and DAOPHOT, and the difference in error. The lower two panels show
run on the same data as used in the referenced publications, and the same but for aperture photometry. In each case the x-axis gives the
while a combination of techniques was used for each transient instrumental magnitude from AutoPhOT. The same aperture radius was
(i.e. template subtraction, PSF-fitting and aperture photometry) used in all cases. For the first and third panel, the errorbars are the com-
as detailed in the caption, in all cases this was run without human bination of (added in quadrature) uncertainties from both AutoPhOT
and DAOPHOT. In panels two and four, the y axis shows DAOPHOT
intervention.
err - AutoPhOT err (i.e. the uncertainties from AutoPhOT are slightly
We report several diagnostic parameters for these three tran- smaller than those returned by DAOPHOT for faint sources).
sients in Tab. 1, including execution time. The most time con-
suming step is matching and fitting sequence stars to determine
the zeropoint. This can be addressed by limiting the region where simple photometry without the need to maintain local software,
sequence sources are measured or providing AutoPhOT with a as well as easy command line access. Additional functionality
list of sources to use. will allow for calibrated photometry using standard fields obser-
vations. Further releases of AutoPhOT will include additional
corrections such as spatially varying PSF models and potentially
8. Conclusions and Future Development S-corrections (Stritzinger et al. 2002).
We present our photometry pipeline, Automated Photometry of The pipeline is publicly available and detailed installa-
Transients (AutoPhOT), a new publicly available code for per- tion and execution instructions can be found from https://
forming PSF-fitting, aperture and template-subtraction photom- [Link]/Astro-Sean/autophot
etry on astronomical images, as well as photometric calibration.
This code is based on Python 3 and associated packages such
as ASTROPY. With the deprecation of Python 2 and popular
photometry packages within IRAF, AutoPhOT provides accu-
rate photometry with little User setup or monitoring. AutoPhOT
has already been used in several scientific publications (Chen
et al. 2021, Fraser et al. 2021, Brennan et al. 2021a, Brennan
et al. 2021b, Elias-Rosa et al. in prep, and Engrave Collabora-
tion et al. in prep) at the time of writing.
Future work includes adapting to a wider range of images
with irregularities, such as satellite trails, saturated sources, and
CCD imperfections. The AutoPhOT project will also ultimately
include a User-friendly web interface as well as an Application
Programming Interface (API). This will allow for both fast and
Article number, page 11 of 16
A&A proofs: manuscript no. autophot

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.

Upper Limits (Inject) Upper Limits (Prob) Detections


16
Apparent Magnitude [mag]

17

18

19

20
25
20
15
SNR

10
5 SNR = 3
0
22 21 20 19 18 17
Catalog Magnitude [mag]

Fig. 16. Demonstration of inject_sources function. Upper panel: if


the recovered magnitude is less than the magnitude limit, the source
cannot be recovered. Blue points indicate the magnitude of injected
sources. In cases where the source could not be recovered we indicate
the limiting magnitude with a green arrow, otherwise we plot recov-
ered sources as red points. The solid line shows a perfect recovery of
sources. Lower panel: Measured S/N for each source. The horizontal
line highlights a S/N of 3 while the vertical line highlights the approxi-
mate magnitude of sources recovered, set at 18.5 mag.

Article number, page 12 of 16


S. J. Brennan & M. Fraser: The AUTOmated Photometry Of Transients pipeline

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.

Article number, page 13 of 16


A&A proofs: manuscript no. autophot

Appendix A: Atmospheric Extinction Calculation Paranal [2635m] La Silla [2400m]


To deduce the extinction parameters across a range of photomet- Roque de los Muchachos [2396m] Mauna Kea [4207m]
ric filters, one may observe a series of stars throughout a night , Rayleigh + , Ozone [2400m]
100

[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

these values as shown in Code. 1.


If unknown, AutoPhOT makes an rough approximation of 10 2
the extinction due to airmass that relies on the altitude of the tele-
0.10

Difference [Mag Airmass 1 ]


scope site and the wavelength being observed. There are three
main contributors to atmospheric extinction; Rayleigh scattering
0.05
of light by molecules smaller than the wavelength of the scat-
tered light, absorption due to Ozone in the upper atmosphere,
and aerosol extinction by scattering and absorption by parti- 0.00
cles with diameters of the order of the wavelength or larger e.g
dust/ash particles. 0.05
3000 4000 5000 6000 7000 8000 9000 10000
Absorption/scattering by Rayleigh scattering is described by Wavelength [Å]
Hayes & Latham (1975) and is given by:
Fig. A.1. Theoretical atmospheric extinction curves for several sites
−h
αλ,Rayleigh = 0.0094977 · λ−4 · n s (λ)2 · e 7.996 including La Silla 24 , Roque de los Muchachos25 , Paranal(Patat et al.
2011), and Muana Kea26 . We include a match to the Paranal extinction
107.6 0.93161 curve using αλ = αλ,Rayleigh + αλ,Ozone + αλ,Aerosol with b = -2, A0 = 0.05
where n s (λ) = 0.23465 + + ,
146 − λ−2 41 − λ−2 and H0 = 1.5. It is difficult to fit the extinction curve at found at Muana
Kea, likely due to high levels of volcanic dust.
where λ is the effective wavelength of the observation in µm
and h is the altitude above sea level in km. n s (λ) describes the
refractive index of thin incoming light. We take the error from the zeropoint calibration (δZP) to be
Molecular absorption, mainly due to atmospheric ozone and the standard deviation from measurements of sources in the field.
water, can be described by: Prior to this, appropriate sigma clipping and S/N cutoffs are ap-
plied. The error associated with the measurement of the transient
itself (δminst ) requires more attention. The uncertainty in magni-
αλ,Ozone = 1.11 · T Ozone · κOzone (λ) (A.1) tude of a source is related to the S/N ratio as follows:
where T Ozone is the thickness of the Ozone layer above the tele-
scope scope taken at 0 ◦C and 1 atm, and is assumed to be 0.3 cm. minst ± δ minst = −2.5Log10 (S ± N)
κOzone (λ) is the absorption coefficient for Ozone taken from Inn
N
& Tanaka (1953). = −2.5Log10 (S (1 ± ))
By default, AutoPhOT will assume the total atmospheric ex- S
tinction is αλ = αλ,Rayleigh + αλ,Ozone . This can be a suitable ap- N
= −2.5Log10 (S ) − 2.5Log10 (1 + )
proximation for many telescope sites e.g. La Silla and Roque de S
los Muchachos, Fig. A.1. In practice high particulate levels in 1
= −2.5Log10 (S ) − 2.5Log10 (1 + )
the air can account for large discrepancies, especially in the red- S /N
der bands, e.g. Paranal and Mauna Kea. This can be accounted 1 1
for by including the atmospheric extinction due to aerosols. This δ minst = ∓2.5Log10 (1 + ) ≈ 1.0875( ) (B.2)
S /N S /N
is given by:
Where S is the signal from the source and N is the noise as-
−h sociated with it. We find the the error associated with the S/N
αλ,Aerosol = A0 · λ −b
·e Ho (A.2) 1
is ∼ 1.0875( S /N ) using a Taylor expansion. In AutoPhOT, we
define the Signal to Noise Ratio (S/N) using the CCD equation
where A0 is the same extinction for λ=1 µm and b is a coefficient
(Mortara & Fowler 1981; Howell 2006):
dependent on the size of aerosol particles and their size distribu-
tion and H0 is the scale height. The aerosol extinction is the most
variable and problematic. It is left to the User to include this cor- S /N =
rection however with a priori knowledge, it can produce good S ignal
results (e.g. for Paranel in Fig. A.1). F∗ × texp
s
[(F∗ × texp ) + (F sky × texp × n) + (RN 2 + (G2 /4) × n) + (D × n × texp ) ]
Appendix B: Error Calculations S hot noise S ky Noise Read Noise Dark Current noise

The uncertainty on the calibrated magnitude of a source is cal- (B.3)


culated as:
here F∗ is the count rate from the star in e− /s, texp is the exposure
q time in seconds, F sky is the background counts in e− /s/pixel, n
is the number of pixels within an aperture, R is the read noise
δm = δm2inst + δZP2 (B.1)
e− , D is the dark current in e− /s and G is the Gain in e− . R, G,
Article number, page 14 of 16
S. J. Brennan & M. Fraser: The AUTOmated Photometry Of Transients pipeline

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:

# Name of catalog for zeropoint calibration


1 z
autophot_input[’catalog’][’use_catalog’] = ’ β′ = [1 − erf( √ )]
,→ apass’ 2 2
(D.1)
nσbkg − fUL
# Import automatic photometry package where z =
σbkg
from autophot.autophot_main import
,→ run_automatic_autophot
where erf is the error function, n is a set detection limit (default
# Run automatic phototmetry with input to 3 in AutoPhOT) and fUL is a flux upper-limit. Rearranging
,→ dictionary Eq. D.1 gives probabilistic criteria for detection limits:
run_automatic_autophot(autophot_input)

fUL = [n + 2er f −1 (2β′ − 1)]σbkg (D.2)

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

Heasley, J. N. 1999, in Astronomical Society of the Pacific Conference Series,


Vol. 189, Precision CCD Photometry, ed. E. R. Craine, D. L. Crawford, &
100% R. A. Tucker, 56
Howell, S. B. 2006, Handbook of CCD Astronomy, 2nd edn., Cambridge Ob-
100%
Detections with S/N > 3 [%]

serving Handbooks for Research Astronomers (Cambridge University Press)


75% 75% AutoPHoT Cutoff [ ' = 0.75] Inn, E. C. Y. & Tanaka, Y. 1953, J. Opt. Soc. Am., 43, 870
50% ' = 0.5

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

15 lation Package in Python


10 S/NCCD > 3 Merlin, E., Pilo, S., Fontana, A., et al. 2019, A&A, 622, A169
5 S/NCCD < 3 Moffat, A. F. J. 1969, A&A, 3, 455
0
16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 Mommert, M. 2017, Astronomy and Computing, 18, 47–53
Mortara, L. & Fowler, A. 1981, in Society of Photo-Optical Instrumentation En-
Recovered fsource [counts]
gineers (SPIE) Conference Series, Vol. 290, Society of Photo-Optical Instru-
mentation Engineers (SPIE) Conference Series, 28
Fig. D.1. Demonstration of Eq. D.1. We perform artificial source injec- Patat, F., Moehler, S., O’Brien, K., et al. 2011, Astronomy & Astrophysics, 527,
tion on an empty patch of sky. Sources are injected uniformly through- A91
out the image, including sub-pixel placements, with random poisson Perley, D. A., Mazzali, P. A., Yan, L., et al. 2018, Monthly Notices of the Royal
noise added to the PSF prior to injection. In the upper panel, we plot Astronomical Society, 484, 1031–1049
Eq. D.1 versus maximum pixel flux in units of the standard deviation Prentice, S. J., Ashall, C., Mazzali, P. A., et al. 2018a, MNRAS, 478, 4162
of the background noise, as the red curve. The green points show the Prentice, S. J., Maguire, K., Smartt, S. J., et al. 2018b, ApJ, 865, L3
binned S/N ratio using Eq. B.3. In the lower panel we plot the S/N ratio Prentice, S. J. & Mazzali, P. A. 2017, MNRAS, 469, 2672
using Eq. B.3 with the same x-axis as the upper panel. The points are Science Software Branch at STScI. 2012, PyRAF: Python alternative for IRAF
Stetson, P. B. 1987, PASP, 99, 191
coloured blue if S/N > 3 and red if S/N < 3. For the sample of sources
Stritzinger, M., Hamuy, M., Suntzeff, N. B., et al. 2002, The Astronomical Jour-
incrementally injected, Eq. D.1 can reproduce the recovered fraction of nal, 124, 2100–2117
sources. In other words, for sources measured with a f source ≈ 3σbkg , Tody, D. 1986, in Society of Photo-Optical Instrumentation Engineers (SPIE)
roughly half of these are recovered with a S/N > 3; for injected sources Conference Series, Vol. 627, Instrumentation in astronomy VI, ed. D. L.
with f source ≈ 3.7σbkg we detect roughly 75%; while virtually all sources Crawford, 733
are confidently recovered at f source ≈ 4.5σbkg Tody, D. 1993, in Astronomical Society of the Pacific Conference Series, Vol. 52,
Astronomical Data Analysis Software and Systems II, ed. R. J. Hanisch,
R. J. V. Brissenden, & J. Barnes, 173
van Dokkum, P. G., Bloom, J., & Tewes, M. 2012, [Link]: Laplacian Cos-
We thank the Transient Name Server and their open source sam- mic Ray Identification
ple codes28 . This research made use of Astropy29 , a community- Wildey, R. L. 1992, Publications of the Astronomical Society of the Pacific, 104,
developed core Python package for Astronomy (Astropy Col- 285
laboration et al. 2013, 2018). This research made use of data Zackay, B., Ofek, E. O., & Gal-Yam, A. 2016, The Astrophysical Journal, 830,
provided by Astrometry.net30 27

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]

Article number, page 16 of 16

You might also like