-
Notifications
You must be signed in to change notification settings - Fork 1
Reduction Reference
Below is a list of all functions that are part of the reduction module, grouped by filename.
-
preproc.py - preprocessing functions.
- choose_calib - calibration images visualization and selection.
- choose_science - display science images for verification by user.
- mkmaster - make master calibration frames (bias, dark, flat).
-
autoproc.py - automated pipeline script.
- autoproc - main function.
- photopipe/reduction/steps - reduction processing steps.
- autopipedefaults - set commonly used variables to use throughout each step.
-
autopipeprepare - update image headers and performs bias/dark subtraction.
- pipeprepare - Normalize header keywords in FITS files.
- find_sats - Creates a binary image detailing saturated pixels.
-
autopipeimflatten - flatten data using flat with matching filter name.
- flatpipeproc - Check if flat is same size as data, then divide for correct filter.
-
autopipemakesky - combine sky flats based on filter type (sigma clipping for sources).
-
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 portion of array.
-
call_skypipecombine - calls
-
autopipeskysub - subtract both master sky and median.
- skypipeproc - Subtract sky flat from data, then subtract median of that from remaining data.
- autopipeskysubmed - subtract median, does NOT use master sky.
-
autopipecrcleanim - remove cosmic rays.
-
cosmiczap - Remove cosmic rays using Laplacian cosmic ray identification written in
cosmics.py
.
-
cosmiczap - Remove cosmic rays using Laplacian cosmic ray identification written in
-
autopipeastrometry - calculate astrometry of image files to fix WCS coordinates.
-
astrometry - Run
sextractor
andscamp
to refine astrometric solution.
-
astrometry - Run
- autopipezpoint - calculates zero point and flux scale
- autopipestack - stack images with SWarp.
-
autoproc_depend.py - reduction processing dependencies.
- findcals - Locates calibration files.
- write_fits - Creates a FITS file.
-
findsexobj - Find
sextractor
objects with optional inputs. Estimates seeing from stars found. - calc_zpt - Find zeropoint using robust scatter.
- robust_scat - Calculate robust scatter and set the weight of those above this limit to 0.
- identify_matches - Use a kd-tree (3d) to match two lists of stars, using full spherical coordinate distances.
<> pipeprepare(filename, [outname=None, biasfile=None, darkfile=None, verbose=1])
Adds additional header keywords needed later on in the pipeline and removes unnecessary header keywords by looking through a list of mandatory keywords. Also runs bias and dark subtraction for filters with an existing master bias/dark (CCDs). The prepared images are written to disk with outname
.
-
filename
{str or list of str}: Absolute path to FITS file, or list of paths, or file w/list of paths. -
outname
{str, optional}: Specify output file to write to disk. -
biasfile
{str, optional}: Absolute path to bias file. -
darkfile
{str, optional}: Absolute path to dark file. -
verbose
{bool, optional}: Print out comments.
find_sats(filename, data, header)
Uses 'SATURATE' keyword to determine which pixels in the original image are saturated. Creates/saves a binary image of saturated pixels (0: saturated, 1: unsaturated).
-
filename
{str}: Absolute path to FITS file. -
data
{list}: Data array from FITS file. -
header
{list}: Header information form FITS file
<> flatpipeproc(filename, flatname, [flatminval=0, flatmaxval=0])
Checks if flat is same size as data, then divides for correct filter.
-
filename
{str or list of str}: Absolute path to FITS file, or array of paths, or file w/list of paths. -
flatname
{str}: Absolute path to FITS master flat file. -
flatminval
{float, optional}: If not set to 0 below this value will set to NaNs. -
flatmaxval
{float, optional}: If not set to 0 below this value will set to NaNs.
call_skypipecombine(files, outflatname, filt, pipevar)
Ensures at least two frames exist in the filter of the master sky about to be constructed. Calls skypipecombine
to remove multiple instances of the call.
-
files
{str or list of str}: Absolute path to FITS file, or list of paths to be combined into a master sky -
outflatname
{str}: Name for output master flat fits file. -
filt
{str}: Absolute path to filter file. -
pipevar
{dict}: (Input pipeline parameters)[https://github.com/astroumd/photometrypipeline/wiki/autoproc_steps.py#pipeline-input-parameters].
<> skypipecombine(filelist, outfile, filt, pipevar, [removeobjects=None, objthresh=6, algorithm='median', trimlo=None, trimhi=None, mincounts=1, maxcounts=55000, satlevel=30000, type=None])
Create sigma clipped median sky flat. Scales each file based on the overall sigma clipped median, then removes objects selected with sextractor
(uses flux fraction radius) in each file. Removes saturated pixels. Calculates sigma clipped median of each pixel and saves anything with non-finite values (saturated or source) to the median of the entire frame. Save with outfile
name.
-
filename
{str or list of str}: Absolute path to FITS file, or list of paths, or file w/list of paths. -
outfile
{str}: Name for output fits file. -
filt
{str}: Absolute path to filter file. -
pipevar
{dict}: (Input pipeline parameters)[https://github.com/astroumd/photometrypipeline/wiki/autoproc_steps.py#pipeline-input-parameters]. -
removeobjects
{bool, optional}: Specifies if objects should be removed. -
objthresh
{float, optional}: Sets sigma in removeobjects (default is 6). -
algorithm
{str, optional}: Algorithm to solve (mean or median, default ismedian
). -
trimlo
{bool, optional}: Trim off bottom of data in mean algorithm mode (default is 25%). -
trimhi
{bool, optional}: Trim off top of data in mean algorithm mode (default is 25%). -
mincounts
{int, optional}: Sets minimum counts allowed (default is 1). -
maxcounts
{int, optional}: Sets minimum counts allowed (default is 55000). -
satlevel
{int, optional}: Sets saturation level (default is 30000). -
type
{str, optional}: SetsSKYTYPE
keyword in header ofoutfile
to this string.
medclip, sextractor
.
See autoproc_steps.py at line 277.
skypipecombine( files[skyflats],
outflatname,
file,
pipevar,
removeobjects=True,
type='sky' )
masked_interpolation(image, method='nearest')
Interpolates over masked locations
-
image
{np.array}: Array to interpolate over. -
method
{str,optional}: Interpolation method {‘linear’, ‘nearest’, ‘cubic’}
<> skypipeproc(filename, flatname, outfile, [flatminval=None, flatmaxval=None])
Subtracts sky flat from data and then subtracts median of that from remaining data.
-
filename
{str or list of str}: Absolute path to FITS file, or list of paths to be sky subtracted. -
flatname
{str}: Absolute path to sky flat FITS file. -
outfile
{str}: Name for output fits file. -
flatminval
{float, optional}: Minimum required value in flat (default forSKYCTS
calculation is 0.1). -
flatmaxval
{float, optional}: Maximum required value in flat.
<> cosmiczap(filename, outname, [sigclip=6.0, maxiter=3, verbose=True])
Removes cosmic rays using Laplacian cosmic ray identification written in cosmics.py.
-
filename
{str or list of str}: Absolute path to FITS file, or list of paths to be cosmic ray zapped. -
outfile
{str}: Name for output fits file. -
sigclip
{float, optional}: Sigma to clip. -
maxiter
{int, optional}: Maximum number of times to iterate loop. -
verbose
{bool, optional}: Print out comments.
See autoproc_steps.py at line 484.
cosmiczap( file,
outfile,
sigclip=6.0,
maxiter=1,
verbose=pipevar['verbose'] )
<> astrometry(atfimages, [scamprun=1, pipevar=None])
Run sextractor
and scamp
to refine astrometric solution.
-
atfimages
{list of str}: List of absolute paths of images to run throughscamp
. -
scamprun
{int, optional}: The first run does a LOOSE run with distortion degree 1, any other run will look for high distortion parameters, if it finds it will use distortion degree 7, otherwise 3 (will also cut outFLXSCALE
on runs after 1). -
pipevar
{dict}: (Input pipeline parameters)[https://github.com/astroumd/photometrypipeline/wiki/autoproc_steps.py#pipeline-input-parameters].
See autoproc_steps.py at line 619 and line 622.
<> medclip(indata, [clipsig=3.0, maxiter=5, verbose=0])
Median iterative sigma-clipping.
-
indata
{list}: Array to be clipped. -
clipsig
{float, optional}: Sigma to clip around. -
maxiter
{int, optional}: Maximum number of times to clip. -
verbose
{bool, optional}: Print out comments.
See autoproc_depend.py (skypipecombine
) at line 305, line 352.
<> medclip(indata, [clipsig=3.0, maxiter=5, verbose=0, overaxis=0])
Median iterative sigma-clipping.
-
indata
{list}: Array to be clipped. -
clipsig
{float, optional}: Sigma to clip around. -
maxiter
{int, optional}: Maximum number of times to clip. -
verbose
{bool, optional}: Print out comments. -
overaxis
{int, optional}: Axis that we want to take median over.
See autoproc_depend.py (skypipecombine
) at line 377.
findcals(pipevar, file_format_str)
Locates calibration files of a specified type. Files must be in pipevar['caldir'], pipevar['datadir'], or pipevar['imworkingdir'].
-
pipevar
{dict}: Input pipeline parameters. -
file_format_str
{str}: String designating the type of calibration (bias*.fits, dark*.fits, flat*.fits).
write_fits(filename, data, header):
Creates a FITS file with the specified parameters.
-
filename
{str}: Name of file being created. -
data
{list}: Data of FITS file. -
header
{list}: Header information of FITS file.
<> findsexobj(file, sigma, pipevar, [masksfx=None, zeropt=25.0, maptype='MAP_WEIGHT', wtimage=None, fwhm=1.5, pix=0.3787, aperture=5.0, elong_cut=1.5, quite=0])
Finds sextractor
objects with optional inputs. Estimates seeing from stars found.
-
file
{str}: Absolute path to FITS file to runsextractor
on. -
sigma
{float}: Detection threshold and analysis threshold forsextractor
. -
pipevar
{dict}: Input pipeline parameters. -
masksfx
{str, optional}: Identifier forsextractor
CHECKIMAGE_NAME
. -
zeropt
{float, optional}: Input value forsextractor
MAG_ZEROPOINT
. -
wtimage
{str, optional}: Absolute file for input forsextractor
WEIGHT_IMAGE
. -
fwhm
{float, optional}: Input value forsextractor
SEEING_FWHM
. -
pix
{float, optional}: Input value forsextractor
PIXEL_SCALE
. -
aperture
{float, optional}: Input value forsextractor
PHOT_APERTURES
. -
elong_cut
{float, optional}: Cutoff limit forFWHM
calculation of elongation to eliminate non-stars. -
quiet
{bool, optional}: Disable output fromsextractor
.
See autoproc_steps.py (autopipestack
) at line 745, line 935 and line 944.
<> calc_zpt(catmag, obsmag, wts, [sigma=3.0, plotter=None])
Find zeropoint using robust scatter.
-
catmag
{list}: 2d array with catalog magnitudescatmag[nobs,nstar]
. -
obsmag
{list}: 2d array with catalog magnitudesobsmag[nobs,nstar]
. -
wts
{list}: 2d array with weightswts[nobs,nstar]
. -
sigma
{float, optional}: Sigma value for how far values can be from robust scatter value. -
plotter
{str, optional}: Absolute path to save zeropoint plot.
-
z2
- Zeropoint correction. -
scats
- Robust scatter of each observation. -
rmss
- Standard deviation (without bad weight points) of each observation.
See autoproc_steps.py (autopipestack
) at line 844, and line 1039.
<> robust_scat(diff, wts, nobs, nstars, sigma)
Calculate robust scatter and set the weight of those above this limit to 0.
-
diff
{list}: Values to calculate robust scatter over. -
wts
{list}: Weights (0 is bad). -
nobs
{int}: Number of observations to iterate over. -
nstars
{int, optional}: Number of stars to iterate over. -
sigma
{float, optional}: Sigma*robust scatter that is acceptable.
-
scats
- robust scatter of each observation. -
rmss
- standard deviation (without bad weight points) of each observation.
See autoproc_depend.py (calc_zpt
) at line 829.
<> identify_matches(queried_stars, found_stars, [match_radius=3.0])
Use a kd-tree (3d) to match two lists of stars, using full spherical coordinate distances.
-
queried_stars
{list}: Numpy arrays of[ [ra,dec],[ra,dec], ... ]
(all in decimal degrees). -
found_stars
{list}: Numpy arrays of[ [ra,dec],[ra,dec], ... ]
(all in decimal degrees). -
match_radius
{float, optional}: Max distance (in arcseconds) allowed to identify a match between two stars.
See autoproc_steps.py (autopipestack
) at line 790, and line 988.