-
Notifications
You must be signed in to change notification settings - Fork 1
Steps
- prepare.py - Normalize header keywords and subtract master bias and dark frames.
- flatten.py - Divides by master flat.
- makesky.py - Creates sigma clipped median master sky flat.
- skysub.py - Subtracts master sky and median of sky.
- crclean.py - Removes cosmic rays
- astrometry.py - Fixes WCS coordinates.
- zpoint.py - Calculates zero point and flux scale.
- stack.py - Stacks frames using Swarp.
Prepares the data by converting the multi-header extension FITS files to a standard single frame, adding extra information to the header, and removing extraneous headers. Creates a binary image containing detailing the saturated pixels for each frame. Then preforms bias and dark subtraction via master bias and master dark files.
In: raw object files in selected folder (*.fits
), master bias (bias_*.fits
) , (if applicable) master dark (dark_*.fits
).
Out: bias and dark subtracted frames (p*.fits
), binary saturation image (SAT_*.fits
).
- autopipedefaults - Set commonly used variables to use throughout each step.
- autopipeprepare - Detects master bias/dark and runs
pipeprepare
on valid frames, assigns 'p' prefix.
- pipeprepare - Normalize header keywords in FITS files and performs bias/dark subtraction.
- find_sats - Creates a binary image detailing saturated pixels.
Flattens the data by dividing each image by the flatfield (master flat). A more refined cropping is also done at this stage, depending on the placement of the image area during the run (which is variable.)
In: Bias/dark subtracted frames (p*.fits
), master flat (flat_*.fits
).
Out: Flattened frames (fp*.fits
).

- autopipeimflatten - Detects master flat, calls
flatpipeproc
, appends 'f' prefix.
- flatpipeproc - Check if flat is same size as data, then divide for correct filter.
Makes a master sky for each filter to be used for sky subtraction. If skyflattarg == True
then will construct a master sky for each target/filter combination. A master sky is created by first making a 3D stack of images with the same filter or filter/target. Then it identifies which pixels are considered source pixels and excludes them. Then it take the sigma clipped median pixel by pixel across the stack of images. Any overlapping source pixels across all images are interpolated over.
Note: Master sky keywords are taken from the middle image of the stack of images. Many keywords will not be useful.
In: Flattened frames (fp*.fits
).
Out: Master sky (eg. sky-Z.fits
or sky-Z_GRB180618A.fits
), (if debug == True
) a binary plot detailing which pixels are being masked (sky-*skymask.fits
)

- autopipemakesky - Creates a stack of images by filter or by unique filter/target combinations, calls
call_skypipecombine
.
-
call_skypipecombine - calls
skypipecombine
- skypipecombine - Create sigma clipped median sky flat.
- medclip - Median iterative sigma-clipping.
- medclip2d - Median iterative sigma-clipping over 2d array.
- masked_interpolation - Interpolates over masked locations.
Subtracts out master sky and median if mastersky == True
, or else subtracts only the median. If skyflattarg == True
will search for master sky of the form sky-FILTER_TARGNAME.fits
, or else of the form sky-FILTER.fits
.
In: Flattened frames (fp*.fits
), Master sky (eg. sky-Z.fits
or sky-Z_GRB180618A.fits
).
Out: Sky subtracted frames (sfp*.fits
).

- autopipeskysubmed - Subtracts median, does not use master sky, appends 's' prefix.
- autopipeskysub - Locates appropriate master sky file, calls
skypipeproc
, appends 's' prefix.
- skypipeproc - Subtracts master sky flat from data, then subtracts median of that from remaining data.
Removes cosmic rays using the independent routines cosmics.py that use Laplacian cosmic ray identification. This process can be skipped with nocrclean = True
in autoproc
This can be a time-consuming process.
In: Sky subtracted frames (sfp*.fits
)
Out: Cosmic ray removed frames (zsfp*.fits
).

