Skip to content

Commit

Permalink
Add config for w_2018_07
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicoals Chotard committed Feb 20, 2018
1 parent 4bc7f52 commit 74d9cc7
Show file tree
Hide file tree
Showing 31 changed files with 776 additions and 43 deletions.
1 change: 1 addition & 0 deletions config/w_2018_07/cfht/_mapper
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lsst.obs.cfht.MegacamMapper
7 changes: 7 additions & 0 deletions config/w_2018_07/cfht/assembleCoaddConfig.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#I am not sure about the following line <== To be checked
config.badMaskPlanes = ("BAD", "EDGE", "SAT", "INTRP", "NO_DATA",)

# config.doMatchBackgrounds = False

# Mask planes to remove before coadding
config.removeMaskPlanes=['NOT_DEBLENDED'] # ['CROSSTALK', 'NOT_DEBLENDED']
1 change: 1 addition & 0 deletions config/w_2018_07/cfht/detectCoaddConfig.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Configuration file for detectCoaddSources
22 changes: 22 additions & 0 deletions config/w_2018_07/cfht/forcedPhotCcdConfig.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import lsst.meas.modelfit
import lsst.shapelet

# ==> WARNING <== CModel cannot be run on forcedCcd at the moment
#config.measurement.plugins.names |= ["modelfit_DoubleShapeletPsfApprox", "modelfit_CModel"]
#config.measurement.slots.modelFlux = "modelfit_CModel"

# modelfit_CModel is the default to compute source extendedness, so we have to redefine the modelFlux
config.measurement.slots.modelFlux = "base_GaussianFlux"


import lsst.meas.extensions.shapeHSM
config.measurement.plugins.names |= ["ext_shapeHSM_HsmShapeRegauss", "ext_shapeHSM_HsmSourceMoments",
"ext_shapeHSM_HsmPsfMoments"]
config.measurement.plugins['ext_shapeHSM_HsmShapeRegauss'].deblendNChild=''
config.measurement.slots.shape = "ext_shapeHSM_HsmSourceMoments"

config.doApCorr=True

#config.measurement.plugins['base_PixelFlags'].masksFpAnywhere.append('CLIPPED')
#config.measurement.plugins['base_PixelFlags'].masksFpCenter.append('BRIGHT_OBJECT')
#config.measurement.plugins['base_PixelFlags'].masksFpAnywhere.append('BRIGHT_OBJECT')
12 changes: 12 additions & 0 deletions config/w_2018_07/cfht/forcedPhotCoaddConfig.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import lsst.meas.modelfit
import lsst.shapelet

config.measurement.plugins.names |= ["modelfit_GeneralShapeletPsfApprox", "modelfit_DoubleShapeletPsfApprox", "modelfit_CModel"]
config.measurement.slots.modelFlux = "modelfit_CModel"

config.doApCorr=True

#config.measurement.plugins['base_PixelFlags'].masksFpAnywhere.append('CLIPPED')
# These do not work anymore??
#config.measurement.plugins['base_PixelFlags'].masksFpCenter.append('BRIGHT_OBJECT')
#config.measurement.plugins['base_PixelFlags'].masksFpAnywhere.append('BRIGHT_OBJECT')
6 changes: 6 additions & 0 deletions config/w_2018_07/cfht/jointcalCoaddConfig.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# overrides for pipe_tasks CoaddTask.ConfigClass

config.bgSubtracted=True

# The following should be set to True if one wants to use the WCS updated by jointcal
config.doApplyUberCal=True
54 changes: 54 additions & 0 deletions config/w_2018_07/cfht/jointcalConfig.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Configuration file for jointcal

from lsst.meas.algorithms import LoadIndexedReferenceObjectsTask

# Select external catalogs for Astrometry
config.astrometryRefObjLoader.retarget(LoadIndexedReferenceObjectsTask)
config.astrometryRefObjLoader.ref_dataset_name='pan-starrs'
config.astrometryRefObjLoader.filterMap = {
'u':'g',
'g':'g',
'r':'r',
'r2':'r',
'i':'i',
'i2': 'i',
'i3': 'i',
'z':'z',
'y':'y',
}

# Type of model to fit to astrometry
# Allowed values:
# simplePoly One polynomial per ccd
# constrainedPoly One polynomial per ccd, and one polynomial per visit
# None Field is optional
#
config.astrometryModel='simplePoly' # for the record (default value)

# Select external catalogs for Photometry
config.doPhotometry = False # True # comment out to run the photometric calibration
config.photometryRefObjLoader.retarget(LoadIndexedReferenceObjectsTask)
config.photometryRefObjLoader.ref_dataset_name='sdss'
config.photometryRefObjLoader.filterMap = {
'u': 'U',
'g': 'G',
'r': 'R',
'r2': 'R',
'i': 'I',
'i2': 'I',
'i3': 'I',
'z': 'Z',
'y': 'Z',
}

# These are the default values

# Minimum allowed signal-to-noise ratio for sources used for matching
# (in the flux specified by sourceFluxType); <= 0 for no limit
# config.sourceSelector['matcher'].minSnr = 40.0

# Minimum allowed signal-to-noise ratio for sources used for matching
# (in the flux specified by sourceFluxType); <= 0 for no limit
config.sourceSelector['astrometry'].minSnr = 40.0 # default is 10


9 changes: 9 additions & 0 deletions config/w_2018_07/cfht/makeDiscreteSkyMapConfig.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This is the SkyMap configuration file for CFHT / Megacam

config.skyMap.projection='TAN'

# dimensions of inner region of patches (x,y pixels)
config.skyMap.patchInnerDimensions=[4000, 4000]

# nominal pixel scale (arcsec/pixel)
config.skyMap.pixelScale=0.185
5 changes: 5 additions & 0 deletions config/w_2018_07/cfht/makeSkyMapConfig.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
config.skyMap.name = "rings"
config.skyMap["rings"].numRings = 120
config.skyMap["rings"].projection = "TAN"
config.skyMap["rings"].tractOverlap = 1.0/60 # Overlap between tracts (degrees)
config.skyMap["rings"].pixelScale = 0.185
47 changes: 47 additions & 0 deletions config/w_2018_07/cfht/measureCoaddSourcesConfig.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Configuration file for measureCoaddSources

import lsst.meas.extensions.shapeHSM
hsm_plugins = set([
"ext_shapeHSM_HsmShapeBj", # Bernstein & Jarvis 2002
"ext_shapeHSM_HsmShapeLinear", # Hirata & Seljak 2003
"ext_shapeHSM_HsmShapeKsb", # KSB 1995
"ext_shapeHSM_HsmShapeRegauss", # Hirata & Seljak 2003
"ext_shapeHSM_HsmSourceMoments",# Not PSF corrected; used by all of the above
"ext_shapeHSM_HsmPsfMoments", # Moments of the PSF, used by all of the above
])
config.measurement.plugins.names |= hsm_plugins

config.measurement.plugins['ext_shapeHSM_HsmShapeRegauss'].deblendNChild=''
config.measurement.slots.shape = "ext_shapeHSM_HsmSourceMoments"

import lsst.meas.modelfit
import lsst.shapelet
import lsst.meas.extensions.convolved # noqa: Load flux.convolved algorithm
#import lsst.meas.extensions.photometryKron
# root.algorithms.names |= ["flux.kron"]
config.measurement.plugins.names |= ["modelfit_DoubleShapeletPsfApprox",
"modelfit_CModel",
"ext_convolved_ConvolvedFlux"]
config.measurement.plugins["ext_convolved_ConvolvedFlux"].seeing.append(8.0)
config.measurement.slots.modelFlux = "modelfit_CModel"

config.doApCorr=True

# Name of the ingested reference dataset
config.match.refObjLoader.ref_dataset_name='sdss'

# Mapping of camera filter name: reference catalog filter name; each reference filter must exist
config.match.refObjLoader.filterMap={
'u': 'U',
'g': 'G',
'r': 'R',
'r2': 'R',
'i': 'I',
'i2': 'I',
'i3': 'I',
'z': 'Z',
'y': 'Z',
}

# Maximum linear dimension for footprints before they are ignored as large; non-positive means no threshold applied
config.deblend.maxFootprintSize=2000 # same as for processCcd
1 change: 1 addition & 0 deletions config/w_2018_07/cfht/mergeCoaddDetectionsConfig.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
config.priorityList = ["i", "r", "z", "g", "u",]
1 change: 1 addition & 0 deletions config/w_2018_07/cfht/mergeCoaddMeasurementsConfig.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
config.priorityList = ["i", "r", "z", "g", "u",]
122 changes: 122 additions & 0 deletions config/w_2018_07/cfht/processCcdConfig.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
# Apply the brighter fatter correction
config.isr.doBrighterFatter=False

config.charImage.repair.cosmicray.nCrPixelMax=1000000

# Useful to get to avoid deblending of satellite tracks
config.calibrate.deblend.maxFootprintSize=2000 # 2200

# Use psfex instead of pca
import lsst.meas.extensions.psfex.psfexPsfDeterminer
config.charImage.measurePsf.psfDeterminer.name='psfex'

# The following should be included for u filter in order to lower the source detection threshold
#config.charImage.detection.includeThresholdMultiplier=1.0

# Run CModel
import lsst.meas.modelfit
import lsst.meas.extensions.convolved # noqa: Load flux.convolved algorithm
config.charImage.measurement.plugins.names |= ["modelfit_DoubleShapeletPsfApprox",
"modelfit_CModel",
"ext_convolved_ConvolvedFlux"]

# Run astrometry using the new htm reference catalog format
# The following retargets are necessary until the new scheme becomes standard
from lsst.meas.algorithms import LoadIndexedReferenceObjectsTask
config.calibrate.astromRefObjLoader.retarget(LoadIndexedReferenceObjectsTask)
config.calibrate.photoRefObjLoader.retarget(LoadIndexedReferenceObjectsTask)

