potpyri.primitives.absphot
Absolute photometry zeropoint calibration using catalog magnitudes.
Queries Vizier (e.g. PS1), matches sources, and fits zeropoint via iterative ODR. Writes ZPTMAG and related keywords to the stack header. Uses multiple Vizier mirrors (CDS, Tokyo, CfA, INASAN, IUCAA, IDIA) with fallback when the first attempt fails. Authors: Kerry Paterson, Charlie Kilpatrick.
Functions
|
Compute and write zeropoint to stack FITS using instrument catalog (e.g. PS1). |
Classes
|
Zeropoint fitter using catalog magnitudes and iterative sigma clipping. |
- class potpyri.primitives.absphot.absphot(iterations=5, sigma=5)[source]
Bases:
objectZeropoint fitter using catalog magnitudes and iterative sigma clipping.
- Y_band(J, J_err, K, K_err)[source]
Compute Y-band mag and error from J and K (2MASS relation).
- Parameters:
J (
array-likeorfloat) – J magnitude(s) and error(s).J_err (
array-likeorfloat) – J magnitude(s) and error(s).K (
array-likeorfloat) – K magnitude(s) and error(s).K_err (
array-likeorfloat) – K magnitude(s) and error(s).
- Returns:
(Y_mag, Y_err).
- Return type:
tuple
- convert_filter_name(filt)[source]
Map instrument filter names to catalog filter names (e.g. PS1).
- Parameters:
filt (
str) – Instrument filter keyword (e.g. ‘gG0301’, ‘RG850’).- Returns:
Catalog filter name (‘u’, ‘g’, ‘r’, ‘i’, ‘z’, ‘J’, etc.).
- Return type:
str
- find_zeropoint(cmpfile, tel, match_radius=<Quantity 2.5 arcsec>, phottable='APPPHOT', input_catalog=None, log=None)[source]
Compute zeropoint from cmpfile photometry and catalog; write to FITS header.
Matches sources to catalog (e.g. PS1), runs iterative ODR fit, and updates ZPTMAG, ZPTNSTAR, ZPTCAT, etc. in the stack FITS.
- Parameters:
cmpfile (
str) – Path to stacked/comparison FITS with SCI and phottable extensions.tel (
Instrument) – Instrument instance (for get_catalog).match_radius (
astropy.units.Quantity, optional) – Matching radius for catalog. Default is 2.5 arcsec.phottable (
str, optional) – FITS extension with photometry table. Default is ‘APPPHOT’.input_catalog (
astropy.table.Table, optional) – Pre-loaded catalog; if None, catalog is queried via get_catalog.log (
ColoredLogger, optional) – Logger for progress.
- Returns:
cmpfile is updated in place.
- Return type:
None
- get_catalog(coords, catalog, filt, log=None)[source]
Query VizieR for catalog magnitudes in a filter around given coordinates.
- Parameters:
coords (
astropy.coordinates.SkyCoord) – Target coordinates (used for region size).catalog (
str) – Catalog name (e.g. ‘PS1’, ‘2MASS’).filt (
str) – Filter name (e.g. ‘g’, ‘r’, ‘J’).log (
ColoredLogger, optional) – Logger for progress.
- Returns:
(astropy.table.Table, catalog_name, catalog_ID) or (None, None, None) if query fails.
- Return type:
tupleor(None,None,None)
- get_minmag(filt)[source]
Return minimum catalog magnitude to use for zeropoint (bright limit).
- Parameters:
filt (
str) – Filter name.- Returns:
Minimum magnitude (brighter limit).
- Return type:
float
- get_zeropoint(flux, fluxerr, mag, magerr)[source]
Fit zeropoint (and error) from flux/mag arrays using ODR.
- Parameters:
flux (
array-like) – Object fluxes (e.g. from aperture photometry).fluxerr (
array-like) – Flux errors.mag (
array-like) – Catalog magnitudes.magerr (
array-like) – Catalog magnitude errors.
- Returns:
(zeropoint, zeropoint_error).
- Return type:
tupleoffloat
- zpt_iteration(flux, fluxerr, mag, magerr, log=None)[source]
Iteratively sigma-clip and fit zeropoint via ODR.
- Parameters:
flux (
array-like) – Object fluxes.fluxerr (
array-like) – Flux errors.mag (
array-like) – Catalog magnitudes.magerr (
array-like) – Catalog magnitude errors.log (
ColoredLogger, optional) – Logger for progress.
- Returns:
(zeropoint, zeropoint_error, master_mask). master_mask is boolean array of sources used in final fit.
- Return type:
tuple
- potpyri.primitives.absphot.find_zeropoint(stack, tel, log=None)[source]
Compute and write zeropoint to stack FITS using instrument catalog (e.g. PS1).
- Parameters:
stack (
str) – Path to stacked science FITS file (SCI + APPPHOT extensions).tel (
Instrument) – Instrument instance (for catalog and filter).log (
ColoredLogger, optional) – Logger for progress and errors.
- Returns:
Stack FITS is updated in place with ZPTMAG, ZPTNSTAR, etc.
- Return type:
None