- autopipecrcleanim - Calls
cosmiczap
, appends 'z' prefix.
-
cosmiczap - Remove cosmic rays using Laplacian cosmic ray identification written in
cosmics.py
.
Solves the astrometry of the field against the best available online catalog
(SDSS/2MASS/PanSTARRs/APASS/USNO-B1.0), using the independent vlt_autoastrometry.py code.
(Also requires sextractor
to be installed.)
Uses two passes of Scamp
for a
secondary correction. Scamp accounts for distortion. Uses higher distortion
parameters if already supplied distortion keywords.
In: Cosmic ray zapped frames (zsfp*.fits
)
Out: Astrometry corrected frames (azsfp*.fits
).

- autopipeastrometry - Calls vlt_autoastrometry.py for initial coordinate correction, calls
astrometry
twice for coordinate refinements, appends 'a' prefix.
-
astrometry - Run
sextractor
andscamp
to refine astrometric solution.
Calculates zero point and flux scale for each field to be used in stacking via a weighted masked median. It first finds sources via sextractor
. Then it constructs a catalogue based off of a either a passed in custom catalogue (customcat
) or creates a catalogue using get_SEDs.py. It identifies and matches the extracted sources and the catalogue sources. Then it removes sources containing saturated pixels using SAT_*.fits
files. Then it calculates the zero point using a robust scatter method. Then it calculates the flux scale and removes frames with a bad zero point or flux scale. This step heavily utilizes methods from autoproc_depend.py.
In: Astrometry corrected frames (azsfp*.fits
), binary saturation image (SAT_*.fits
).
Out: Zero point calibrated frames (tazsfp*.fits
), Coordinates of saturated sources (SATcoords_.txt), (if debug == True
) a plot of difference between catalogue and observed magnitudes before/after zero point calculation ('zptall_.png'/zpt_*.png
) and a histogram of magnitude errors for all observed sources (zptall_hist_*.png
).

- autopipezpoint - Extracts sources via
autoproc_depend/findsexobj
, creates catalogue usingget_SEDs.py
, identifies matches between extracted sources and catalogue viaautoproc_depend/identify_matches
, removes saturated sources, calculates zeropoint usingautoproc_depend/calc_zpt
, calculates flux scale, removes bad frames, appends 't' prefix.
-
autoproc_depend/findsexobj - Find
sextractor
objects with optional inputs. Estimates seeing from stars found. - autoproc_depend/calc_zpt - Find zeropoint using robust scatter.
- autoproc_depend/robust_scat - Calculate robust scatter and set the weight of those above this limit to 0.
- autoproc_depend/identify_matches - Use a kd-tree (3d) to match two lists of stars, using full spherical coordinate distances.
Uses flux scale to stack images using Swarp
. Extracts sources via autoproc_depend/findsexobj
, creates catalogue using get_SEDs.py
, identifies matches between extracted sources and catalogue via autoproc_depend/identify_matches
, reads coordinates of saturated sources from SATcoords_*.txt and removes those sources, calculates the absolute zeropoint using autoproc_depend/calc_zpt
. Saves coadded images.
In: Zero point calibrated frames (tazsfp*.fits
), Coordinates of saturated sources (SATcoords_*.txt).
Out: Coadded images (coadd[object].[filter].fits
), (if debug == True
) a plot of difference between catalogue and observed magnitudes before/after zero point calculation ('zptall_COADD_*.png'/zpt_COADD_*.png
) and a histogram of magnitude errors for all observed sources (zptall_hist_COADD_*.png
).

- autopipestack - Uses flux scale to stack images in
Swarp
, calculates absolute zero point correction, and save Coadded images.
-
autoproc_depend/findsexobj - Find
sextractor
objects with optional inputs. Estimates seeing from stars found. - autoproc_depend/calc_zpt - Find zeropoint using robust scatter.
- autoproc_depend/robust_scat - Calculate robust scatter and set the weight of those above this limit to 0.
- autoproc_depend/identify_matches - Use a kd-tree (3d) to match two lists of stars, using full spherical coordinate distances.