Commit c49fa531 authored by Fang Yuedong's avatar Fang Yuedong
Browse files

add sextractor, psfex config files in csst_msc_mbi_photometry pipeline

parent b4eb2513
......@@ -78,7 +78,7 @@ import astropy.units as u
from .stats import sigmaclip_limitsig, weighted_mean, closest_match
from .mag_flux_convert import fluxerr2magerr
# from csst_common import CsstResult, CsstStatus
# from typing import Optional
from typing import Optional
prog_dir = os.path.dirname(__file__)
config_path = os.path.join(prog_dir, 'data/')
......@@ -269,3 +269,974 @@ def get_psf(imgfile, whtfile, flgfile, psffile, psf_size=101, degree=3, variabil
print(command)
os.system(command)
return True
def photometry(imgfile, whtfile, flgfile, psffile, fluxfile, catfile, skyfile, segfile, detect_thresh=1.0, analysis_thresh=1.0,
clean='Y', nthread=1, head_zpt=None, aper_cor=True, seeing=0.15,
pixel_scale=0.075, phot_type='model', sep=2, star_thresh=0.005, plot_flag=False, zp_name='ZP'):
"""
Perform aperture and model photometry
Parameters:
----------
imgfile: input image
outdir: output directory
detect_thresh: detecting threshold
analysis_thresh: analysis threshold
clean: clean the detections
nthread: number of threads
head_zpt: flux zeropoint
aper_cor: wether do aperture correction
seeing: in arcsec FWHM
pixel_scale: pixel scale in arcsec
phot_type: providing the photometry type, if psf, only perform aperture + psf photometry; if model, perform aperture+psf+model photometry
plot_flag: whether to plot stats
"""
# fitsname,_=os.path.splitext(imgfile)
# indpos=str.rfind(fitsname,'_img')
# fitsname=fitsname[:indpos]
# if outdir is not None:
# if not os.path.exists(outdir):
# os.mkdir(outdir)
# _,rootname=os.path.split(fitsname)
# fitsname=os.path.join(outdir,rootname)
# imgfile = dm.l1_detector(detector=detector, post="IMG.fits")
# whtfile = dm.l1_detector(detector=detector, post="WHT.fits")
# flgfile = dm.l1_detector(detector=detector, post="FLG.fits")
# psffile = dm.l1_detector(detector=detector, post="PSF.fits")
# fluxfile = dm.l1_detector(detector=detector, post="FLUX.fits")
# catfile = dm.l1_detector(detector=detector, post="CAT.fits")
# fitsname = dm.l1_detector(detector=detector, post="")
fitsname, _ = os.path.splitext(imgfile)
sexfile = os.path.join(config_path, 'csst_phot.sex')
covfile = os.path.join(config_path, 'default.conv')
nnwfile = os.path.join(config_path, 'default.nnw')
if phot_type == "psf":
parfile = os.path.join(config_path, 'csst_psfphot.params')
else:
parfile = os.path.join(config_path, 'csst_modphot.params')
# psffile = fitsname+'_psf.fits'
head = fits.getheader(imgfile, 0)
head1 = fits.getheader(imgfile, 1)
head.extend(head1)
if zp_name not in head or head[zp_name] <= 0:
print("No zeropoint in the header or bad zeropoint")
return False
# date=head['date-obs']
# ccd=head['ccd_no']
# get flag and weight images
# flagfile,weightfile=get_flagweght(date,ccd)
# rootname,_=os.path.splitext(imgfile)
# indpos=str.rfind(rootname,'_img')
# flagfile=rootname[:indpos]+'_flg.fits'
# weightfile=rootname[:indpos]+'_wht.fits'
gain = head['exptime']
saturate = 50000.0 / gain
# types = {'sky': 'BACKGROUND', 'seg': 'SEGMENTATION', 'mod': 'MODELS', 'res': '-MODELS'}
# catfile = fitsname+'_fluxadu.fits'
# if checkfiles is None:
# checktype = "NONE"
# checknames = "check.fits"
# else:
# ntypes = len(checkfiles)
# keys = types.keys()
# checktype = "'"
# checknames = "'"
# for i in range(ntypes):
# ikey = checkfiles[i]
# checktype += types[ikey] + " "
# # checknames += fitsname+"_"+ikey+".fits "
# checknames += imgfile.replace(".fits", f"_{ikey.upper()}.fits ")
# checktype += "'"
# checknames += "'"
# checktype="'BACKGROUND -MODELS MODELS -PSFS PSFS'"
# checknames='"'+fitsname+'-bkg.fits '+fitsname+'-submodel.fits '+fitsname+'-model.fits '+fitsname+'-subpsf.fits '+fitsname+'-psf.fits '+'"'
checktype = "'BACKGROUND SEGMENTATION'"
checknames = "'" + skyfile + " " + segfile + "'"
command = 'sex ' + imgfile + ' -c ' + sexfile + ' -CATALOG_NAME ' + fluxfile + ' -FILTER_NAME ' + covfile + ' -STARNNW_NAME ' \
+ nnwfile + ' -DETECT_THRESH ' + str(detect_thresh) + ' -ANALYSIS_THRESH ' + str(analysis_thresh) + ' -CLEAN ' \
+ clean + ' -WEIGHT_IMAGE ' + whtfile + ' -FLAG_IMAGE ' + flgfile + ' -PIXEL_SCALE ' + str(pixel_scale) \
+ ' -SEEING_FWHM ' + str(seeing) + ' -GAIN ' + str(gain) + ' -SATUR_LEVEL ' + str(saturate) + ' -PARAMETERS_NAME ' \
+ parfile + ' -CHECKIMAGE_TYPE ' + checktype + ' -CHECKIMAGE_NAME ' + checknames + ' -PSF_NAME ' + psffile + \
' -NTHREADS ' + str(nthread)
print(command)
os.system(command)
print("FLUXFILE: ", fluxfile)
fluxadu = Table.read(fluxfile)
# calibrate flux and aperture corrections
fluxcalib = calibrate_fluxadu(
fluxadu, head, head_zpt=head_zpt, zp_name=zp_name)
if plot_flag:
plotname = fitsname
else:
plotname = None
# aperture corrections
if fluxcalib is not False and aper_cor is True:
fluxcor = magnitude_correction(fluxcalib, head, elp_lim=0.5, sigma=2.5, plot_name=plotname, magerr_lim=0.1,
sig_limit=0.08, aper_size=[3, 4, 5, 6, 8, 10, 13, 16, 20, 25, 30, 40],
aper_ref=5, class_lim=0.5)
fluxcor = clean_catalog(fluxcor, head, sep=sep,
star_thresh=star_thresh)
# catfile = fitsname+'_cat.fits'
fluxcor.write(catfile, format='fits', overwrite=True)
head['VER_PHOT'] = (__version__, 'version of photometry code')
nt = Time.now()
nt.format = 'isot'
head['SMT_PHOT'] = (nt.value, 'time when photometry ends')
head['STA_PHOT'] = (0, 'status: 0 good, 1 bad')
ind_head = head.index('NEXTEND') + 1
f = fits.open(catfile, mode='update')
f[0].header.extend(head.cards[ind_head:], bottom=True)
f.flush(output_verify='fix+warn')
f.close()
# if os.path.isfile(catfile):
# os.remove(catfile)
return True
def get_pixscale(head, x, y):
""" get pixel size at x, y
Parameters
----------
head: fits.Header
x: float or array
image x coordinate
y: float or array
image y coordinate
Returns
----------
pixscales: float, array
pixel scales in arcsec
"""
y0 = y - 0.5
y1 = y + 0.5
x0 = x - 0.5
x1 = x + 0.5
w = awcs.WCS(head)
ra0, dec0 = w.all_pix2world(x0, y0, 1)
ra1, dec1 = w.all_pix2world(x0, y1, 1)
ra2, dec2 = w.all_pix2world(x1, y1, 1)
ra3, dec3 = w.all_pix2world(x1, y0, 1)
coord0 = SkyCoord(ra0, dec0, frame='icrs', unit='deg')
coord1 = SkyCoord(ra1, dec1, frame='icrs', unit='deg')
coord2 = SkyCoord(ra2, dec2, frame='icrs', unit='deg')
coord3 = SkyCoord(ra3, dec3, frame='icrs', unit='deg')
d0 = coord0.separation(coord1).deg
d1 = coord1.separation(coord2).deg
d2 = coord2.separation(coord3).deg
d3 = coord3.separation(coord0).deg
pixscale = (d0 + d1 + d2 + d3) / 4.0 * 3600.0
return pixscale
def get_radec_error(head, x, y, xerr, yerr):
"""get ra dec error at x, y assuming the xerr and yerr
Parameters
----------
head: fits.Header
fits header
x: float or array
image x coordinate
y: float or array
image y coordinate
xerr: float or array
image x coordinate error
yerr: float or array
image coordinate error
Returns
---------
RAErr: float, array
RA error
DECErr: float, array
DEC error
"""
y0 = y - yerr
y1 = y + yerr
x0 = x - xerr
x1 = x + xerr
w = awcs.WCS(head)
ra0, dec0 = w.all_pix2world(x0, y0, 1)
ra1, dec1 = w.all_pix2world(x0, y1, 1)
ra2, dec2 = w.all_pix2world(x1, y1, 1)
ra3, dec3 = w.all_pix2world(x1, y0, 1)
allra = np.vstack([ra0, ra1, ra2, ra3])
alldec = np.vstack([dec0, dec1, dec2, dec3])
raerr = np.max(allra, axis=0) - np.min(allra, axis=0)
decerr = np.max(alldec, axis=0) - np.min(alldec, axis=0)
mask = raerr > 180
raerr[mask] = -raerr[mask] + 360
return raerr, decerr
def clean_catalog(cat, head, sep=2.0, star_thresh=0.005):
"""clean catalog, including keeping only one kind of coordinate and remove useless columns, rename the columns to the definition of data products
Parameters
----------
cat: catalog table
head: fits.Header
fits header
sep: in pixel, the separation between Windowed/Centroid position
star_thresh: threshold of spread_model to define the stars
Returns
---------
cat: cleaned catalog
"""
# bug in sex
nobj = len(cat)
cat = table.unique(cat, keys=['X_IMAGE', 'Y_IMAGE'])
print('duplicate sources:', len(cat) - nobj)
idx = np.argsort(cat['NUMBER'])
cat = cat[idx]
# fix coordinates
x_cen = np.array(cat['X_IMAGE'])
y_cen = np.array(cat['Y_IMAGE'])
xerr_cen = np.sqrt(cat['ERRX2_IMAGE'])
yerr_cen = np.sqrt(cat['ERRY2_IMAGE'])
ra_cen = np.array(cat['ALPHA_J2000'])
dec_cen = np.array(cat['DELTA_J2000'])
x_win = np.array(cat['XWIN_IMAGE'])
y_win = np.array(cat['YWIN_IMAGE'])
xerr_win = np.sqrt(cat['ERRX2WIN_IMAGE'])
yerr_win = np.sqrt(cat['ERRY2WIN_IMAGE'])
ra_win = np.array(cat['ALPHAWIN_J2000'])
dec_win = np.array(cat['DELTAWIN_J2000'])
x = x_cen.copy()
xerr = xerr_cen.copy()
y = y_cen.copy()
yerr = yerr_cen.copy()
ra = ra_cen.copy()
dec = dec_cen.copy()
mask = (np.abs(x_cen - x_win) < sep) & (np.abs(y_cen - y_win) < sep)
x[mask] = x_win[mask]
xerr[mask] = xerr_win[mask]
y[mask] = y_win[mask]
yerr[mask] = yerr_win[mask]
ra[mask] = ra_win[mask]
dec[mask] = dec_win[mask]
raerr, decerr = get_radec_error(head, x, y, xerr, yerr)
xcol = Table.Column(x, name='X', unit='pix')
xerrcol = Table.Column(xerr, name='XErr', unit='pix')
ycol = Table.Column(y, name='Y', unit='pix')
yerrcol = Table.Column(yerr, name='YErr', unit='pix')
racol = Table.Column(ra, name='RA', unit='deg')
raerrcol = Table.Column(raerr, name='RAErr', unit='deg')
deccol = Table.Column(dec, name='DEC', unit='deg')
decerrcol = Table.Column(decerr, name='DECErr', unit='deg')
cat.add_columns([xcol, xerrcol, ycol, yerrcol,
racol, raerrcol, deccol, decerrcol])
scales = get_pixscale(head, x, y)
# calculating Kron radius in arcsec
k = cat['KRON_RADIUS']
A = cat['A_IMAGE']
B = cat['B_IMAGE']
kronr = k * np.sqrt(A * B) * scales
cat['KRON_RADIUS'] = kronr
cat['KRON_RADIUS'].unit = 'arcsec'
# convert to arcsec
cat['A_WORLD'] *= 3600
cat['B_WORLD'] *= 3600
cat['ERRA_WORLD'] *= 3600
cat['ERRB_WORLD'] *= 3600
cat['FWHM_WORLD'] *= 3600
cat['A_WORLD'].unit = 'arcsec'
cat['B_WORLD'].unit = 'arcsec'
cat['ERRA_WORLD'].unit = 'arcsec'
cat['ERRB_WORLD'].unit = 'arcsec'
cat['FWHM_WORLD'].unit = 'arcsec'
for i in range(3):
cat['FLUX_RADIUS'][:, i] *= scales
cat['SPHEROID_REFF_WORLD'] *= 3600
cat['SPHEROID_REFFERR_WORLD'] *= 3600
cat['SPHEROID_ASPECT_WORLD'] = 1 - cat['SPHEROID_ASPECT_WORLD']
cat['SPHEROID_REFF_WORLD'].unit = 'arcsec'
cat['SPHEROID_REFFERR_WORLD'].unit = 'arcsec'
# effective radius for disk galaxies = 1.67834699 scale length
cat['DISK_SCALE_WORLD'] *= (3600 * 1.67834699)
cat['DISK_SCALEERR_WORLD'] *= (3600 * 1.67834699)
cat['DISK_ASPECT_WORLD'] = 1 - cat['DISK_ASPECT_WORLD']
cat['DISK_SCALE_WORLD'].unit = 'arcsec'
cat['DISK_SCALEERR_WORLD'].unit = 'arcsec'
cols = ['NUMBER', 'X', 'XErr', 'Y', 'YErr', 'RA', 'RAErr', 'DEC', 'DECErr', 'A_WORLD', 'ERRA_WORLD', 'B_WORLD',
'ERRB_WORLD', 'THETA_WORLD', 'FLAGS', 'IMAFLAGS_ISO', 'NIMAFLAGS_ISO', 'FWHM_WORLD', 'ELONGATION',
'ELLIPTICITY', 'FLUX_AUTO', 'FLUXERR_AUTO', 'MAG_AUTO', 'MAGERR_AUTO', 'KRON_RADIUS', 'BACKGROUND']
# re-orgnize aperture photometry and flux radii
naper = 12
flux_aper = cat['FLUX_APER']
fluxerr_aper = cat['FLUXERR_APER']
mag_aper = cat['MAG_APER']
magerr_aper = cat['MAGERR_APER']
for i in range(naper):
col = Table.Column(cat['FLUX_APER'][:, i],
name='Flux_Aper' + str(i + 1), unit='nanomaggy')
cat.add_column(col)
col = Table.Column(cat['FLUXERR_APER'][:, i],
name='FluxErr_Aper' + str(i + 1), unit='nanomaggy')
cat.add_column(col)
col = Table.Column(cat['MAG_APER'][:, i],
name='Mag_Aper' + str(i + 1), unit='mag')
cat.add_column(col)
col = Table.Column(cat['MAGERR_APER'][:, i],
name='MagErr_Aper' + str(i + 1), unit='mag')
cat.add_column(col)
cols.extend(['Flux_Aper' + str(i + 1), 'FluxErr_Aper' + str(i + 1), 'Mag_Aper' + str(i + 1),
'MagErr_Aper' + str(i + 1)])
# star-galaxy separation
gal_type = np.zeros(len(cat), dtype='int32')
mask = np.abs(cat['SPREAD_MODEL']) > star_thresh
gal_type[mask] = 1
col = Table.Column(gal_type, name='Type')
cat.add_column(col)
# rename flux radius
col = Table.Column(cat['FLUX_RADIUS'][:, 0], name='R20', unit='arcsec')
cat.add_column(col)
col = Table.Column(cat['FLUX_RADIUS'][:, 1], name='R50', unit='arcsec')
cat.add_column(col)
col = Table.Column(cat['FLUX_RADIUS'][:, 2], name='R90', unit='arcsec')
cat.add_column(col)
# extract columns to be included in the output catalog
cols.extend(['Type', 'R20', 'R50', 'R90', 'XPSF_IMAGE', 'YPSF_IMAGE', 'ALPHAPSF_J2000', 'DELTAPSF_J2000',
'CHI2_PSF', 'FLUX_PSF', 'FLUXERR_PSF', 'MAG_PSF', 'MAGERR_PSF', 'XMODEL_IMAGE', 'YMODEL_IMAGE',
'ALPHAMODEL_J2000', 'DELTAMODEL_J2000', 'CHI2_MODEL', 'FLAGS_MODEL', 'FLUX_MODEL', 'FLUXERR_MODEL',
'MAG_MODEL', 'MAGERR_MODEL', 'FLUX_SPHEROID', 'FLUXERR_SPHEROID', 'MAG_SPHEROID', 'MAGERR_SPHEROID',
'SPHEROID_REFF_WORLD', 'SPHEROID_REFFERR_WORLD', 'SPHEROID_ASPECT_WORLD', 'SPHEROID_ASPECTERR_WORLD',
'SPHEROID_THETA_WORLD', 'SPHEROID_THETAERR_WORLD', 'FLUX_DISK', 'FLUXERR_DISK', 'MAG_DISK',
'MAGERR_DISK', 'DISK_SCALE_WORLD', 'DISK_SCALEERR_WORLD', 'DISK_ASPECT_WORLD', 'DISK_ASPECTERR_WORLD',
'DISK_THETA_WORLD', 'DISK_THETAERR_WORLD', 'FLUXRATIO_DISK', 'FLUXRATIOERR_DISK', 'SPREAD_MODEL',
'SPREADERR_MODEL'])
cat = cat[cols]
cols = ['NUMBER', 'A_WORLD', 'ERRA_WORLD', 'B_WORLD', 'ERRB_WORLD', 'THETA_WORLD', 'FLAGS', 'IMAFLAGS_ISO',
'NIMAFLAGS_ISO', 'FWHM_WORLD', 'ELONGATION', 'ELLIPTICITY', 'FLUX_AUTO', 'FLUXERR_AUTO', 'MAG_AUTO',
'MAGERR_AUTO', 'KRON_RADIUS', 'BACKGROUND', 'XPSF_IMAGE', 'YPSF_IMAGE', 'ALPHAPSF_J2000', 'DELTAPSF_J2000',
'CHI2_PSF', 'FLUX_PSF', 'FLUXERR_PSF', 'MAG_PSF', 'MAGERR_PSF', 'XMODEL_IMAGE', 'YMODEL_IMAGE',
'ALPHAMODEL_J2000', 'DELTAMODEL_J2000', 'CHI2_MODEL', 'FLAGS_MODEL', 'FLUX_MODEL', 'FLUXERR_MODEL',
'MAG_MODEL', 'MAGERR_MODEL', 'FLUX_SPHEROID', 'FLUXERR_SPHEROID', 'MAG_SPHEROID', 'MAGERR_SPHEROID',
'SPHEROID_REFF_WORLD', 'SPHEROID_REFFERR_WORLD', 'SPHEROID_ASPECT_WORLD', 'SPHEROID_ASPECTERR_WORLD',
'SPHEROID_THETA_WORLD', 'SPHEROID_THETAERR_WORLD', 'FLUX_DISK', 'FLUXERR_DISK', 'MAG_DISK', 'MAGERR_DISK',
'DISK_SCALE_WORLD', 'DISK_SCALEERR_WORLD', 'DISK_ASPECT_WORLD', 'DISK_ASPECTERR_WORLD', 'DISK_THETA_WORLD',
'DISK_THETAERR_WORLD', 'FLUXRATIO_DISK', 'FLUXRATIOERR_DISK', 'SPREAD_MODEL', 'SPREADERR_MODEL']
rncols = ['ObjID', 'A', 'AErr', 'B', 'BErr', 'PA', 'Flag', 'Flag_ISO', 'Flag_ISO_Num', 'FWHM', 'AB', 'E',
'Flux_Kron', 'FluxErr_Kron', 'Mag_Kron', 'MagErr_Kron', 'Radius_Kron', 'Sky', 'X_PSF', 'Y_PSF',
'RA_PSF', 'DEC_PSF', 'Chi2_PSF', 'Flux_PSF', 'FluxErr_PSF', 'Mag_PSF', 'MagErr_PSF', 'X_Model',
'Y_Model', 'RA_Model', 'DEC_Model', 'Chi2_Model', 'Flag_Model', 'Flux_Model', 'FluxErr_Model',
'Mag_Model', 'MagErr_Model', 'Flux_Bulge', 'FluxErr_Bulge', 'Mag_Bulge', 'MagErr_Bulge', 'Re_Bulge',
'ReErr_Bulge', 'E_Bulge', 'EErr_Bulge', 'PA_Bulge', 'PAErr_Bulge', 'Flux_Disk', 'FluxErr_Disk',
'Mag_Disk', 'MagErr_Disk', 'Re_Disk', 'ReErr_Disk', 'E_Disk', 'EErr_Disk', 'PA_Disk', 'PAErr_Disk',
'Ratio_Disk', 'RatioErr_Disk', 'Spread_Model', 'SpreadErr_Model']
cat.rename_columns(cols, rncols)
# add IDs
bits = 6
objid = np.array(cat['ObjID'])
if 'ccdchip' in head:
ccdno = int(str.strip(head['ccdchip'])[3:])
else:
ccdno = int(str.strip(head['chipid']))
obsid = int(head['obsid'])
ids = np.array(cat['ObjID'], dtype=int) + ccdno * \
10 ** bits + obsid * 10 ** (bits + 2)
col = Table.Column(
ccdno * np.ones_like(objid).astype('int16'), name='CCDNo')
cat.add_column(col, index=0)
col = Table.Column(obsid * np.ones_like(objid).astype('int'), name='ObsID')
cat.add_column(col, index=0)
col = Table.Column(ids, name='ID')
cat.add_column(col, index=0)
filt = head['filter']
ff = np.zeros(len(cat), dtype='<U3')
ff[:] = filt
col = Table.Column(ff, name='Filter')
cat.add_column(col, index=3)
# set bad values
cols = ['FWHM', 'E', 'AB', 'Radius_Kron', 'R20', 'R50', 'R90', 'Re_Bulge', 'ReErr_Bulge', 'E_Bulge', 'EErr_Bulge',
'Re_Disk', 'ReErr_Disk', 'E_Disk', 'EErr_Disk', 'Ratio_Disk', 'RatioErr_Disk']
for icol in cols:
tmpmask = (cat[icol] < 0) | (~np.isfinite(cat[icol]))
cat[icol][tmpmask] = 0
keys = ['Kron', 'PSF', 'Model', 'Bulge', 'Disk']
for ikey in keys:
mkey = 'Mag_' + ikey
mekey = 'MagErr_' + ikey
fkey = 'Flux_' + ikey
fekey = 'FluxErr_' + ikey
tmpmask = (cat[mkey] < 0) | (~np.isfinite(cat[mkey])) | (cat[mekey] < 0) | (~np.isfinite(cat[mekey])) | (
~np.isfinite(cat[fkey])) | (~np.isfinite(cat[fekey]))
cat[fkey][tmpmask] = 0
cat[fekey][tmpmask] = 0
cat[mkey][tmpmask] = 99.0
cat[mekey][tmpmask] = 99.0
cat[fkey].unit = 'nanomaggy'
cat[fekey].unit = 'nanomaggy'
cat[mkey].unit = 'mag'
cat[mekey].unit = 'mag'
naper = 12
for i in range(naper):
ikey = 'Aper' + str(i + 1)
mkey = 'Mag_' + ikey
mekey = 'MagErr_' + ikey
fkey = 'Flux_' + ikey
fekey = 'FluxErr_' + ikey
tmpmask = (cat[mkey] < 0) | (~np.isfinite(cat[mkey])) | (cat[mekey] < 0) | (~np.isfinite(cat[mekey])) | (
~np.isfinite(cat[fkey])) | (~np.isfinite(cat[fekey]))
cat[fkey][tmpmask] = 0
cat[fekey][tmpmask] = 0
cat[mkey][tmpmask] = 99.0
cat[mekey][tmpmask] = 99.0
return cat
def calibrate_fluxadu(fluxadu, head, head_zpt=None, zp_name='ZP'):
""" Calibrate the original catalog including WCS, flux and others
head: the image header
head_zpt: if head_zpt is provided, using this zeropoint instead of that in the header
"""
# F in nanomaggy = f in adu * 10**((c-22.5)/(-2.5)) where c is zeropoint
fluxcalib = Table(fluxadu.copy())
if head_zpt is not None:
c = head_zpt
else:
if zp_name not in head or head[zp_name] <= 0:
return False
else:
c = head[zp_name]
# calibrate flux and errors
keys = ['APER', 'AUTO', 'HYBRID', 'PSF', 'MODEL', 'SPHEROID', 'DISK', 'MAX_MODEL', 'EFF_MODEL',
'MEAN_MODEL', 'MAX_SPHEROID', 'EFF_SPHEROID', 'MEAN_SPHEROID', 'MAX_DISK', 'EFF_DISK', 'MEAN_DISK']
fluxkeys = ['FLUX_' + ikey for ikey in keys]
fluxerrkeys = ['FLUXERR_' + ikey for ikey in keys]
nkeys = len(keys)
colnames = fluxadu.colnames
for i in range(nkeys):
if fluxkeys[i] not in colnames:
continue
print("calibrate " + fluxkeys[i])
flux = fluxadu[fluxkeys[i]]
cflux = np.zeros_like(flux)
cflux = flux * 10.0 ** ((c - 22.5) / (-2.5))
fluxcalib[fluxkeys[i]] = cflux
if i < 7:
flux_error = fluxadu[fluxerrkeys[i]]
cflux_error = np.zeros_like(flux)
cflux_error = flux_error * 10.0 ** ((c - 22.5) / (-2.5))
fluxcalib[fluxerrkeys[i]] = cflux_error
return fluxcalib
def magnitude_correction(fluxcalib, head, plot_name=None, magerr_lim=0.05, elp_lim=0.3, sigma=3.0, iters=None,
sig_limit=0.1, aper_size=[3, 4, 5, 6, 8, 10, 13, 16, 20, 25, 30, 40], aper_ref=6,
class_lim=0.5, min_nstar=5):
"""
correction for aperture and model magnitudes
Parameters:
fluxcalib: the catalog table after calibration
head: the image header
plot_name: some plots
magerr_lim: manigtude error limit to select proper stars
elp_lim: ellipticity limit
sigma: sigma for sigma-clipping
iters: iterations for sigma-clipping
sig_limit: sigma upper limit
aper_size: aperture size in radii
aper_ref: reference aperture for flux calibration
class_lim: threshhold for class_star
min_nstar: minimum stars
Returns
cat: return the corrected catalog
"""
low_errlim = 0.005
fluxcor = fluxcalib.copy()
elp = fluxcalib['ELLIPTICITY']
flux = fluxcalib['FLUX_AUTO']
fluxerr = fluxcalib['FLUXERR_AUTO']
radius = fluxcalib['FLUX_RADIUS'][:, 1]
automag, automagerr = fluxerr2magerr(flux, fluxerr)
tmpmask = (automagerr < low_errlim) & (automagerr > 0)
automagerr[tmpmask] = low_errlim
mask_auto = (fluxcalib['FLAGS'] == 0) & (elp < elp_lim) & (automagerr < magerr_lim) & (
automagerr > 0) & (automag < 90.0) & (radius > 1.0) & (fluxcalib['CLASS_STAR'] > class_lim)
print('aperture correction for aperture magnitudes ...')
apersize = np.array(aper_size)
naper = len(apersize)
nobj = len(fluxcalib)
aperstr = ''
for iaper in apersize:
aperstr += str(iaper) + ','
head["apersize"] = (aperstr, 'aperture radii in pixels')
indref = np.argmin(np.abs(apersize - aper_ref))
flux = fluxcalib['FLUX_APER']
fluxerr = fluxcalib['FLUXERR_APER']
apermag, apermagerr = fluxerr2magerr(flux, fluxerr)
apmag8 = apermag[:, indref]
apmag8err = apermagerr[:, indref]
tmpmask = (apmag8err > 0) & (apmag8err < low_errlim)
apmag8err[tmpmask] = low_errlim
mask = mask_auto & (apmag8 > 0.0) & (apmag8 < 90.0) & (
apmag8err < magerr_lim) & (apmag8err > 0)
for i in range(naper):
mask = mask & (apermag[:, i] < 90.0) & (apermag[:, i] > 0.0) & (apermagerr[:, i] < magerr_lim) & (
apermagerr[:, i] > 0)
aperflag = True
apercor = np.zeros(naper)
apercor_std = np.zeros(naper)
nstar_aper = 0
if mask.sum() < min_nstar:
aperflag = False
print('not enough stars to do aperture magnitude correction')
else:
print('isolated stars: ', mask.sum())
magdiff = -np.transpose(apermag[mask, :].transpose() - apmag8[mask])
diff_masked = sigmaclip_limitsig(
magdiff, sigma=sigma, maxiters=iters, axis=0)
mask1 = mask
mask = np.logical_not(np.any(diff_masked.mask, axis=1))
nstar_aper = mask.sum()
diff_masked = diff_masked[mask]
for i in range(naper):
weighterr = np.sqrt(
apmag8err[mask1][mask] ** 2 + apermagerr[:, i][mask1][mask] ** 2)
cor, _, corerr = weighted_mean(
diff_masked[:, i], weighterr, weight_square=False)
corerr /= np.sqrt(nstar_aper)
apercor[i] = cor
apercor_std[i] = corerr
# apercor=np.median(diff_masked,axis=0)
# apercor_std=np.std(diff_masked,axis=0)/np.sqrt(nstar_aper)
print('aperture correction using stars:', nstar_aper)
print(np.array([apercor, apercor_std]).transpose())
if plot_name is not None:
plt.figure(figsize=(9, 6))
xsize = apersize.reshape(1, naper).repeat(len(magdiff), axis=0)
plt.plot(xsize, magdiff, 'k.', markersize=1.0)
xsize = apersize.reshape(1, naper).repeat(len(diff_masked), axis=0)
plt.plot(xsize, diff_masked, 'b.', markersize=1.0)
plt.plot(apersize, apercor, 'r*')
plt.plot(apersize, apercor, 'r-')
plt.xlabel('radius (pixels)')
plt.ylabel('Mag_REF - Mag')
plt.xlim([0, 43])
plt.ylim([min(apercor) - 0.2, max(apercor) + 0.2])
plt.title('aperture correction for aperture magnitudes')
plt.savefig(plot_name + '-APERcor.png', format='png')
plt.close()
head['ns_aper'] = (
nstar_aper, 'number of stars used in aperture correction')
for i in np.arange(naper):
cf = apercor[i]
ce = apercor_std[i]
head['apcor' + str(i + 1)] = (cf,
'mag correction for aperture #{}'.format(i))
head['aperr' + str(i + 1)] = (ce,
'mag correction error for aperture #{}'.format(i))
ce = 0.0
ff = fluxcalib['FLUX_APER'][:, i]
fe = fluxcalib['FLUXERR_APER'][:, i]
ff1 = ff * 10.0 ** (-cf / 2.5)
fe1 = np.sqrt(10.0 ** (-2 * cf / 2.5) * fe ** 2 + ff ** 2 * 10.0 ** (-2 * cf / 2.5) * np.log(
10.0) ** 2 / 2.5 ** 2 * ce ** 2)
fluxcor['FLUX_APER'][:, i] = ff1
fluxcor['FLUXERR_APER'][:, i] = fe1
mag, magerr = fluxerr2magerr(ff1, fe1)
apermag[:, i] = mag
apermagerr[:, i] = magerr
mag_col = Table.Column(apermag, 'MAG_APER')
magerr_col = Table.Column(apermagerr, 'MAGERR_APER')
fluxcor.add_column(magerr_col, fluxcor.index_column('FLUXERR_APER') + 1)
fluxcor.add_column(mag_col, fluxcor.index_column('FLUXERR_APER') + 1)
# automatic magnitude correction
# mag correction for kron mag
print('correct for kron magnitudes ...')
# mask=mask_auto #automag<90.0
# if aperflag:
if True:
mask = (fluxcor['FLAGS'] == 0)
# & (elp < elp_lim)
k = fluxcor['KRON_RADIUS']
A = fluxcor['A_IMAGE']
E = fluxcor['ELLIPTICITY']
B = A * (1.0 - E)
# B=fluxcor['B_IMAGE']
kronr = k * np.sqrt(A * B)
ipt = UnivariateSpline(apersize, apercor, k=3, s=0)
cf = ipt(kronr)
ff = fluxcor['FLUX_AUTO']
fe = fluxcor['FLUXERR_AUTO']
ff1 = ff * 10.0 ** (-cf / 2.5)
fluxcor['FLUX_AUTO'] = ff1
mag, magerr = fluxerr2magerr(ff1, fe)
mag_col = Table.Column(mag, 'MAG_AUTO')
magerr_col = Table.Column(magerr, 'MAGERR_AUTO')
fluxcor.add_column(
magerr_col, fluxcor.index_column('FLUXERR_AUTO') + 1)
fluxcor.add_column(mag_col, fluxcor.index_column('FLUXERR_AUTO') + 1)
print('total kron sources:', mask.sum())
if plot_name is not None:
plt.figure(figsize=(9, 6))
plt.plot(kronr[mask], apmag8[mask] - automag[mask], 'kx')
plt.plot(apersize, apercor, 'g--')
rr = np.linspace(0, 43, 100)
plt.plot(rr, ipt(rr), 'r-')
plt.xlabel('radius (pixels)')
plt.ylabel('Mag_REF - Mag')
plt.xlim([0, 43])
plt.ylim([min(apercor) - 0.2, max(apercor) + 0.2])
plt.title('aperture correction for automatic magnitudes')
plt.savefig(plot_name + '-AUTOcor.png', format='png')
plt.close()
# other flux/mag correction
print('other flux/mag correction: HYBRID PSF MODEL SPHEROID DISK ...')
keys = ['HYBRID', 'PSF', 'MODEL', 'SPHEROID', 'DISK', 'MAX_MODEL', 'EFF_MODEL', 'MEAN_MODEL', 'MAX_SPHEROID',
'EFF_SPHEROID', 'MEAN_SPHEROID', 'MAX_DISK', 'EFF_DISK', 'MEAN_DISK']
fluxkeys = ['FLUX_' + ikey for ikey in keys]
fluxerrkeys = ['FLUXERR_' + ikey for ikey in keys]
magkeys = keys.copy()
for i, ikey in enumerate(keys):
if i < 5:
magkeys[i] = 'MAG_' + ikey
else:
magkeys[i] = 'MU_' + ikey
magerrkeys = ['MAGERR_' + ikey for ikey in keys]
corkeys = ['HYBCOR', 'PSFCOR', 'MODCOR']
corerrkeys = ['HYBERR', 'PSFERR', 'MODERR']
nkeys = len(keys)
colnames = fluxcalib.colnames
for i in range(nkeys):
if fluxkeys[i] not in colnames:
continue
print('correct ' + fluxkeys[i])
flux = fluxcalib[fluxkeys[i]]
if i < 5:
fluxerr = fluxcalib[fluxerrkeys[i]]
else:
fluxerr = np.zeros_like(flux)
if i < 3:
kmag, kmagerr = fluxerr2magerr(flux, fluxerr)
tmpmask = (kmagerr < low_errlim) & (kmagerr > 0)
kmagerr[tmpmask] = low_errlim
mask = mask_auto & (kmag < 90.0) & (apmag8 > 0) & (apmag8 < 90.0) & (kmag > 0) & (kmagerr > 0) & (
kmagerr < magerr_lim) & (apmag8err > 0) & (apmag8err < magerr_lim) & (np.abs(kmag - apmag8) < 0.5)
corflag = True
if mask.sum() < min_nstar:
print('not enough stars to correct ' + magkeys[i])
cor = 0.0
corerr = 0.0
nstar_cor = 0
corflag = False
else:
print('isolated stars for ' + magkeys[i] + ':', mask.sum())
magdiff = apmag8[mask] - kmag[mask]
diff_masked = sigmaclip_limitsig(
magdiff, sigma=sigma, maxiters=iters, sig_limit=sig_limit)
mask1 = np.logical_not(diff_masked.mask)
nstar_cor = mask1.sum()
diff_masked = magdiff[mask1]
weighterr = np.sqrt(
kmagerr[mask][mask1] ** 2 + apmag8err[mask][mask1] ** 2)
cor, _, corerr = weighted_mean(
diff_masked, weighterr, weight_square=False)
corerr /= np.sqrt(nstar_cor)
print('correction using stars:', nstar_cor)
print([cor, corerr])
head['ns_' + keys[i]
] = (nstar_cor, 'number of stars used in ' + keys[i] + ' correction')
head[corkeys[i]] = (cor, 'mag correction for ' + keys[i])
head[corerrkeys[i]] = (corerr, 'mag correction error')
cf = cor
# ce = corerr
ce = 0.0
ff = flux
fe = fluxerr
ff1 = ff * 10.0 ** (-cf / 2.5)
fe1 = np.sqrt(10.0 ** (-2 * cf / 2.5) * fe ** 2 + ff ** 2 * 10.0 ** (-2 * cf / 2.5) * np.log(
10.0) ** 2 / 2.5 ** 2 * ce ** 2)
fluxcor[fluxkeys[i]] = ff1
if i < 5:
fluxcor[fluxerrkeys[i]] = fe1
mag, magerr = fluxerr2magerr(ff1, fe1)
mag_col = Table.Column(mag, magkeys[i])
if i < 5:
magerr_col = Table.Column(magerr, magerrkeys[i])
fluxcor.add_column(
magerr_col, fluxcor.index_column(fluxerrkeys[i]) + 1)
fluxcor.add_column(
mag_col, fluxcor.index_column(fluxerrkeys[i]) + 1)
else:
fluxcor.add_column(mag_col, fluxcor.index_column(fluxkeys[i]) + 1)
if corflag and plot_name is not None and i < 3:
plt.figure(figsize=(9, 6))
plt.plot(apmag8, apmag8 - kmag, 'kx')
plt.plot(apmag8[mask], magdiff, 'bx')
plt.plot(apmag8[mask][mask1], magdiff[mask1], 'r.')
plt.plot([14, 25], [cor, cor], 'g')
plt.xlabel('Mag_REF')
plt.ylabel('Mag_REF-Mag_' + keys[i])
plt.xlim([14, 25])
plt.ylim([cor - 0.5, cor + 0.5])
plt.title('aperture correction for ' + keys[i] + ' magnitudes')
plt.savefig(plot_name + '-' + keys[i] + 'cor.png', format='png')
plt.close()
# add model magnitude and best magnitude
# print('calculating the model and best magnitudes ...')
# chi2psf=fluxcalib['CHI2_PSF']
# chi2mod=fluxcalib['CHI2_MODEL']
# nobj=len(fluxcor)
# best_flux=np.zeros(nobj)
# best_fluxerr=np.zeros(nobj)
# best_mag=np.zeros(nobj)
# best_magerr=np.zeros(nobj)
# best_type=np.repeat(0,nobj)
# mask=chi2psf < chi2mod
# best_mag[mask]=fluxcor['MAG_PSF'][mask]
# best_magerr[mask]=fluxcor['MAGERR_PSF'][mask]
# best_flux[mask]=fluxcor['FLUX_PSF'][mask]
# best_fluxerr[mask]=fluxcor['FLUXERR_PSF'][mask]
# best_mag[~mask]=fluxcor['MAG_MODEL'][~mask]
# best_magerr[~mask]=fluxcor['MAGERR_MODEL'][~mask]
# best_flux[~mask]=fluxcor['FLUX_MODEL'][~mask]
# best_fluxerr[~mask]=fluxcor['FLUXERR_MODEL'][~mask]
# best_type[~mask]=1
# bf_col=Table.Column(best_flux,'FLUX_CHI2MIN')
# bferr_col=Table.Column(best_fluxerr,'FLUXERR_CHI2MIN')
# bm_col=Table.Column(best_mag,'MAG_CHI2MIN')
# bmerr_col=Table.Column(best_magerr,'MAGERR_CHI2MIN')
# btype_col=Table.Column(best_type,'TYPE_CHI2MIN')
# fluxcor.add_columns([bf_col,bferr_col,bm_col,bmerr_col,btype_col])
return fluxcor
def rename_columns(cat, keys, rkeys):
""" rename columns in a table
Parameters
----------
keys: column names to be renamed
rkeys: column names named
Returns
----------
Table, renamed table
"""
for i in range(len(keys)):
cat.rename_column(keys[i], rkeys[i])
# new API
def core_msc_l1_mbi_phot(
image_path: str = "/path/to/image",
weight_path: str = "/path/to/weight",
flag_path: str = "/path/to/flag",
psf_ccds_path: Optional[str] = None,
psf_local_path: str = "/path/to/psf_local",
flux_path: str = "/path/to/flux",
cat_path: str = "/path/to/cat",
seg_path: str = "/path/to/seg",
sky_path: str = "/path/to/sky",
plot_flag: bool = False,
getpsf_flag: bool = False,
): # -> CsstResult:
"""
Generate PSF and do photometry for CSST MBI L1 pipeline.
Generate PSF using PSFEx and do photometry using SExtractor. If psf_ccds_path is set, use CCDS PSF, else get PSF with PSFEx and then do photometry. If get_psf_flag is set true, force get PSF with PSFEx.
Parameters
----------
image_path : str
Path of image, defaulting to "/path/to/image".
weight_path : str
Path of weight, defaulting to "/path/to/weight".
flag_path : str
Path of flag, defaulting to "/path/to/flag".
psf_ccds_path : str, optional
Path of psf_ccds, optional, defaulting to None.
psf_local_path : str
Path of psf_local, defaulting to "/path/to/psf_local".
flux_path : str
Path of flux adu, defaulting to "/path/to/flux".
cat_path : str
Path of catalog, defaulting to "/path/to/cat".
seg_path : str
Path of segmentation, defaulting to "/path/to/seg".
sky_path : str
Path of sky map, defaulting to "/path/to/sky".
plot_flag : bool
Wether output some diagnostic plots, default False.
getpsf_flag : bool
Force to get PSF, default False.
Returns
-------
CsstResult
Result containing `status`, `file_list`, and `output`.
"""
time0 = time.time()
# generate psf
if psf_ccds_path is None or getpsf_flag:
print("get PSF model for " + image_path)
pflag = generate_psf(image_path, weight_path,
flag_path, psf_local_path)
time1 = time.time()
psftime = time1 - time0
# pick a PSF
if psf_ccds_path is None:
# use psf_path
psf_path = psf_local_path
else:
psf_path = psf_ccds_path
if os.path.isfile(psf_path):
# photometry
print('do photometry for ' + image_path)
do_photometry(
image_path,
weight_path,
flag_path,
psf_path,
flux_path,
cat_path,
sky_path,
seg_path,
plot_flag,
)
time2 = time.time()
if 'time1' in vars().keys():
phottime = time2 - time1
else:
phottime = time2 - time0
print('Total time for ' + image_path + ': ', time2 - time0)
if os.path.isfile(cat_path):
f = fits.open(cat_path, mode='update')
if 'psftime' in vars().keys():
f[1].header['PSF_PATH'] = psf_path
f[1].header['PSFTIME'] = (psftime, 'seconds')
f[1].header['PHOTTIME'] = (phottime, 'seconds')
f.flush(output_verify='fix+warn')
f.close()
# # construct CsstResult
# result = CsstResult(
# status=CsstStatus(0 if os.path.exists(cat_path) else 2),
# files=[
# psf_path,
# flux_path,
# cat_path,
# seg_path,
# sky_path,
# ],
# )
# return result
def generate_psf(
image_path: str = "/path/to/image",
weight_path: str = "/path/to/weight",
flag_path: str = "/path/to/flag",
psf_local_path: str = "/path/to/psf_local",
) -> None:
"""
Generate psf for csst image.
Parameters
----------
image_path : str
Path of image, defaulting to "/path/to/image".
weight_path : str
Path of weight, defaulting to "/path/to/weight".
flag_path : str
Path of flag, defaulting to "/path/to/flag".
psf_local_path : str
Path of psf_local..., defaulting to "/path/to/psf_local".
Returns
-------
None
"""
get_psf(image_path, weight_path, flag_path, psf_local_path, psf_size=25, degree=2, variability=0.3,
fwhm_range=[1.1, 4.0], max_elp=0.3, sampling=0, min_sn=5.0, detect_thresh=5.0, detect_minarea=3,
back_size='500,500', nthread=0, remove_polution=True, min_nstar=10, max_nstar=1500, class_star=0.7,
match_dist=10.0)
def do_photometry(
image_path: str = "/path/to/image",
weight_path: str = "/path/to/weight",
flag_path: str = "/path/to/flag",
psf_path: str = "/path/to/psf",
flux_path: str = "/path/to/flux",
cat_path: str = "/path/to/cat",
sky_path: str = "/path/to/sky",
seg_path: str = "/path/to/seg",
plot_flag: bool = False,
) -> None:
"""
Do photometry for csst image.
Parameters
----------
image_path : str
Path of image, defaulting to "/path/to/image".
weight_path : str
Path of weight, defaulting to "/path/to/weight".
flag_path : str
Path of flag, defaulting to "/path/to/flag".
psf_path : str
Path of psf, defaulting to "/path/to/psf".
flux_path : str
Path of flux, defaulting to "/path/to/flux".
cat_path : str
Path of cat, defaulting to "/path/to/cat".
sky_path : str
Path of sky, defaulting to "/path/to/sky".
seg_path : str
Path of seg, defaulting to "/path/to/seg".
plot_flag : bool
Wether output some diagnostic plots, default Fasle.
Returns
-------
None
"""
photometry(image_path, weight_path, flag_path, psf_path, flux_path, cat_path, sky_path, seg_path,
detect_thresh=1.0, analysis_thresh=1.0, clean='Y',
head_zpt=None, nthread=0, phot_type='model',
sep=2, star_thresh=0.005, zp_name='ZP', plot_flag=plot_flag)
# Default configuration file for PSFEx 3.17.1
# EB 2014-10-03
#
#-------------------------------- PSF model ----------------------------------
BASIS_TYPE PIXEL_AUTO # NONE, PIXEL, GAUSS-LAGUERRE or FILE
BASIS_NUMBER 20 # Basis number or parameter
BASIS_NAME basis.fits # Basis filename (FITS data-cube)
BASIS_SCALE 1.0 # Gauss-Laguerre beta parameter
NEWBASIS_TYPE NONE # Create new basis: NONE, PCA_INDEPENDENT
# or PCA_COMMON
NEWBASIS_NUMBER 8 # Number of new basis vectors
PSF_SAMPLING 0.0 # Sampling step in pixel units (0.0 = auto)
PSF_PIXELSIZE 1.0 # Effective pixel size in pixel step units
PSF_ACCURACY 0.01 # Accuracy to expect from PSF "pixel" values
PSF_SIZE 71,71 # Image size of the PSF model
PSF_RECENTER Y # Allow recentering of PSF-candidates Y/N ?
MEF_TYPE INDEPENDENT # INDEPENDENT or COMMON
#------------------------- Point source measurements -------------------------
CENTER_KEYS XWIN_IMAGE,YWIN_IMAGE # Catalogue parameters for source pre-centering
PHOTFLUX_KEY FLUX_APER(1) # Catalogue parameter for photometric norm.
PHOTFLUXERR_KEY FLUXERR_APER(1) # Catalogue parameter for photometric error
#----------------------------- PSF variability -------------------------------
PSFVAR_KEYS XWIN_IMAGE,YWIN_IMAGE # Catalogue or FITS (preceded by :) params
PSFVAR_GROUPS 1,1 # Group tag for each context key
PSFVAR_DEGREES 2 # Polynom degree for each group
PSFVAR_NSNAP 9 # Number of PSF snapshots per axis
HIDDENMEF_TYPE COMMON # INDEPENDENT or COMMON
STABILITY_TYPE EXPOSURE # EXPOSURE or SEQUENCE
#----------------------------- Sample selection ------------------------------
SAMPLE_AUTOSELECT Y # Automatically select the FWHM (Y/N) ?
SAMPLEVAR_TYPE SEEING # File-to-file PSF variability: NONE or SEEING
SAMPLE_FWHMRANGE 1.0,20.0 # Allowed FWHM range
SAMPLE_VARIABILITY 0.3 # Allowed FWHM variability (1.0 = 100%)
SAMPLE_MINSN 20 # Minimum S/N for a source to be used
SAMPLE_MAXELLIP 0.3 # Maximum (A-B)/(A+B) for a source to be used
SAMPLE_FLAGMASK 0x00fe # Rejection mask on SExtractor FLAGS
SAMPLE_WFLAGMASK 0x0000 # Rejection mask on SExtractor FLAGS_WEIGHT
SAMPLE_IMAFLAGMASK 0x0 # Rejection mask on SExtractor IMAFLAGS_ISO
BADPIXEL_FILTER N # Filter bad-pixels in samples (Y/N) ?
BADPIXEL_NMAX 0 # Maximum number of bad pixels allowed
#----------------------- PSF homogeneisation kernel --------------------------
HOMOBASIS_TYPE NONE # NONE or GAUSS-LAGUERRE
HOMOBASIS_NUMBER 10 # Kernel basis number or parameter
HOMOBASIS_SCALE 1.0 # GAUSS-LAGUERRE beta parameter
HOMOPSF_PARAMS 2.0, 3.0 # Moffat parameters of the idealised PSF
HOMOKERNEL_DIR # Where to write kernels (empty=same as input)
HOMOKERNEL_SUFFIX .homo.fits # Filename extension for homogenisation kernels
#----------------------------- Output catalogs -------------------------------
OUTCAT_TYPE NONE # NONE, ASCII_HEAD, ASCII, FITS_LDAC
OUTCAT_NAME psfex_out.cat # Output catalog filename
#------------------------------- Check-plots ----------------------------------
CHECKPLOT_DEV NULL # NULL, XWIN, TK, PS, PSC, XFIG, PNG,
# JPEG, AQT, PDF or SVG
CHECKPLOT_RES 0 # Check-plot resolution (0 = default)
CHECKPLOT_ANTIALIAS Y # Anti-aliasing using convert (Y/N) ?
CHECKPLOT_TYPE NONE #FWHM,ELLIPTICITY,COUNTS, COUNT_FRACTION, CHI2, RESIDUALS or NONE
CHECKPLOT_NAME
#------------------------------ Check-Images ---------------------------------
CHECKIMAGE_TYPE NONE #CHI,PROTOTYPES,SAMPLES,RESIDUALS,SNAPSHOTS
# or MOFFAT,-MOFFAT,-SYMMETRICAL
CHECKIMAGE_NAME #chi.fits,proto.fits,samp.fits,resi.fits,snap.fits
# Check-image filenames
CHECKIMAGE_CUBE N # Save check-images as datacubes (Y/N) ?
#----------------------------- Miscellaneous ---------------------------------
PSF_DIR # Where to write PSFs (empty=same as input)
PSF_SUFFIX .fits # Filename extension for output PSF filename
VERBOSE_TYPE NORMAL # can be QUIET,NORMAL,LOG or FULL
WRITE_XML N # Write XML file (Y/N)?
XML_NAME psfex.xml # Filename for XML output
XSL_URL file:///usr/local/share/psfex/psfex.xsl
# Filename for XSL style-sheet
NTHREADS 0 # Number of simultaneous threads for
# the SMP version of PSFEx
# 0 = automatic
NUMBER #Running object number
FLUX_APER(12) #Flux vector within fixed circular aperture(s) [count]
FLUXERR_APER(12) #RMS error vector for aperture flux(es) [count]
#MAG_APER(12) #Fixed aperture magnitude vector [mag]
#MAGERR_APER(12) #RMS error vector for fixed aperture mag. [mag]
FLUX_AUTO #Flux within a Kron-like elliptical aperture [count]
FLUXERR_AUTO #RMS error for AUTO flux [count]
#MAG_AUTO #Kron-like elliptical aperture magnitude [mag]
#MAGERR_AUTO #RMS error for AUTO magnitude [mag]
KRON_RADIUS #Kron apertures in units of A or B
BACKGROUND #Background at centroid position [count]
X_IMAGE #Object position along x [pixel]
Y_IMAGE #Object position along y [pixel]
ALPHA_J2000 #Right ascension of barycenter (J2000) [deg]
DELTA_J2000 #Declination of barycenter (J2000) [deg]
A_IMAGE #Profile RMS along major axis [pixel]
B_IMAGE #Profile RMS along minor axis [pixel]
THETA_IMAGE #Position angle (CCW/x) [deg]
A_WORLD #Profile RMS along major axis (world units) [deg]
B_WORLD #Profile RMS along minor axis (world units) [deg]
THETA_WORLD #Position angle (CCW/world-x) [deg]
THETA_J2000 #Position angle (east of north) (J2000) [deg]
ERRX2_IMAGE #Variance of position along x [pixel**2]
ERRY2_IMAGE #Variance of position along y [pixel**2]
ERRA_IMAGE #RMS position error along major axis [pixel]
ERRB_IMAGE #RMS position error along minor axis [pixel]
ERRTHETA_IMAGE #Error ellipse position angle (CCW/x) [deg]
ERRA_WORLD #World RMS position error along major axis [deg]
ERRB_WORLD #World RMS position error along minor axis [deg]
ERRTHETA_WORLD #Error ellipse pos. angle (CCW/world-x) [deg]
ERRTHETA_J2000 #J2000 error ellipse pos. angle (east of north) [deg]
XWIN_IMAGE #Windowed position estimate along x [pixel]
YWIN_IMAGE #Windowed position estimate along y [pixel]
ALPHAWIN_J2000 #Windowed right ascension (J2000) [deg]
DELTAWIN_J2000 #windowed declination (J2000) [deg]
ERRX2WIN_IMAGE #Variance of windowed pos along x [pixel**2]
ERRY2WIN_IMAGE #Variance of windowed pos along y [pixel**2]
FLAGS #Extraction flags
FLAGS_WEIGHT #Weighted extraction flags
IMAFLAGS_ISO #FLAG-image flags OR'ed over the iso. profile
NIMAFLAGS_ISO #Number of flagged pixels entering IMAFLAGS_ISO
FWHM_IMAGE #FWHM assuming a gaussian core [pixel]
FWHM_WORLD #FWHM assuming a gaussian core [deg]
ELONGATION #A_IMAGE/B_IMAGE
ELLIPTICITY #1 - B_IMAGE/A_IMAGE
CLASS_STAR #S/G classifier output
FLUX_RADIUS(3) #Fraction-of-light radii [pixel]
FWHMPSF_IMAGE #FWHM of the local PSF model [pixel]
FWHMPSF_WORLD #FWHM of the local PSF model (world units) [deg]
XPSF_IMAGE #X coordinate from PSF-fitting [pixel]
YPSF_IMAGE #Y coordinate from PSF-fitting [pixel]
ALPHAPSF_J2000 #Right ascension of the fitted PSF (J2000) [deg]
DELTAPSF_J2000 #Declination of the fitted PSF (J2000) [deg]
FLUX_PSF #Flux from PSF-fitting [count]
FLUXERR_PSF #RMS flux error for PSF-fitting [count]
#MAG_PSF #Magnitude from PSF-fitting [mag]
#MAGERR_PSF #RMS magnitude error from PSF-fitting [mag]
NITER_PSF #Number of iterations for PSF-fitting
CHI2_PSF #Reduced chi2 from PSF-fitting
ERRX2PSF_IMAGE #Variance of PSF position along x [pixel**2]
ERRY2PSF_IMAGE #Variance of PSF position along y [pixel**2]
CHI2_MODEL #Reduced Chi2 of the fit
FLAGS_MODEL #Model-fitting flags
NITER_MODEL #Number of iterations for model-fitting
FLUX_MODEL #Flux from model-fitting [count]
FLUXERR_MODEL #RMS error on model-fitting flux [count]
#MAG_MODEL #Magnitude from model-fitting [mag]
#MAGERR_MODEL #RMS error on model-fitting magnitude [mag]
#FLUX_HYBRID #Hybrid flux from model-fitting [count]
#FLUXERR_HYBRID #RMS error on hybrid flux [count]
#MAG_HYBRID #Hybrid magnitude from model-fitting [mag]
#MAGERR_HYBRID #RMS error on hybrid magnitude [mag]
FLUX_MAX_MODEL #Peak model flux above background [count]
FLUX_EFF_MODEL #Effective model flux above background [count]
FLUX_MEAN_MODEL #Mean effective model flux above background [count]
#MU_MAX_MODEL #Peak model surface brightness above background [mag * arcsec**(-2)]
#MU_EFF_MODEL #Effective model surface brightness above background [mag * arcsec**(-2)]
#MU_MEAN_MODEL #Mean effective model surface brightness above background [mag * arcsec**(-2)]
XMODEL_IMAGE #X coordinate from model-fitting [pixel]
YMODEL_IMAGE #Y coordinate from model-fitting [pixel]
ALPHAMODEL_J2000 #Fitted position along right ascension (J2000) [deg]
DELTAMODEL_J2000 #Fitted position along declination (J2000) [deg]
ERRY2MODEL_IMAGE #Variance of fitted position along y [pixel**2]
ERRY2MODEL_IMAGE #Variance of fitted position along y
ERRAMODEL_IMAGE #RMS error of fitted position along major axis [pixel]
ERRBMODEL_IMAGE #RMS error of fitted position along minor axis [pixel]
ERRTHETAMODEL_IMAGE #Error ellipse pos.angle of fitted position (CCW/x) [deg]
ERRAMODEL_WORLD #World RMS error of fitted position along major axis [deg]
ERRBMODEL_WORLD #World RMS error of fitted position along minor axis [deg]
ERRTHETAMODEL_WORLD #Error ellipse pos.angle of fitted position (CCW/world-x) [deg]
ERRTHETAMODEL_J2000 #J2000 fitted error ellipse pos. angle (east of north) [deg]
AMODEL_IMAGE #Model RMS along major axis [pixel]
BMODEL_IMAGE #Model RMS along minor axis [pixel]
THETAMODEL_IMAGE #Model position angle (CCW/x) [deg]
AMODEL_WORLD #Model RMS along major axis (WORLD units) [deg]
BMODEL_WORLD #Model RMS along minor axis (WORLD units) [deg]
THETAMODEL_WORLD #Model position angle (CCW/WORLD-x) [deg]
THETAMODEL_J2000 #Model position angle (east of north) (J2000) [deg]
SPREAD_MODEL #Spread parameter from model-fitting
SPREADERR_MODEL #Spread parameter error from model-fitting
NOISEAREA_MODEL #Equivalent noise area of the fitted model [pixel**2]
#FLUX_POINTSOURCE #Point source flux from fitting [count]
#FLUXERR_POINTSOURCE #RMS error on fitted point source total flux [count]
#FLUXRATIO_POINTSOURCE #Point-source flux-to-total ratio from fitting
#FLUXRATIOERR_POINTSOURCE #RMS error on point-source flux-to-total ratio
#MAG_POINTSOURCE #Point source total magnitude from fitting [mag]
#MAGERR_POINTSOURCE #RMS error on fitted point source total magnitude [mag]
FLUX_SPHEROID #Spheroid total flux from fitting [count]
FLUXERR_SPHEROID #RMS error on fitted spheroid total flux [count]
#MAG_SPHEROID #Spheroid total magnitude from fitting [mag]
#MAGERR_SPHEROID #RMS error on fitted spheroid total magnitude [mag]
FLUX_MAX_SPHEROID #Peak spheroid flux above background [count]
FLUX_EFF_SPHEROID #Effective spheroid flux above background [count]
FLUX_MEAN_SPHEROID #Mean effective spheroid flux above background [count]
#MU_MAX_SPHEROID #Peak spheroid surface brightness above background [mag * arcsec**(-2)]
#MU_EFF_SPHEROID #Effective spheroid surface brightness above background [mag * arcsec**(-2)]
#MU_MEAN_SPHEROID #Mean effective spheroid surface brightness above backgrou [mag * arcsec**(-2)]
FLUXRATIO_SPHEROID #Spheroid flux-to-total ratio from fitting
FLUXRATIOERR_SPHEROID #RMS error on spheroid flux-to-total ratio
SPHEROID_REFF_IMAGE #Spheroid effective radius from fitting [pixel]
SPHEROID_REFFERR_IMAGE #RMS error on fitted spheroid effective radius [pixel]
SPHEROID_REFF_WORLD #Spheroid effective radius from fitting [deg]
SPHEROID_REFFERR_WORLD #RMS error on fitted spheroid effective radius [deg]
SPHEROID_ASPECT_IMAGE #Spheroid aspect ratio from fitting
SPHEROID_ASPECTERR_IMAGE #RMS error on fitted spheroid aspect ratio
SPHEROID_ASPECT_WORLD #Spheroid aspect ratio from fitting
SPHEROID_ASPECTERR_WORLD #RMS error on fitted spheroid aspect ratio
SPHEROID_THETA_IMAGE #Spheroid position angle (CCW/x) from fitting [deg]
SPHEROID_THETAERR_IMAGE #RMS error on spheroid position angle [deg]
SPHEROID_THETA_WORLD #Spheroid position angle (CCW/world-x) [deg]
SPHEROID_THETAERR_WORLD #RMS error on spheroid position angle [deg]
SPHEROID_THETA_J2000 #Spheroid position angle (east of north, J2000) [deg]
#SPHEROID_SERSICN #Spheroid Sersic index from fitting
#SPHEROID_SERSICNERR #RMS error on fitted spheroid Sersic index
FLUX_DISK #Disk total flux from fitting [count]
FLUXERR_DISK #RMS error on fitted disk total flux [count]
#MAG_DISK #Disk total magnitude from fitting [mag]
#MAGERR_DISK #RMS error on fitted disk total magnitude [mag]
FLUX_MAX_DISK #Peak disk flux above background [count]
FLUX_EFF_DISK #Effective disk flux above background [count]
FLUX_MEAN_DISK #Mean effective disk flux above background [count]
#MU_MAX_DISK #Peak disk surface brightness above background [mag * arcsec**(-2)]
#MU_EFF_DISK #Effective disk surface brightness above background [mag * arcsec**(-2)]
#MU_MEAN_DISK #Mean effective disk surface brightness above background [mag * arcsec**(-2)]
FLUXRATIO_DISK #Disk flux-to-total ratio from fitting
FLUXRATIOERR_DISK #RMS error on disk flux-to-total ratio
DISK_SCALE_IMAGE #Disk scalelength from fitting [pixel]
DISK_SCALEERR_IMAGE #RMS error on fitted disk scalelength [pixel]
DISK_SCALE_WORLD #Disk scalelength from fitting (world coords) [deg]
DISK_SCALEERR_WORLD #RMS error on fitted disk scalelength (world coords) [deg]
DISK_ASPECT_IMAGE #Disk aspect ratio from fitting
DISK_ASPECTERR_IMAGE #RMS error on fitted disk aspect ratio
DISK_ASPECT_WORLD #Disk aspect ratio from fitting
DISK_ASPECTERR_WORLD #RMS error on disk aspect ratio
DISK_INCLINATION #Disk inclination from fitting [deg]
DISK_INCLINATIONERR #RMS error on disk inclination from fitting [deg]
DISK_THETA_IMAGE #Disk position angle (CCW/x) from fitting [deg]
DISK_THETAERR_IMAGE #RMS error on fitted disk position angle [deg]
DISK_THETA_WORLD #Disk position angle (CCW/world-x) [deg]
DISK_THETAERR_WORLD #RMS error on disk position angle [deg]
DISK_THETA_J2000 #Disk position angle (east of north, J2000) [deg]
#CHI2_DETMODEL #Reduced Chi2 of the det. model fit to measurement image
#FLAGS_DETMODEL #Detection model-fitting flags
#NITER_DETMODEL #Number of iterations for detection model-fitting
#FLUX_DETMODEL #Flux from detection model-fitting [count]
#FLUXERR_DETMODEL #RMS error on detection model-fitting flux [count]
#MAG_DETMODEL #Magnitude from detection model-fitting [mag]
#MAGERR_DETMODEL #RMS error on detection model-fitting magnitude [mag]
# Default configuration file for SExtractor 2.19.5
# EB 2014-06-07
#
#-------------------------------- Catalog ------------------------------------
CATALOG_NAME test.cat # name of the output catalog
CATALOG_TYPE FITS_1.0 # NONE,ASCII,ASCII_HEAD, ASCII_SKYCAT,
# ASCII_VOTABLE, FITS_1.0 or FITS_LDAC
PARAMETERS_NAME bok.params # name of the file containing catalog contents
#------------------------------- Extraction ----------------------------------
DETECT_TYPE CCD # CCD (linear) or PHOTO (with gamma correction)
DETECT_MINAREA 3 # min. # of pixels above threshold
DETECT_MAXAREA 0 # max. # of pixels above threshold (0=unlimited)
THRESH_TYPE RELATIVE # threshold type: RELATIVE (in sigmas)
# or ABSOLUTE (in ADUs)
DETECT_THRESH 1.5 # <sigmas> or <threshold>,<ZP> in mag.arcsec-2
ANALYSIS_THRESH 1.0 # <sigmas> or <threshold>,<ZP> in mag.arcsec-2
FILTER Y # apply filter for detection (Y or N)?
FILTER_NAME default.conv # name of the file containing the filter
FILTER_THRESH # Threshold[s] for retina filtering
DEBLEND_NTHRESH 64 # Number of deblending sub-thresholds
DEBLEND_MINCONT 0.0005 # Minimum contrast parameter for deblending
CLEAN Y # Clean spurious detections? (Y or N)?
CLEAN_PARAM 0.5 # Cleaning efficiency
MASK_TYPE CORRECT # type of detection MASKing: can be one of
# NONE, BLANK or CORRECT
#-------------------------------- WEIGHTing ----------------------------------
WEIGHT_TYPE MAP_WEIGHT # type of WEIGHTing: NONE, BACKGROUND,
# MAP_RMS, MAP_VAR or MAP_WEIGHT
RESCALE_WEIGHTS Y # Rescale input weights/variances (Y/N)?
WEIGHT_IMAGE weight.fits # weight-map filename
WEIGHT_GAIN N # modulate gain (E/ADU) with weights? (Y/N)
WEIGHT_THRESH 1e-7 # weight threshold[s] for bad pixels
#-------------------------------- FLAGging -----------------------------------
FLAG_IMAGE flag.fits # filename for an input FLAG-image
FLAG_TYPE OR # flag pixel combination: OR, AND, MIN, MAX
# or MOST
#------------------------------ Photometry -----------------------------------
PHOT_APERTURES 6,8,10,12,16,20,26,32,40,50,60,80 # MAG_APER aperture diameter(s) in pixels
PHOT_AUTOPARAMS 2.5, 3.5 # MAG_AUTO parameters: <Kron_fact>,<min_radius>
PHOT_PETROPARAMS 2.0, 3.5 # MAG_PETRO parameters: <Petrosian_fact>,
# <min_radius>
PHOT_AUTOAPERS 0.0,0.0 # <estimation>,<measurement> minimum apertures
# for MAG_AUTO and MAG_PETRO
PHOT_FLUXFRAC 0.2,0.5,0.9 # flux fraction[s] used for FLUX_RADIUS
SATUR_LEVEL 30000.0 # level (in ADUs) at which arises saturation
SATUR_KEY asfSATURATE # keyword for saturation level (in ADUs)
MAG_ZEROPOINT 0.0 # magnitude zero-point
MAG_GAMMA 4.0 # gamma of emulsion (for photographic scans)
GAIN 1.0 # detector gain in e-/ADU
GAIN_KEY adf # keyword for detector gain in e-/ADU
PIXEL_SCALE 0.074 # size of pixel in arcsec (0=use FITS WCS info)
#------------------------- Star/Galaxy Separation ----------------------------
SEEING_FWHM 0.15 # stellar FWHM in arcsec
STARNNW_NAME default.nnw # Neural-Network_Weight table filename
#------------------------------ Background -----------------------------------
BACK_TYPE AUTO # AUTO or MANUAL
BACK_VALUE 0.0 # Default background value in MANUAL mode
BACK_SIZE 400 # Background mesh: <size> or <width>,<height>
BACK_FILTERSIZE 3 # Background filter: <size> or <width>,<height>
FBACK_DIFF 0.05
BACKPHOTO_TYPE GLOBAL # can be GLOBAL or LOCAL
BACKPHOTO_THICK 24 # thickness of the background LOCAL annulus
BACK_FILTTHRESH 0.0 # Threshold above which the background-
# map filter operates
#------------------------------ Check Image ----------------------------------
CHECKIMAGE_TYPE -MODELS MODELS # can be NONE, BACKGROUND, BACKGROUND_RMS,
# MINIBACKGROUND, MINIBACK_RMS, -BACKGROUND,
# FILTERED, OBJECTS, -OBJECTS, SEGMENTATION,
# or APERTURES
CHECKIMAGE_NAME check-submod.fits check-model.fits # Filename for the check-image
#--------------------- Memory (change with caution!) -------------------------
MEMORY_OBJSTACK 3000 # number of objects in stack
MEMORY_PIXSTACK 300000 # number of pixels in stack
MEMORY_BUFSIZE 1024 # number of lines in buffer
#------------------------------- ASSOCiation ---------------------------------
ASSOC_NAME sky.list # name of the ASCII file to ASSOCiate
ASSOC_DATA 2,3,4 # columns of the data to replicate (0=all)
ASSOC_PARAMS 2,3,4 # columns of xpos,ypos[,mag]
ASSOCCOORD_TYPE PIXEL # ASSOC coordinates: PIXEL or WORLD
ASSOC_RADIUS 2.0 # cross-matching radius (pixels)
ASSOC_TYPE NEAREST # ASSOCiation method: FIRST, NEAREST, MEAN,
# MAG_MEAN, SUM, MAG_SUM, MIN or MAX
ASSOCSELEC_TYPE MATCHED # ASSOC selection type: ALL, MATCHED or -MATCHED
#----------------------------- Miscellaneous ---------------------------------
VERBOSE_TYPE NORMAL # can be QUIET, NORMAL or FULL
HEADER_SUFFIX .head # Filename extension for additional headers
WRITE_XML N # Write XML file (Y/N)?
XML_NAME sex.xml # Filename for XML output
XSL_URL file:///opt/local/share/sextractor/sextractor.xsl
# Filename for XSL style-sheet
NTHREADS 1 # 1 single thread
FITS_UNSIGNED N # Treat FITS integer values as unsigned (Y/N)?
INTERP_MAXXLAG 16 # Max. lag along X for 0-weight interpolation
INTERP_MAXYLAG 16 # Max. lag along Y for 0-weight interpolation
INTERP_TYPE ALL # Interpolation type: NONE, VAR_ONLY or ALL
#--------------------------- Experimental Stuff -----------------------------
PSF_NAME default.psf # File containing the PSF model
PSF_NMAX 1 # Max.number of PSFs fitted simultaneously
PATTERN_TYPE RINGS-HARMONIC # can RINGS-QUADPOLE, RINGS-OCTOPOLE,
# RINGS-HARMONICS or GAUSS-LAGUERRE
SOM_NAME default.som # File containing Self-Organizing Map weights
VIGNET(31,31)
XWIN_IMAGE
YWIN_IMAGE
FLUX_APER
FLUXERR_APER
FLUX_RADIUS
FWHM_IMAGE
ELONGATION
FLAGS
IMAFLAGS_ISO
NIMAFLAGS_ISO
SNR_WIN
CLASS_STAR
ELLIPTICITY
# Simple configuration file for SExtractor prior to PSFEx use
# only non-default parameters are present.
# EB 2007-08-01
#
#-------------------------------- Catalog ------------------------------------
CATALOG_NAME prepsfex.cat # Catalog filename
CATALOG_TYPE FITS_LDAC # FITS_LDAC format
PARAMETERS_NAME bok-psfex.param # name of the file containing catalog contents
#------------------------------- Extraction ----------------------------------
DETECT_MINAREA 3 # minimum number of pixels above threshold
DETECT_MAXAREA 150 # max. # of pixels above threshold (0=unlimited)
DETECT_THRESH 5 # a fairly conservative threshold
ANALYSIS_THRESH 2 # idem
CLEAN Y # Clean spurious detections? (Y or N)?
FILTER Y # apply filter for detection ("Y" or "N")?
FILTER_NAME gauss_3.0_5x5.conv # name of the file containing the filter
FBACK_DIFF 0.05
#-------------------------------- WEIGHTing ----------------------------------
WEIGHT_TYPE MAP_WEIGHT # type of WEIGHTing: NONE, BACKGROUND,
# MAP_RMS, MAP_VAR or MAP_WEIGHT
RESCALE_WEIGHTS Y # Rescale input weights/variances (Y/N)?
WEIGHT_IMAGE weight.fits # weight-map filename
WEIGHT_GAIN N # modulate gain (E/ADU) with weights? (Y/N)
WEIGHT_THRESH 1e-7 # weight threshold[s] for bad pixels
#-------------------------------- FLAGging -----------------------------------
FLAG_IMAGE flag.fits # filename for an input FLAG-image
FLAG_TYPE OR # flag pixel combination: OR, AND, MIN, MAX
# # or MOST
#------------------------------ Photometry -----------------------------------
PHOT_APERTURES 10 # <- put the referrence aperture diameter here
SATUR_LEVEL 30000.0 # <- put the right saturation threshold here
GAIN 1.4 # <- put the detector gain in e-/ADU here
#------------------------- Star/Galaxy Separation ----------------------------
#------------------------------ Background -----------------------------------
#------------------------------ Check Image ----------------------------------
#--------------------- Memory (change with caution!) -------------------------
#------------------------------- ASSOCiation ---------------------------------
#----------------------------- Miscellaneous ---------------------------------
NUMBER #Running object number
FLUX_APER(12) #Flux vector within fixed circular aperture(s) [count]
FLUXERR_APER(12) #RMS error vector for aperture flux(es) [count]
#MAG_APER(12) #Fixed aperture magnitude vector [mag]
#MAGERR_APER(12) #RMS error vector for fixed aperture mag. [mag]
FLUX_AUTO #Flux within a Kron-like elliptical aperture [count]
FLUXERR_AUTO #RMS error for AUTO flux [count]
#MAG_AUTO #Kron-like elliptical aperture magnitude [mag]
#MAGERR_AUTO #RMS error for AUTO magnitude [mag]
KRON_RADIUS #Kron apertures in units of A or B
BACKGROUND #Background at centroid position [count]
X_IMAGE #Object position along x [pixel]
Y_IMAGE #Object position along y [pixel]
ALPHA_J2000 #Right ascension of barycenter (J2000) [deg]
DELTA_J2000 #Declination of barycenter (J2000) [deg]
A_IMAGE #Profile RMS along major axis [pixel]
B_IMAGE #Profile RMS along minor axis [pixel]
THETA_IMAGE #Position angle (CCW/x) [deg]
A_WORLD #Profile RMS along major axis (world units) [deg]
B_WORLD #Profile RMS along minor axis (world units) [deg]
THETA_WORLD #Position angle (CCW/world-x) [deg]
THETA_J2000 #Position angle (east of north) (J2000) [deg]
ERRX2_IMAGE #Variance of position along x [pixel**2]
ERRY2_IMAGE #Variance of position along y [pixel**2]
ERRA_IMAGE #RMS position error along major axis [pixel]
ERRB_IMAGE #RMS position error along minor axis [pixel]
EERRTHETA_IMAGE #Error ellipse position angle (CCW/x) [deg]
ERRA_WORLD #World RMS position error along major axis [deg]
ERRB_WORLD #World RMS position error along minor axis [deg]
ERRTHETA_WORLD #Error ellipse pos. angle (CCW/world-x) [deg]
ERRTHETA_J2000 #J2000 error ellipse pos. angle (east of north) [deg]
XWIN_IMAGE #Windowed position estimate along x [pixel]
YWIN_IMAGE #Windowed position estimate along y [pixel]
ALPHAWIN_J2000 #Windowed right ascension (J2000) [deg]
DELTAWIN_J2000 #windowed declination (J2000) [deg]
ERRX2WIN_IMAGE #Variance of windowed pos along x [pixel**2]
ERRY2WIN_IMAGE #Variance of windowed pos along y [pixel**2]
FLAGS #Extraction flags
FLAGS_WEIGHT #Weighted extraction flags
IMAFLAGS_ISO #FLAG-image flags OR'ed over the iso. profile
NIMAFLAGS_ISO #Number of flagged pixels entering IMAFLAGS_ISO
FWHM_IMAGE #FWHM assuming a gaussian core [pixel]
FWHM_WORLD #FWHM assuming a gaussian core [deg]
ELONGATION #A_IMAGE/B_IMAGE
ELLIPTICITY #1 - B_IMAGE/A_IMAGE
CLASS_STAR #S/G classifier output
FLUX_RADIUS(3) #Fraction-of-light radii [pixel]
FWHMPSF_IMAGE #FWHM of the local PSF model [pixel]
FWHMPSF_WORLD #FWHM of the local PSF model (world units) [deg]
XPSF_IMAGE #X coordinate from PSF-fitting [pixel]
YPSF_IMAGE #Y coordinate from PSF-fitting [pixel]
ALPHAPSF_J2000 #Right ascension of the fitted PSF (J2000) [deg]
DELTAPSF_J2000 #Declination of the fitted PSF (J2000) [deg]
FLUX_PSF #Flux from PSF-fitting [count]
FLUXERR_PSF #RMS flux error for PSF-fitting [count]
#MAG_PSF #Magnitude from PSF-fitting [mag]
#MAGERR_PSF #RMS magnitude error from PSF-fitting [mag]
NITER_PSF #Number of iterations for PSF-fitting
CHI2_PSF #Reduced chi2 from PSF-fitting
ERRX2PSF_IMAGE #Variance of PSF position along x [pixel**2]
ERRY2PSF_IMAGE #Variance of PSF position along y [pixel**2]
CONV NORM
# 7x7 convolution mask of a gaussian PSF with FWHM = 3.0 pixels.
0.004963 0.021388 0.051328 0.068707 0.051328 0.021388 0.004963
0.021388 0.092163 0.221178 0.296069 0.221178 0.092163 0.021388
0.051328 0.221178 0.530797 0.710525 0.530797 0.221178 0.051328
0.068707 0.296069 0.710525 0.951108 0.710525 0.296069 0.068707
0.051328 0.221178 0.530797 0.710525 0.530797 0.221178 0.051328
0.021388 0.092163 0.221178 0.296069 0.221178 0.092163 0.021388
0.004963 0.021388 0.051328 0.068707 0.051328 0.021388 0.004963
NNW
# Neural Network Weights for the SExtractor star/galaxy classifier (V1.3)
# inputs: 9 for profile parameters + 1 for seeing.
# outputs: ``Stellarity index'' (0.0 to 1.0)
# Seeing FWHM range: from 0.025 to 5.5'' (images must have 1.5 < FWHM < 5 pixels)
# Optimized for Moffat profiles with 2<= beta <= 4.
3 10 10 1
-1.56604e+00 -2.48265e+00 -1.44564e+00 -1.24675e+00 -9.44913e-01 -5.22453e-01 4.61342e-02 8.31957e-01 2.15505e+00 2.64769e-01
3.03477e+00 2.69561e+00 3.16188e+00 3.34497e+00 3.51885e+00 3.65570e+00 3.74856e+00 3.84541e+00 4.22811e+00 3.27734e+00
-3.22480e-01 -2.12804e+00 6.50750e-01 -1.11242e+00 -1.40683e+00 -1.55944e+00 -1.84558e+00 -1.18946e-01 5.52395e-01 -4.36564e-01 -5.30052e+00
4.62594e-01 -3.29127e+00 1.10950e+00 -6.01857e-01 1.29492e-01 1.42290e+00 2.90741e+00 2.44058e+00 -9.19118e-01 8.42851e-01 -4.69824e+00
-2.57424e+00 8.96469e-01 8.34775e-01 2.18845e+00 2.46526e+00 8.60878e-02 -6.88080e-01 -1.33623e-02 9.30403e-02 1.64942e+00 -1.01231e+00
4.81041e+00 1.53747e+00 -1.12216e+00 -3.16008e+00 -1.67404e+00 -1.75767e+00 -1.29310e+00 5.59549e-01 8.08468e-01 -1.01592e-02 -7.54052e+00
1.01933e+01 -2.09484e+01 -1.07426e+00 9.87912e-01 6.05210e-01 -6.04535e-02 -5.87826e-01 -7.94117e-01 -4.89190e-01 -8.12710e-02 -2.07067e+01
-5.31793e+00 7.94240e+00 -4.64165e+00 -4.37436e+00 -1.55417e+00 7.54368e-01 1.09608e+00 1.45967e+00 1.62946e+00 -1.01301e+00 1.13514e-01
2.20336e-01 1.70056e+00 -5.20105e-01 -4.28330e-01 1.57258e-03 -3.36502e-01 -8.18568e-02 -7.16163e+00 8.23195e+00 -1.71561e-02 -1.13749e+01
3.75075e+00 7.25399e+00 -1.75325e+00 -2.68814e+00 -3.71128e+00 -4.62933e+00 -2.13747e+00 -1.89186e-01 1.29122e+00 -7.49380e-01 6.71712e-01
-8.41923e-01 4.64997e+00 5.65808e-01 -3.08277e-01 -1.01687e+00 1.73127e-01 -8.92130e-01 1.89044e+00 -2.75543e-01 -7.72828e-01 5.36745e-01
-3.65598e+00 7.56997e+00 -3.76373e+00 -1.74542e+00 -1.37540e-01 -5.55400e-01 -1.59195e-01 1.27910e-01 1.91906e+00 1.42119e+00 -4.35502e+00
-1.70059e+00 -3.65695e+00 1.22367e+00 -5.74367e-01 -3.29571e+00 2.46316e+00 5.22353e+00 2.42038e+00 1.22919e+00 -9.22250e-01 -2.32028e+00
0.00000e+00
1.00000e+00
CONV NORM
# 3x3 convolution mask of a gaussian PSF with FWHM = 1.5 pixels.
0.109853 0.300700 0.109853
0.300700 0.823102 0.300700
0.109853 0.300700 0.109853
CONV NORM
# 3x3 convolution mask of a gaussian PSF with FWHM = 2.0 pixels.
0.260856 0.483068 0.260856
0.483068 0.894573 0.483068
0.260856 0.483068 0.260856
CONV NORM
# 5x5 convolution mask of a gaussian PSF with FWHM = 2.0 pixels.
0.006319 0.040599 0.075183 0.040599 0.006319
0.040599 0.260856 0.483068 0.260856 0.040599
0.075183 0.483068 0.894573 0.483068 0.075183
0.040599 0.260856 0.483068 0.260856 0.040599
0.006319 0.040599 0.075183 0.040599 0.006319
CONV NORM
# 5x5 convolution mask of a gaussian PSF with FWHM = 2.5 pixels.
0.034673 0.119131 0.179633 0.119131 0.034673
0.119131 0.409323 0.617200 0.409323 0.119131
0.179633 0.617200 0.930649 0.617200 0.179633
0.119131 0.409323 0.617200 0.409323 0.119131
0.034673 0.119131 0.179633 0.119131 0.034673
CONV NORM
# 5x5 convolution mask of a gaussian PSF with FWHM = 3.0 pixels.
0.092163 0.221178 0.296069 0.221178 0.092163
0.221178 0.530797 0.710525 0.530797 0.221178
0.296069 0.710525 0.951108 0.710525 0.296069
0.221178 0.530797 0.710525 0.530797 0.221178
0.092163 0.221178 0.296069 0.221178 0.092163
CONV NORM
# 7x7 convolution mask of a gaussian PSF with FWHM = 3.0 pixels.
0.004963 0.021388 0.051328 0.068707 0.051328 0.021388 0.004963
0.021388 0.092163 0.221178 0.296069 0.221178 0.092163 0.021388
0.051328 0.221178 0.530797 0.710525 0.530797 0.221178 0.051328
0.068707 0.296069 0.710525 0.951108 0.710525 0.296069 0.068707
0.051328 0.221178 0.530797 0.710525 0.530797 0.221178 0.051328
0.021388 0.092163 0.221178 0.296069 0.221178 0.092163 0.021388
0.004963 0.021388 0.051328 0.068707 0.051328 0.021388 0.004963
CONV NORM
# 7x7 convolution mask of a gaussian PSF with FWHM = 4.0 pixels.
0.047454 0.109799 0.181612 0.214776 0.181612 0.109799 0.047454
0.109799 0.254053 0.420215 0.496950 0.420215 0.254053 0.109799
0.181612 0.420215 0.695055 0.821978 0.695055 0.420215 0.181612
0.214776 0.496950 0.821978 0.972079 0.821978 0.496950 0.214776
0.181612 0.420215 0.695055 0.821978 0.695055 0.420215 0.181612
0.109799 0.254053 0.420215 0.496950 0.420215 0.254053 0.109799
0.047454 0.109799 0.181612 0.214776 0.181612 0.109799 0.047454
CONV NORM
# 9x9 convolution mask of a gaussian PSF with FWHM = 5.0 pixels.
0.030531 0.065238 0.112208 0.155356 0.173152 0.155356 0.112208 0.065238 0.030531
0.065238 0.139399 0.239763 0.331961 0.369987 0.331961 0.239763 0.139399 0.065238
0.112208 0.239763 0.412386 0.570963 0.636368 0.570963 0.412386 0.239763 0.112208
0.155356 0.331961 0.570963 0.790520 0.881075 0.790520 0.570963 0.331961 0.155356
0.173152 0.369987 0.636368 0.881075 0.982004 0.881075 0.636368 0.369987 0.173152
0.155356 0.331961 0.570963 0.790520 0.881075 0.790520 0.570963 0.331961 0.155356
0.112208 0.239763 0.412386 0.570963 0.636368 0.570963 0.412386 0.239763 0.112208
0.065238 0.139399 0.239763 0.331961 0.369987 0.331961 0.239763 0.139399 0.065238
0.030531 0.065238 0.112208 0.155356 0.173152 0.155356 0.112208 0.065238 0.030531
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment