Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added DECam to setup, updated DCTLMI in telescopes.py #32

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,11 @@ def add_results(data, imagestretch='linear'):
'log': LogStretch()}[imagestretch])
# extract aperture radius
if _pp_conf.photmode == 'APER':
aprad = float(hdulist[0].header['APRAD'])
try:# 12/20/17 COC: added try/except clause
aprad = float(hdulist[0].header['APRAD'])
except KeyError as msg:
print('Unable to locate aperture radius, no circle will be drawn.')
aprad = None

# create plot
#plotsize = 7. # inches
Expand All @@ -856,7 +860,7 @@ def add_results(data, imagestretch='linear'):
color='white')

# place aperture
if _pp_conf.photmode == 'APER':
if _pp_conf.photmode == 'APER' and aprad != None:# 12/20/17 COC: added clause to handle missing aprad case (no aprad)
targetpos = plt.Circle((boxsize/2, boxsize/2),
aprad, ec='red', fc='none',
linewidth=1)
Expand All @@ -877,6 +881,12 @@ def add_results(data, imagestretch='linear'):
target.translate(_pp_conf.target2filename) + '_' + \
fitsfilename[:fitsfilename.find('.fit')] + \
'_thumb.png'

# 11/17/17 COC: outputting x,y pixel coordinates to file (commit 12/27/2017)
coordfilename = thumbfilename.split('_thumb.png')[0] + '_coords.lst'
with open(coordfilename,'w') as f:
f.writelines(str(exp_x) + ',' + str(exp_y))

plt.savefig(thumbfilename, format='png',
bbox_inches='tight',
pad_inches=0)
Expand Down
20 changes: 12 additions & 8 deletions pp_register.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

