Welcome to legacyzpts’s documentation!¶
Introduction¶
This is the documentation for legacyzpts.
The legacyzpts package/API¶
-
class
legacyzpts.legacy_zeropoints.DecamMeasurer(*args, **kwargs)[source]¶ DECam CP units: ADU Class to measure a variety of quantities from a single DECam CCD.
Image read will be converted to e- also zpt to e-
-
class
legacyzpts.legacy_zeropoints.Measurer(fn, aprad=3.5, skyrad_inner=7.0, skyrad_outer=10.0, det_thresh=8.0, match_radius=3.0, sn_min=None, sn_max=None, aper_sky_sub=False, calibrate=False, **kwargs)[source]¶ Main image processing functions for all cameras.
Parameters: - aprad – Aperture photometry radius in arcsec
- skyrad_inner,skyrad_outer – sky annulus in arcsec
- det_thresh – minimum S/N for matched filter
- match_radius – arcsec matching to gaia/ps1
- sn_min,sn_max – if not None then then {min,max} S/N will be enforced from aperture photoemtry, where S/N = apflux/sqrt(skyflux)
- aper_sky_sub – do aperture sky subtraction instead of splinesky
-
add_ccd_info_to_stars_table(stars, ccds)[source]¶ Adds info to stars table that is inferable from ccd header
Parameters: - stars – the stars table
- ccds – ccds table
-
add_obj_info_to_stars_table(stars, keep, obj, objra, objdec, apflux, apskyflux, apskyflux_perpix)[source]¶ Adds arrays from obj to stars table
Parameters: - stars – the stars table
- keep – bool array of obj indices to include in stars table
- obj –
- objra,objdec,apflux,apskyflux,apskyflux_perpix –
-
create_zero_one_mask(bitmask, good=[])[source]¶ Return zero_one_mask arraygiven a bad pixel map and good pix values bitmask: ood image good: list of values to treat as good in the bitmask
-
do_Astrometry(obj, ref_ra, ref_dec, ccds)[source]¶ Measure ra,dec offsets from Gaia or PS1
Parameters: - obj – ps1-matched sources detected with dao phot
- ref_ra,ref_dec – ra and dec of ther ps1 or gaia sources matched to obj
- ccds – partially filled _ccds_table
Returns: fits table for stars err_message: ‘’ if okay, ‘some error text’ otherwise, this will end up being
stored in ccds[‘err_message’]
Return type: stars_astrom
-
do_Photometry(obj, ps1, ccds, save_xy=False)[source]¶ Measure zeropoint relative to PS1
Parameters: - obj – ps1-matched sources detected with dao phot
- ps1 – ps1 source matched to obj
- ccds – partially filled _ccds_table
- save_xy – if True save a fits table containing ps1_mag and apmag for matches sources and associated photometric cuts
Returns: fits table for stars err_message: ‘’ if okay, ‘some error text’ otherwise, this will end up being
stored in ccds[‘err_message’]
Return type: stars_photom
-
get_photometric_cuts(obj, cuts_only)[source]¶ Do aperture photometry and create a photometric cut base on those measurements
Parameters: - obj – sources detected with dao phot
- cuts_only – the final photometric cut will be returned in either case True to not compute extra things
Returns: two dicts, cuts and phot cuts: keys are [‘good_flux_and_mag’,
’no_badpix_in_ap_0’,’no_badpix_in_ap_0_5’,’is_iso’]
phot: keys are [“apflux”,”apmags”,”apskyflux”,”apskyflux_perpix”]
-
get_zero_one_mask(bitmask, good=[])[source]¶ Convert bitmask into a zero and ones mask, 1 = bad, 0 = good bitmask: ood image good: (optional) list of values to treat as good in the bitmask
default is to use appropiate values for the camera
-
isolated_radec(ra, dec, nn=2, minsep=0.0002777777777777778)[source]¶ return indices of ra,dec for which the ra,dec points are AT LEAST a distance minsep away from their nearest neighbor point
-
return_on_error(err_message='', ccds=None, stars_photom=None, stars_astrom=None)[source]¶ Sets ccds table err message, zpt to nan, and returns appropriately for self.run()
Parameters: - err_message – length <= 30
- stars_photom, stars_astrom (ccds,) – (optional) tables partially filled by run()
-
class
legacyzpts.legacy_zeropoints.Mosaic3Measurer(*args, **kwargs)[source]¶ Class to measure a variety of quantities from a single Mosaic3 CCD. UNITS: e-/s
-
class
legacyzpts.legacy_zeropoints.NinetyPrimeMeasurer(*args, **kwargs)[source]¶ Class to measure a variety of quantities from a single 90prime CCD. UNITS – CP e-/s
-
legacyzpts.legacy_zeropoints._ccds_table(camera='decam')[source]¶ Initialize the CCDs table.
Description and Units at: https://github.com/legacysurvey/legacyzpts/blob/master/DESCRIPTION_OF_OUTPUTS.md
-
legacyzpts.legacy_zeropoints._measure_image(args)[source]¶ Utility function to wrap measure_image function for multiprocessing map.
-
legacyzpts.legacy_zeropoints._stars_table(nstars=1)[source]¶ Initialize the stars table.
Description and Units at: https://github.com/legacysurvey/legacyzpts/blob/master/DESCRIPTION_OF_OUTPUTS.md
-
legacyzpts.legacy_zeropoints.cols_for_converted_zpt_table(which='all')[source]¶ Return list of columns for -zpt.fits table converted to idl names
Parameters: which – all, numeric,
nonzero_diff (numeric and expect non-zero diff with reference when compute it)
-
legacyzpts.legacy_zeropoints.cols_for_legacypipe_table(which='all')[source]¶ Return list of -legacypipe.fits table colums
Parameters: - which – all, numeric,
- (numeric and expect non-zero diff with reference (nonzero_diff) –
- compute it) (when) –
-
legacyzpts.legacy_zeropoints.convert_stars_table(T, camera=None, star_table=None)[source]¶ converts -star.fits table to idl matches table
- Note, unlike converte_zeropoints_table, must treat each band
- separately so loop over the bands
Parameters: - T – legacy stars fits_table, can be a single stars table or a merge of many stars tables
- camera – CAMERAS
- star_table – photom or astrom
-
legacyzpts.legacy_zeropoints.convert_stars_table_one_band(T, camera=None, star_table=None, zp_fid=None, pixscale=0.262)[source]¶ Converts legacy star fits table (T) to idl names and units
-
legacyzpts.legacy_zeropoints.T¶ legacy star fits table
-
legacyzpts.legacy_zeropoints.star_table¶ photom or astrom
-
legacyzpts.legacy_zeropoints.zp_fid¶ fiducial zeropoint for the band
-
legacyzpts.legacy_zeropoints.pixscale¶ pixscale
-
legacyzpts.legacy_zeropoints.expnum2exptime¶ dict mapping expnum to exptime
Example
kwargs= primary_hdr(zpt_fn) T= fits_table(stars_fn) newT= convert_stars_table(T, zp_fid=kwargs[‘zp_fid’], pixscale=kwargs[‘pixscale’])
-
-
legacyzpts.legacy_zeropoints.convert_zeropoints_table(T, camera=None)[source]¶ Make column names and units of -zpt.fits identical to IDL zeropoints
Parameters: T – fits_table of some -zpt.fits like fits file
-
legacyzpts.legacy_zeropoints.create_legacypipe_table(ccds_fn, camera=None)[source]¶ input _ccds_table fn output a table formatted for legacypipe/runbrick
-
legacyzpts.legacy_zeropoints.extra_ccd_keys(camera='decam')[source]¶ Returns list of camera-specific keywords for the ccd table
-
legacyzpts.legacy_zeropoints.get_extlist(camera, fn, debug=False, choose_ccd=None)[source]¶ Parameters: - fn – image fn to read hdu from
- debug – use subset of the ccds
- choose_ccd – if not None, use only this ccd given
Returns: list of hdu names
-
legacyzpts.legacy_zeropoints.get_parser()[source]¶ return parser object, tells it what options to look for options can come from a list of strings or command line
-
legacyzpts.legacy_zeropoints.main(image_list=None, args=None)[source]¶ Produce zeropoints for all CP images in image_list image_list – iterable list of image filenames args – parsed argparser objection from get_parser()
-
legacyzpts.legacy_zeropoints.measure_image(img_fn, run_calibs=False, **measureargs)[source]¶ Wrapper on the camera-specific classes to measure the CCD-level data on all the FITS extensions for a given set of images.
-
legacyzpts.legacy_zeropoints.parse_coords(s)[source]¶ stackoverflow: https://stackoverflow.com/questions/9978880/python-argument-parser-list-of-list-or-tuple-of-tuples