# Use new astrometry fitter
from lsst.meas.astrom import FitSipDistortionTask
config.calibrate.astrometry.wcsFitter.retarget(FitSipDistortionTask)

config.calibrate.astrometry.wcsFitter.order = 3
config.calibrate.astrometry.matcher.maxMatchDistArcSec=5

# Select external catalogs for Astrometry and Photometry
config.calibrate.photoRefObjLoader.ref_dataset_name='sdss'
#config.calibrate.astromRefObjLoader.ref_dataset_name='gaia'
config.calibrate.astromRefObjLoader.ref_dataset_name='pan-starrs'
#config.calibrate.astromRefObjLoader.ref_dataset_name='sdss'

# Astrometry with panstarrs
config.calibrate.astromRefObjLoader.filterMap = {
'u':'g',
'g':'g',
'r':'r',
'r2':'r',
'i':'i',
'i2': 'i',
'i3': 'i',
'z':'z',
'y':'y',
}
# Astrometry with gaia
#config.calibrate.astromRefObjLoader.filterMap = {
# 'u':'phot_g_mean_mag',
# 'g':'phot_g_mean_mag',
# 'r':'phot_g_mean_mag',
# 'i':'phot_g_mean_mag',
# 'z':'phot_g_mean_mag',
# 'y':'phot_g_mean_mag',
#}
# Photometry with sdss
config.calibrate.photoRefObjLoader.filterMap = {
'u': 'U',
'g': 'G',
'r': 'R',
'r2': 'R',
'i': 'I',
'i2': 'I',
'i3': 'I',
'z': 'Z',
'y': 'Z',
}

#Astrometry with sdss
#config.calibrate.astromRefObjLoader.filterMap = {
# 'u': 'U',
# 'g': 'G',
# 'r': 'R',
# 'i': 'I',
# 'z': 'Z',
# 'y': 'Z',
#}

import lsst.pipe.tasks.colorterms
config.calibrate.photoCal.colorterms.data['e2v'].data['i2']=lsst.pipe.tasks.colorterms.Colorterm()
config.calibrate.photoCal.colorterms.data['e2v'].data['i2'].c2=0.0
config.calibrate.photoCal.colorterms.data['e2v'].data['i2'].c1=0.003
config.calibrate.photoCal.colorterms.data['e2v'].data['i2'].c0=0.0
config.calibrate.photoCal.colorterms.data['e2v'].data['i2'].primary='i'
config.calibrate.photoCal.colorterms.data['e2v'].data['i2'].secondary='r'
config.calibrate.photoCal.colorterms.data['e2v'].data['i3']=lsst.pipe.tasks.colorterms.Colorterm()
config.calibrate.photoCal.colorterms.data['e2v'].data['i3'].c2=0.0
config.calibrate.photoCal.colorterms.data['e2v'].data['i3'].c1=0.003
config.calibrate.photoCal.colorterms.data['e2v'].data['i3'].c0=0.0
config.calibrate.photoCal.colorterms.data['e2v'].data['i3'].primary='i'
config.calibrate.photoCal.colorterms.data['e2v'].data['i3'].secondary='r'
config.calibrate.photoCal.colorterms.data['e2v'].data['r2']=lsst.pipe.tasks.colorterms.Colorterm()
config.calibrate.photoCal.colorterms.data['e2v'].data['r2'].c2=0.0
config.calibrate.photoCal.colorterms.data['e2v'].data['r2'].c1=0.024
config.calibrate.photoCal.colorterms.data['e2v'].data['r2'].c0=0.0
config.calibrate.photoCal.colorterms.data['e2v'].data['r2'].primary='r'
config.calibrate.photoCal.colorterms.data['e2v'].data['r2'].secondary='g'

# use Chebyshev background estimation
config.charImage.background.useApprox=True
config.charImage.detection.background.binSize=128
config.charImage.detection.background.useApprox=True
config.charImage.background.binSize = 128
config.charImage.background.undersampleStyle = 'REDUCE_INTERP_ORDER'
config.charImage.detection.background.binSize = 128
config.charImage.detection.background.undersampleStyle='REDUCE_INTERP_ORDER'
config.charImage.detection.background.binSize = 128
config.charImage.detection.background.undersampleStyle = 'REDUCE_INTERP_ORDER'


# Convolved fluxes can fail for small target seeing if the observation seeing is larger
if "ext_convolved_ConvolvedFlux" in config.charImage.measurement.plugins:
config.charImage.measurement.plugins["ext_convolved_ConvolvedFlux"].seeing.append(8.0)
names = config.charImage.measurement.plugins["ext_convolved_ConvolvedFlux"].getAllResultNames()
config.charImage.measureApCorr.allowFailure += names
Loading

0 comments on commit 74d9cc7

Please sign in to comment.