def register(filenames, telescope, sex_snr, source_minarea, aprad,
mancat, obsparam, source_tolerance, display=False,
diagnostics=False):
diagnostics=False, keep_wcs=False):#12/27/17 COC: added keep_wcs=False
"""
registration wrapper
output: diagnostic properties
Expand Down Expand Up @@ -167,9 +167,9 @@ def register(filenames, telescope, sex_snr, source_minarea, aprad,

# download catalog and write to ldac file for SCAMP
astcat = catalog(refcat, display=True)
n_sources = astcat.download_catalog(ra, dec,
rad+obsparam['reg_search_radius'],
100000,
n_sources = astcat.download_catalog(ra_deg=ra, dec_deg=dec,#12/27/17 COC: explicit keywords
rad_deg=rad+obsparam['reg_search_radius'],
max_sources=100000,
max_mag=obsparam['reg_max_mag'],
save_catalog=True)

Expand Down Expand Up @@ -290,8 +290,9 @@ def register(filenames, telescope, sex_snr, source_minarea, aprad,
'CD2_2', 'RADESYS']
hdu = fits.open(filename, mode='update', verify='silentfix',
ignore_missing_end=True)
for fake_key in fake_wcs_keys:
hdu[0].header[fake_key] = ''
if not keep_wcs:# 12/27/17 COC: adding keep_wcs option here
for fake_key in fake_wcs_keys:
hdu[0].header[fake_key] = ''

# read new header files
newhead = open(filename[:filename.find('.fit')]+'.head','r').readlines()
Expand Down Expand Up @@ -377,13 +378,17 @@ def register(filenames, telescope, sex_snr, source_minarea, aprad,
default=None)
parser.add_argument("-cat", help='manually select reference catalog',
choices=_pp_conf.allcatalogs, default=None)
parser.add_argument("-keep_wcs",#12/27/17 COC: added
help='retain original wcs header information',
action='store_true',default=False)
parser.add_argument('images', help='images to process', nargs='+')

args = parser.parse_args()
snr = float(args.snr)
source_minarea = float(args.minarea)
mancat = args.cat
source_tolerance = args.source_tolerance
keep_wcs = args.keep_wcs#12/27/17 COC: added
filenames = args.images


Expand Down Expand Up @@ -424,6 +429,5 @@ def register(filenames, telescope, sex_snr, source_minarea, aprad,
registration = register(filenames, telescope, snr,
source_minarea, aprad, mancat, obsparam,
source_tolerance,
display=True, diagnostics=True)

display=True, diagnostics=True, keep_wcs=False)#12/27/17 COC: added keep_wcs=False

29 changes: 20 additions & 9 deletions pp_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def run_the_pipeline(filenames, man_targetname, man_filtername,
header = hdulist[0].header
for key in _pp_conf.instrument_keys:
if key in header:
instruments.append(header[key])
instruments.append(header[key].strip())#9/20/17 COC: printing, adding .strip()
break

if len(filenames) == 0:
Expand Down Expand Up @@ -183,7 +183,10 @@ def run_the_pipeline(filenames, man_targetname, man_filtername,
### prepare fits files for photometry pipeline
preparation = pp_prepare.prepare(filenames, obsparam,
change_header,
diagnostics=True, display=True)
diagnostics=True,
display=True,
keep_wcs=keep_wcs#12/27/17 COC: added
)


### run wcs registration
Expand All @@ -193,12 +196,17 @@ def run_the_pipeline(filenames, man_targetname, man_filtername,
aprad = obsparam['aprad_default']

print('\n----- run image registration\n')
registration = pp_register.register(filenames, telescope, snr,
source_minarea, aprad,
None, obsparam,
obsparam['source_tolerance'],
registration = pp_register.register(filenames,#9/21/17 COC: changed most from positional to named arguments
telescope=telescope,
sex_snr=snr,
source_minarea=source_minarea,
aprad=aprad,
mancat=None,
obsparam=obsparam,
source_tolerance=obsparam['source_tolerance'],
display=True,
diagnostics=True)
diagnostics=True
)


if len(registration['badfits']) == len(filenames):
Expand Down Expand Up @@ -357,7 +365,10 @@ def run_the_pipeline(filenames, man_targetname, man_filtername,
default='high')
parser.add_argument('-solar',
help='restrict to solar-color stars',
action="store_true", default=False)
action="store_true", default=False)
parser.add_argument("-keep_wcs",#12/27/17 COC adding here from/for pp_prepare
help='retain original wcs header information',
action='store_true', default=False)
parser.add_argument('images', help='images to process or \'all\'',
nargs='+')

Expand All @@ -369,7 +380,7 @@ def run_the_pipeline(filenames, man_targetname, man_filtername,
source_tolerance = args.source_tolerance
solar = args.solar
filenames = args.images

keep_wcs = args.keep_wcs

##### if filenames = ['all'], walk through directories and run pipeline
# each dataset
Expand Down
142 changes: 142 additions & 0 deletions setup/decam.scamp
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
# Default configuration file for SCAMP 2.0.4
# EB 2015-04-02
#

#----------------------------- Field grouping ---------------------------------

FGROUP_RADIUS 1.0 # Max dist (deg) between field groups

#---------------------------- Reference catalogs ------------------------------

REF_SERVER cocat1.u-strasbg.fr # Internet addresses of catalog servers
#REF_PORT 80 # Ports to connect to catalog servers
#CDSCLIENT_EXEC aclient_cgi # CDSclient executable
ASTREF_CATALOG 2MASS # NONE, FILE, USNO-A1,USNO-A2,USNO-B1,
# GSC-1.3,GSC-2.2,GSC-2.3,
# TYCHO-2, UCAC-1,UCAC-2,UCAC-3,UCAC-4,
# NOMAD-1, PPMX, CMC-14, 2MASS, DENIS-3,
# SDSS-R3,SDSS-R5,SDSS-R6,SDSS-R7,
# SDSS-R8, SDSS-R9
ASTREF_BAND DEFAULT # Photom. band for astr.ref.magnitudes
# or DEFAULT, BLUEST, or REDDEST
ASTREFCAT_NAME astrefcat.cat # Local astrometric reference catalogs
ASTREFCENT_KEYS XWIN_WORLD,YWIN_WORLD # Local ref.cat. centroid parameters
ASTREFERR_KEYS ERRAWIN_WORLD, ERRBWIN_WORLD, ERRTHETAWIN_WORLD
# Local ref.cat. err. ellipse params
ASTREFMAG_KEY MAG # Local ref.cat. magnitude parameter
ASTREFMAGERR_KEY MAGERR # Local ref.cat. mag. error parameter
ASTREFOBSDATE_KEY OBSDATE # Local ref.cat. obs. date parameter
ASTREFMAG_LIMITS -99.0,99.0 # Select magnitude range in ASTREF_BAND
SAVE_REFCATALOG Y # Save ref catalogs in FITS-LDAC format?
REFOUT_CATPATH . # Save path for reference catalogs

#--------------------------- Merged output catalogs ---------------------------

MERGEDOUTCAT_TYPE NONE # NONE, ASCII_HEAD, ASCII, FITS_LDAC
MERGEDOUTCAT_NAME merged.cat # Merged output catalog filename

#--------------------------- Full output catalogs ---------------------------

FULLOUTCAT_TYPE NONE # NONE, ASCII_HEAD, ASCII, FITS_LDAC
FULLOUTCAT_NAME full.cat # Full output catalog filename

#----------------------------- Pattern matching -------------------------------

MATCH Y # Do pattern-matching (Y/N) ?
MATCH_NMAX 0 # Max.number of detections for MATCHing
# (0=auto)
PIXSCALE_MAXERR 1.2 # Max scale-factor uncertainty#1.2 from 1.1 per dctlmi.scamp 9/20/17 COC
POSANGLE_MAXERR 180.0 # Max position-angle uncertainty (deg)#5.0 to 180.0 per DCTLMI.scamp 9/20/17 COC
POSITION_MAXERR 5.0 # Max positional uncertainty (arcmin)
MATCH_RESOL 0 # Matching resolution (arcsec); 0=auto
MATCH_FLIPPED Y # Allow matching with flipped axes?
MOSAIC_TYPE UNCHANGED # UNCHANGED, SAME_CRVAL, SHARE_PROJAXIS,
# FIX_FOCALPLANE or LOOSE
FIXFOCALPLANE_NMIN 1 # Min number of dets for FIX_FOCALPLANE

#---------------------------- Cross-identification ----------------------------

CROSSID_RADIUS 1.0 # Cross-id initial radius (arcsec)

#---------------------------- Astrometric solution ----------------------------

SOLVE_ASTROM Y # Compute astrometric solution (Y/N) ?
PROJECTION_TYPE SAME # SAME, TPV or TAN
ASTRINSTRU_KEY FILTER,QRUNID # FITS keyword(s) defining the astrom
STABILITY_TYPE INSTRUMENT # EXPOSURE, PRE-DISTORTED or INSTRUMENT
CENTROID_KEYS XWIN_IMAGE,YWIN_IMAGE # Cat. parameters for centroiding
CENTROIDERR_KEYS ERRAWIN_IMAGE,ERRBWIN_IMAGE,ERRTHETAWIN_IMAGE
# Cat. params for centroid err ellipse
DISTORT_KEYS XWIN_IMAGE,YWIN_IMAGE # Cat. parameters or FITS keywords
DISTORT_GROUPS 1,1 # Polynom group for each context key
DISTORT_DEGREES 3 # Polynom degree for each group
FOCDISTORT_DEGREE 1 # Polynom degree for focal plane coords
ASTREF_WEIGHT 1.0 # Relative weight of ref.astrom.cat.
ASTRACCURACY_TYPE SIGMA-ARCSEC # SIGMA-PIXEL, SIGMA-ARCSEC,
# or TURBULENCE-ARCSEC
ASTRACCURACY_KEY ASTRACCU # FITS keyword for ASTR_ACCURACY param.
ASTR_ACCURACY 0.01 # Astrom. uncertainty floor parameter
ASTRCLIP_NSIGMA 1.5 # Astrom. clipping threshold in sigmas
COMPUTE_PARALLAXES N # Compute trigonom. parallaxes (Y/N)?
COMPUTE_PROPERMOTIONS N # Compute proper motions (Y/N)?
CORRECT_COLOURSHIFTS N # Correct for colour shifts (Y/N)?
INCLUDE_ASTREFCATALOG Y # Include ref.cat in prop.motions (Y/N)?
ASTR_FLAGSMASK 0x00fc # Astrometry rejection mask on SEx FLAGS
ASTR_IMAFLAGSMASK 0x0 # Astrometry rejection mask on IMAFLAGS

#---------------------------- Photometric solution ----------------------------

SOLVE_PHOTOM N # Compute photometric solution (Y/N) ?
MAGZERO_OUT 0.0 # Magnitude zero-point(s) in output
MAGZERO_INTERR 0.01 # Internal mag.zero-point accuracy
MAGZERO_REFERR 0.03 # Photom.field mag.zero-point accuracy
PHOTINSTRU_KEY FILTER # FITS keyword(s) defining the photom.
MAGZERO_KEY PHOT_C # FITS keyword for the mag zero-point
EXPOTIME_KEY EXPTIME # FITS keyword for the exposure time (s)
AIRMASS_KEY AIRMASS # FITS keyword for the airmass
EXTINCT_KEY PHOT_K # FITS keyword for the extinction coeff
PHOTOMFLAG_KEY PHOTFLAG # FITS keyword for the photometry flag
PHOTFLUX_KEY FLUX_ISOCOR # Catalog param. for the flux measurement
PHOTFLUXERR_KEY FLUXERR_ISOCOR # Catalog parameter for the flux error
PHOTCLIP_NSIGMA 1.5 # Photom.clipping threshold in sigmas
PHOT_ACCURACY 1e-3 # Photometric uncertainty floor (frac.)
PHOT_FLAGSMASK 0x00fc # Photometry rejection mask on SEx FLAGS
PHOT_IMAFLAGSMASK 0x0 # Photometry rejection mask on IMAFLAGS

#------------------------------- Check-plots ----------------------------------

CHECKPLOT_CKEY SCAMPCOL # FITS keyword for PLPLOT field colour
CHECKPLOT_DEV PSC # 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 FGROUPS,DISTORTION,ASTR_REFERROR2D,ASTR_REFERROR1D,ASTR_CHI2
CHECKPLOT_NAME fgroups,distort,referror2d,astr_referror1d,astr_chi2 # Check-plot filename(s)

#------------------------------- Check-images ---------------------------------

CHECKIMAGE_TYPE NONE # NONE, AS_PAIR, AS_REFPAIR, or AS_XCORR
CHECKIMAGE_NAME check.fits # Check-image filename(s)

#------------------------------ Miscellaneous ---------------------------------

SN_THRESHOLDS 3.0,50.0 # S/N thresholds (in sigmas) for all and
# high-SN sample
FWHM_THRESHOLDS 1.0,10.0 # FWHM thresholds (in pixels) for sources
ELLIPTICITY_MAX 0.8 # Max. source ellipticity
FLAGS_MASK 0x00f0 # Global rejection mask on SEx FLAGS
WEIGHTFLAGS_MASK 0x00ff # Global rejec. mask on SEx FLAGS_WEIGHT
IMAFLAGS_MASK 0x0 # Global rejec. mask on SEx IMAFLAGS_ISO
AHEADER_GLOBAL scamp.ahead # Filename of the global INPUT header
AHEADER_SUFFIX .ahead # Filename extension for additional
# INPUT headers
HEADER_SUFFIX .head # Filename extension for OUTPUT headers
HEADER_TYPE NORMAL # NORMAL or FOCAL_PLANE
VERBOSE_TYPE NORMAL # QUIET, NORMAL, LOG or FULL
WRITE_XML Y # Write XML file (Y/N)?
XML_NAME scamp_output.xml # Filename for XML output
XSL_URL file:///usr/local/share/scamp/scamp.xsl
# Filename for XSL style-sheet
NTHREADS 0 # Number of simultaneous threads for
# the SMP version of SCAMP
# 0 = automatic
Loading