import lsst.pipe.drivers.constructCalibs
assert type(config)==lsst.pipe.drivers.constructCalibs.SkyConfig, 'config is of type %s.%s instead of lsst.pipe.drivers.constructCalibs.SkyConfig' % (type(config).__module__, type(config).__name__)
import lsst.ip.isr.isrQa
import lsst.ip.isr.straylight
import lsst.ip.isr.vignette
import lsst.pipe.drivers.background
import lsst.ip.isr.isrTask
import lsst.ip.isr.overscan
import lsst.ip.isr.crosstalk
import lsst.ip.isr.masking
import lsst.ip.isr.assembleCcdTask
import lsst.obs.subaru.strayLight.yStrayLight
import lsst.meas.algorithms.detection
import lsst.meas.algorithms.subtractBackground
import lsst.ip.isr.fringe
import lsst.pipe.base.config
# Clobber existing processed images?
config.clobber=True

# Flag to enable/disable metadata saving for a task, enabled by default.
config.isr.saveMetadata=True

# Dataset type for input data; users will typically leave this alone, but camera-specific ISR tasks will override it
config.isr.datasetType='raw'

# Fallback default filter name for calibrations.
config.isr.fallbackFilterName='HSC-R'

# Pass observation date when using fallback filter.
config.isr.useFallbackDate=False

# Expect input science images to have a WCS (set False for e.g. spectrographs).
config.isr.expectWcs=True

# FWHM of PSF in arcseconds.
config.isr.fwhm=1.0

# Calculate ISR statistics while processing?
config.isr.qa.saveStats=True

# Mesh size in X for flatness statistics
config.isr.qa.flatness.meshX=256

# Mesh size in Y for flatness statistics
config.isr.qa.flatness.meshY=256

# Clip outliers for flatness statistics?
config.isr.qa.flatness.doClip=True

# Number of sigma deviant a pixel must be to be clipped from flatness statistics.
config.isr.qa.flatness.clipSigma=3.0

# Number of iterations used for outlier clipping in flatness statistics.
config.isr.qa.flatness.nIter=3

# Write overscan subtracted image?
config.isr.qa.doWriteOss=False

# Write overscan subtracted thumbnail?
config.isr.qa.doThumbnailOss=False

# Write image after flat-field correction?
config.isr.qa.doWriteFlattened=False

# Write thumbnail after flat-field correction?
config.isr.qa.doThumbnailFlattened=False

# Thumbnail binning factor.
config.isr.qa.thumbnailBinning=4

# Number of sigma below the background to set the thumbnail minimum.
config.isr.qa.thumbnailStdev=3.0

# Total range in sigma for thumbnail mapping.
config.isr.qa.thumbnailRange=5.0

# Softening parameter for thumbnail mapping.
config.isr.qa.thumbnailQ=20.0

# Width of border around saturated pixels in thumbnail.
config.isr.qa.thumbnailSatBorder=2

# Convert integer raw images to floating point values?
config.isr.doConvertIntToFloat=True

# Mask saturated pixels? NB: this is totally independent of the interpolation option - this is ONLY setting the bits in the mask. To have them interpolated make sure doSaturationInterpolation=True
config.isr.doSaturation=True

# Name of mask plane to use in saturation detection and interpolation
config.isr.saturatedMaskName='SAT'

# The saturation level to use if no Detector is present in the Exposure (ignored if NaN)
config.isr.saturation=float('nan')

# Number of pixels by which to grow the saturation footprints
config.isr.growSaturationFootprintSize=1

# Mask suspect pixels?
config.isr.doSuspect=True

# Name of mask plane to use for suspect pixels
config.isr.suspectMaskName='SUSPECT'

# Number of edge pixels to be flagged as untrustworthy.
config.isr.numEdgeSuspect=0

# Mask edge pixels in which coordinate frame: DETECTOR or AMP?
config.isr.edgeMaskLevel='DETECTOR'

# Should we set the level of all BAD patches of the chip to the chip's average value?
config.isr.doSetBadRegions=True

# How to estimate the average value for BAD regions.
config.isr.badStatistic='MEANCLIP'

# Do overscan subtraction?
config.isr.doOverscan=True

# The method for fitting the overscan bias level.
config.isr.overscan.fitType='AKIMA_SPLINE'

# Order of polynomial to fit if overscan fit type is a polynomial, or number of spline knots if overscan fit type is a spline.
config.isr.overscan.order=30

# Rejection threshold (sigma) for collapsing overscan before fit
config.isr.overscan.numSigmaClip=3.0

# Mask planes to reject when measuring overscan
config.isr.overscan.maskPlanes=['SAT']

# Treat overscan as an integer image for purposes of fitType=MEDIAN and fitType=MEDIAN_PER_ROW.
config.isr.overscan.overscanIsInt=True

# Number of columns to skip in overscan, i.e. those closest to amplifier
config.isr.overscanNumLeadingColumnsToSkip=0

# Number of columns to skip in overscan, i.e. those farthest from amplifier
config.isr.overscanNumTrailingColumnsToSkip=0

# Maximum deviation from the median for overscan
config.isr.overscanMaxDev=1000.0

# Fit the overscan in a piecewise-fashion to correct for bias jumps?
config.isr.overscanBiasJump=False

# Header keyword containing information about devices.
config.isr.overscanBiasJumpKeyword='NO_SUCH_KEY'

# List of devices that need piecewise overscan correction.
config.isr.overscanBiasJumpDevices=['N', 'O', '_', 'S', 'U', 'C', 'H', '_', 'K', 'E', 'Y']

# Location of bias jump along y-axis.
config.isr.overscanBiasJumpLocation=-1

# Assemble amp-level exposures into a ccd-level exposure?
config.isr.doAssembleCcd=True

# trim out non-data regions?
config.isr.assembleCcd.doTrim=True

# FITS headers to remove (in addition to DATASEC, BIASSEC, TRIMSEC and perhaps GAIN)
config.isr.assembleCcd.keysToRemove=['PC001001', 'PC001002', 'PC002001', 'PC002002']

# Assemble amp-level calibration exposures into ccd-level exposure?
config.isr.doAssembleIsrExposures=False

# Trim raw data to match calibration bounding boxes?
config.isr.doTrimToMatchCalib=False

# Apply bias frame correction?
config.isr.doBias=True

# Name of the bias data product
config.isr.biasDataProductName='bias'

# Reverse order of overscan and bias correction.
config.isr.doBiasBeforeOverscan=False

# Calculate variance?
config.isr.doVariance=True

# The gain to use if no Detector is present in the Exposure (ignored if NaN)
config.isr.gain=float('nan')

# The read noise to use if no Detector is present in the Exposure
config.isr.readNoise=0.0

# Calculate empirical read noise instead of value from AmpInfo data?
config.isr.doEmpiricalReadNoise=False

# Correct for nonlinearity of the detector's response?
config.isr.doLinearize=True

# Apply intra-CCD crosstalk correction?
config.isr.doCrosstalk=True

# Apply crosstalk correction before CCD assembly, and before trimming?
config.isr.doCrosstalkBeforeAssemble=False

# Set crosstalk mask plane for pixels over this value.
config.isr.crosstalk.minPixelToMask=45000.0

# Name for crosstalk mask plane.
config.isr.crosstalk.crosstalkMaskPlane='CROSSTALK'

# Type of background subtraction to use when applying correction.
config.isr.crosstalk.crosstalkBackgroundMethod='DETECTOR'

# Ignore the detector crosstalk information in favor of CrosstalkConfig values?
config.isr.crosstalk.useConfigCoefficients=True

# Amplifier-indexed crosstalk coefficients to use.  This should be arranged as a 1 x nAmp**2 list of coefficients, such that when reshaped by crosstalkShape, the result is nAmp x nAmp. This matrix should be structured so CT * [amp0 amp1 amp2 ...]^T returns the column vector [corr0 corr1 corr2 ...]^T.
config.isr.crosstalk.crosstalkValues=[0.0, -0.000124, -0.000171, -0.000157, -0.000125, 0.0, -0.000134, -0.000151, -0.000149, -0.000132, 0.0, -0.000137, -0.000156, -0.000157, -0.000153, 0.0]

# Shape of the coefficient array.  This should be equal to [nAmp, nAmp].
config.isr.crosstalk.crosstalkShape=[4, 4]

# Apply correction for CCD defects, e.g. hot pixels?
config.isr.doDefect=True

# Mask NAN pixels?
config.isr.doNanMasking=True

# Widen bleed trails based on their width?
config.isr.doWidenSaturationTrails=True

# Apply the brighter fatter correction
config.isr.doBrighterFatter=False

# The level at which to correct for brighter-fatter.
config.isr.brighterFatterLevel='DETECTOR'

# Maximum number of iterations for the brighter fatter correction
config.isr.brighterFatterMaxIter=10

# Threshold used to stop iterating the brighter fatter correction.  It is the  absolute value of the difference between the current corrected image and the one from the previous iteration summed over all the pixels.
config.isr.brighterFatterThreshold=1000.0

# Should the gain be applied when applying the brighter fatter correction?
config.isr.brighterFatterApplyGain=True

# Number of pixels to grow the masks listed in config.maskListToInterpolate  when brighter-fatter correction is applied.
config.isr.brighterFatterMaskGrowSize=1

# Apply dark frame correction?
config.isr.doDark=False

# Name of the dark data product
config.isr.darkDataProductName='dark'

# Subtract stray light in the y-band (due to encoder LEDs)?
config.isr.doStrayLight=True

config.isr.strayLight.retarget(target=lsst.obs.subaru.strayLight.yStrayLight.SubaruStrayLightTask, ConfigClass=lsst.ip.isr.straylight.StrayLightConfig)

# 
config.isr.strayLight.doRotatorAngleCorrection=True

# Filters that need straylight correction.
config.isr.strayLight.filters=['y', 'HSC-Y']

# Apply flat field correction?
config.isr.doFlat=True

# Name of the flat data product
config.isr.flatDataProductName='flat'

# The method for scaling the flat on the fly.
config.isr.flatScalingType='USER'

# If flatScalingType is 'USER' then scale flat by this amount; ignored otherwise
config.isr.flatUserScale=1.0

# Tweak flats to match observed amplifier ratios?
config.isr.doTweakFlat=False

# Correct the amplifiers for their gains instead of applying flat correction
config.isr.doApplyGains=False

# Normalize all the amplifiers in each CCD to have the same median value.
config.isr.normalizeGains=False

# Apply fringe correction?
config.isr.doFringe=True

# Only fringe-subtract these filters
config.isr.fringe.filters=['y', 'N921', 'N926', 'N973', 'N1010']

# Search filter aliases during check.
config.isr.fringe.useFilterAliases=False

# Number of fringe measurements
config.isr.fringe.num=30000

# Half-size of small (fringe) measurements (pixels)
config.isr.fringe.small=3

# Half-size of large (background) measurements (pixels)
config.isr.fringe.large=30

# Number of fitting iterations
config.isr.fringe.iterations=20

# Sigma clip threshold
config.isr.fringe.clip=3.0

# Ignore pixels with these masks
config.isr.fringe.stats.badMaskPlanes=['SAT', 'NO_DATA', 'SUSPECT', 'BAD']

# Statistic to use
config.isr.fringe.stats.stat=32

# Sigma clip threshold
config.isr.fringe.stats.clip=3.0

# Number of fitting iterations
config.isr.fringe.stats.iterations=3

# Offset to the random number generator seed (full seed includes exposure ID)
config.isr.fringe.stats.rngSeedOffset=0

# Remove fringe pedestal?
config.isr.fringe.pedestal=False

# Do fringe subtraction after flat-fielding?
config.isr.fringeAfterFlat=True

# Measure the background level on the reduced image?
config.isr.doMeasureBackground=True

# Mask camera-specific bad regions?
config.isr.doCameraSpecificMasking=False

# 
config.isr.masking.doSpecificMasking=False

# Interpolate masked pixels?
config.isr.doInterpolate=True

# Perform interpolation over pixels masked as saturated? NB: This is independent of doSaturation; if that is False this plane will likely be blank, resulting in a no-op here.
config.isr.doSaturationInterpolation=True

# Perform interpolation over pixels masked as NaN? NB: This is independent of doNanMasking; if that is False this plane will likely be blank, resulting in a no-op here.
config.isr.doNanInterpolation=True

# If True, ensure we interpolate NaNs after flat-fielding, even if we also have to interpolate them before flat-fielding.
config.isr.doNanInterpAfterFlat=False

# List of mask planes that should be interpolated.
config.isr.maskListToInterpolate=['SAT', 'BAD', 'UNMASKEDNAN']

# Save a copy of the pre-interpolated pixel values?
config.isr.doSaveInterpPixels=False

# The approximate flux of a zero-magnitude object in a one-second exposure, per filter.
config.isr.fluxMag0T1={'g': 398107170553.49854, 'r': 398107170553.49854, 'i': 275422870333.81744, 'z': 120226443461.74132, 'y': 91201083935.59116, 'N515': 20892961308.54041, 'N816': 15848931924.611174, 'N921': 19054607179.632523}

# Default value for fluxMag0T1 (for an unrecognized filter).
config.isr.defaultFluxMag0T1=158489319246.11172

# Apply vignetting parameters?
config.isr.doVignette=True

# Center of vignetting pattern, in focal plane x coordinates.
config.isr.vignette.xCenter=-1.5

# Center of vignetting pattern, in focal plane y coordinates.
config.isr.vignette.yCenter=1.5

# Radius of vignetting pattern, in focal plane coordinates.
config.isr.vignette.radius=262.5

# Number of points used to define the vignette polygon.
config.isr.vignette.numPolygonPoints=100

# Persist polygon used to define vignetted region?
config.isr.vignette.doWriteVignettePolygon=True

# Construct and attach a wavelength-dependent throughput curve for this CCD image?
config.isr.doAttachTransmissionCurve=True

# Load and use transmission_optics (if doAttachTransmissionCurve is True)?
config.isr.doUseOpticsTransmission=True

# Load and use transmission_filter (if doAttachTransmissionCurve is True)?
config.isr.doUseFilterTransmission=True

# Load and use transmission_sensor (if doAttachTransmissionCurve is True)?
config.isr.doUseSensorTransmission=True

# Load and use transmission_atmosphere (if doAttachTransmissionCurve is True)?
config.isr.doUseAtmosphereTransmission=True

# Perform illumination correction?
config.isr.doIlluminationCorrection=False

# Name of the illumination correction data product.
config.isr.illuminationCorrectionDataProductName='illumcor'

# Scale factor for the illumination correction.
config.isr.illumScale=1.0

# Only perform illumination correction for these filters.
config.isr.illumFilters=[]

# Persist postISRCCD?
config.isr.doWrite=False

# name for connection ccdExposure
config.isr.connections.ccdExposure='raw'

# name for connection camera
config.isr.connections.camera='camera'

# name for connection crosstalk
config.isr.connections.crosstalk='crosstalk'

# name for connection crosstalkSources
config.isr.connections.crosstalkSources='isrOverscanCorrected'

# name for connection bias
config.isr.connections.bias='bias'

# name for connection dark
config.isr.connections.dark='dark'

# name for connection flat
config.isr.connections.flat='flat'

# name for connection fringes
config.isr.connections.fringes='fringe'

# name for connection strayLightData
config.isr.connections.strayLightData='yBackground'

# name for connection bfKernel
config.isr.connections.bfKernel='bfKernel'

# name for connection newBFKernel
config.isr.connections.newBFKernel='brighterFatterKernel'

# name for connection defects
config.isr.connections.defects='defects'

# name for connection opticsTransmission
config.isr.connections.opticsTransmission='transmission_optics'

# name for connection filterTransmission
config.isr.connections.filterTransmission='transmission_filter'

# name for connection sensorTransmission
config.isr.connections.sensorTransmission='transmission_sensor'

# name for connection atmosphereTransmission
config.isr.connections.atmosphereTransmission='transmission_atmosphere'

# name for connection illumMaskedImage
config.isr.connections.illumMaskedImage='illum'

# name for connection outputExposure
config.isr.connections.outputExposure='postISRCCD'

# name for connection preInterpExposure
config.isr.connections.preInterpExposure='preInterpISRCCD'

# name for connection outputOssThumbnail
config.isr.connections.outputOssThumbnail='OssThumb'

# name for connection outputFlattenedThumbnail
config.isr.connections.outputFlattenedThumbnail='FlattenedThumb'

# Key for observation date in exposure registry
config.dateObs='dateObs'

# Key for calib date in calib registry
config.dateCalib='calibDate'

# Key for filter name in exposure/calib registries
config.filter='filter'

# Number of rows to read at a time
config.combination.rows=512

# Mask planes to respect
config.combination.mask=['SAT', 'DETECTED', 'INTRP']

# Statistic to use for combination (from lsst.afw.math)
config.combination.combine=128

# Clipping threshold for combination
config.combination.clip=3.0

# Clipping iterations for combination
config.combination.nIter=3

# Statistic to use to estimate background (from lsst.afw.math)
config.combination.stats.stat=128

# Clipping threshold for background
config.combination.stats.clip=3.0

# Clipping iterations for background
config.combination.stats.nIter=3

# Maximum number of visits to estimate variance from input variance, not per-pixel spread
config.combination.stats.maxVisitsToCalcErrorFromInputVariance=2

# Mask planes to reject
config.combination.stats.mask=['DETECTED', 'BAD', 'NO_DATA']

# DataId keywords specifying a CCD
config.ccdKeys=['ccd']

# DataId keywords specifying a visit
config.visitKeys=['visit']

# DataId keywords specifying a calibration
config.calibKeys=[]

# Create camera overview image?
config.doCameraImage=True

# Binning to apply for camera image
config.binning=64

# Detection PSF gaussian sigma
config.detectSigma=2.0

# Number of iterations
config.maskObjects.nIter=3

# type of statistic to use for grid points
config.maskObjects.subtractBackground.statisticsProperty='MEANCLIP'

# behaviour if there are too few points in grid for requested interpolation style
config.maskObjects.subtractBackground.undersampleStyle='REDUCE_INTERP_ORDER'

# how large a region of the sky should be used for each background point
config.maskObjects.subtractBackground.binSize=1024

# Sky region size to be used for each background point in X direction. If 0, the binSize config is used.
config.maskObjects.subtractBackground.binSizeX=0

# Sky region size to be used for each background point in Y direction. If 0, the binSize config is used.
config.maskObjects.subtractBackground.binSizeY=0

# how to interpolate the background values. This maps to an enum; see afw::math::Background
config.maskObjects.subtractBackground.algorithm='AKIMA_SPLINE'

# Names of mask planes to ignore while estimating the background
config.maskObjects.subtractBackground.ignoredPixelMask=['BAD', 'EDGE', 'DETECTED', 'DETECTED_NEGATIVE', 'NO_DATA']

# Ignore NaNs when estimating the background
config.maskObjects.subtractBackground.isNanSafe=False

# Use Approximate (Chebyshev) to model background.
config.maskObjects.subtractBackground.useApprox=False

# Approximation order in X for background Chebyshev (valid only with useApprox=True)
config.maskObjects.subtractBackground.approxOrderX=6

# Approximation order in Y for background Chebyshev (valid only with useApprox=True)
config.maskObjects.subtractBackground.approxOrderY=-1

# Use inverse variance weighting in calculation (valid only with useApprox=True)
config.maskObjects.subtractBackground.weighting=True

# detected sources with fewer than the specified number of pixels will be ignored
config.maskObjects.detection.minPixels=1

# Pixels should be grown as isotropically as possible (slower)
config.maskObjects.detection.isotropicGrow=False

# Grow all footprints at the same time? This allows disconnected footprints to merge.
config.maskObjects.detection.combinedGrow=True

# Grow detections by nSigmaToGrow * [PSF RMS width]; if 0 then do not grow
config.maskObjects.detection.nSigmaToGrow=2.4

# Grow detections to set the image mask bits, but return the original (not-grown) footprints
config.maskObjects.detection.returnOriginalFootprints=False

# Threshold for footprints; exact meaning and units depend on thresholdType.
config.maskObjects.detection.thresholdValue=2.5

# Include threshold relative to thresholdValue
config.maskObjects.detection.includeThresholdMultiplier=1.0

# specifies the desired flavor of Threshold
config.maskObjects.detection.thresholdType='stdev'

# specifies whether to detect positive, or negative sources, or both
config.maskObjects.detection.thresholdPolarity='positive'

# Fiddle factor to add to the background; debugging only
config.maskObjects.detection.adjustBackground=0.0

# Estimate the background again after final source detection?
config.maskObjects.detection.reEstimateBackground=False

# type of statistic to use for grid points
config.maskObjects.detection.background.statisticsProperty='MEANCLIP'

# behaviour if there are too few points in grid for requested interpolation style
config.maskObjects.detection.background.undersampleStyle='REDUCE_INTERP_ORDER'

# how large a region of the sky should be used for each background point
config.maskObjects.detection.background.binSize=128

# Sky region size to be used for each background point in X direction. If 0, the binSize config is used.
config.maskObjects.detection.background.binSizeX=0

# Sky region size to be used for each background point in Y direction. If 0, the binSize config is used.
config.maskObjects.detection.background.binSizeY=0

# how to interpolate the background values. This maps to an enum; see afw::math::Background
config.maskObjects.detection.background.algorithm='AKIMA_SPLINE'

# Names of mask planes to ignore while estimating the background
config.maskObjects.detection.background.ignoredPixelMask=['BAD', 'EDGE', 'DETECTED', 'DETECTED_NEGATIVE', 'NO_DATA']

# Ignore NaNs when estimating the background
config.maskObjects.detection.background.isNanSafe=False

# Use Approximate (Chebyshev) to model background.
config.maskObjects.detection.background.useApprox=True

# Approximation order in X for background Chebyshev (valid only with useApprox=True)
config.maskObjects.detection.background.approxOrderX=6

# Approximation order in Y for background Chebyshev (valid only with useApprox=True)
config.maskObjects.detection.background.approxOrderY=-1

# Use inverse variance weighting in calculation (valid only with useApprox=True)
config.maskObjects.detection.background.weighting=True

# type of statistic to use for grid points
config.maskObjects.detection.tempLocalBackground.statisticsProperty='MEANCLIP'

# behaviour if there are too few points in grid for requested interpolation style
config.maskObjects.detection.tempLocalBackground.undersampleStyle='REDUCE_INTERP_ORDER'

# how large a region of the sky should be used for each background point
config.maskObjects.detection.tempLocalBackground.binSize=64

# Sky region size to be used for each background point in X direction. If 0, the binSize config is used.
config.maskObjects.detection.tempLocalBackground.binSizeX=0

# Sky region size to be used for each background point in Y direction. If 0, the binSize config is used.
config.maskObjects.detection.tempLocalBackground.binSizeY=0

# how to interpolate the background values. This maps to an enum; see afw::math::Background
config.maskObjects.detection.tempLocalBackground.algorithm='AKIMA_SPLINE'

# Names of mask planes to ignore while estimating the background
config.maskObjects.detection.tempLocalBackground.ignoredPixelMask=['BAD', 'EDGE', 'DETECTED', 'DETECTED_NEGATIVE', 'NO_DATA']

# Ignore NaNs when estimating the background
config.maskObjects.detection.tempLocalBackground.isNanSafe=False

# Use Approximate (Chebyshev) to model background.
config.maskObjects.detection.tempLocalBackground.useApprox=False

# Approximation order in X for background Chebyshev (valid only with useApprox=True)
config.maskObjects.detection.tempLocalBackground.approxOrderX=6

# Approximation order in Y for background Chebyshev (valid only with useApprox=True)
config.maskObjects.detection.tempLocalBackground.approxOrderY=-1

# Use inverse variance weighting in calculation (valid only with useApprox=True)
config.maskObjects.detection.tempLocalBackground.weighting=True

# Enable temporary local background subtraction? (see tempLocalBackground)
config.maskObjects.detection.doTempLocalBackground=False

# type of statistic to use for grid points
config.maskObjects.detection.tempWideBackground.statisticsProperty='MEANCLIP'

# behaviour if there are too few points in grid for requested interpolation style
config.maskObjects.detection.tempWideBackground.undersampleStyle='REDUCE_INTERP_ORDER'

# how large a region of the sky should be used for each background point
config.maskObjects.detection.tempWideBackground.binSize=512

# Sky region size to be used for each background point in X direction. If 0, the binSize config is used.
config.maskObjects.detection.tempWideBackground.binSizeX=0

# Sky region size to be used for each background point in Y direction. If 0, the binSize config is used.
config.maskObjects.detection.tempWideBackground.binSizeY=0

# how to interpolate the background values. This maps to an enum; see afw::math::Background
config.maskObjects.detection.tempWideBackground.algorithm='AKIMA_SPLINE'

# Names of mask planes to ignore while estimating the background
config.maskObjects.detection.tempWideBackground.ignoredPixelMask=['BAD', 'EDGE', 'NO_DATA']

# Ignore NaNs when estimating the background
config.maskObjects.detection.tempWideBackground.isNanSafe=False

# Use Approximate (Chebyshev) to model background.
config.maskObjects.detection.tempWideBackground.useApprox=False

# Approximation order in X for background Chebyshev (valid only with useApprox=True)
config.maskObjects.detection.tempWideBackground.approxOrderX=6

# Approximation order in Y for background Chebyshev (valid only with useApprox=True)
config.maskObjects.detection.tempWideBackground.approxOrderY=-1

# Use inverse variance weighting in calculation (valid only with useApprox=True)
config.maskObjects.detection.tempWideBackground.weighting=True

# Do temporary wide (large-scale) background subtraction before footprint detection?
config.maskObjects.detection.doTempWideBackground=False

# The maximum number of peaks in a Footprint before trying to replace its peaks using the temporary local background
config.maskObjects.detection.nPeaksMaxSimple=1

# Multiple of PSF RMS size to use for convolution kernel bounding box size; note that this is not a half-size. The size will be rounded up to the nearest odd integer
config.maskObjects.detection.nSigmaForKernel=7.0

# Mask planes to ignore when calculating statistics of image (for thresholdType=stdev)
config.maskObjects.detection.statsMask=['BAD', 'SAT', 'EDGE', 'NO_DATA']

# Detection threshold (standard deviations)
config.maskObjects.detectSigma=5.0

# Interpolate when removing objects?
config.maskObjects.doInterpolate=True

# type of statistic to use for grid points
config.maskObjects.interpolate.statisticsProperty='MEANCLIP'

# behaviour if there are too few points in grid for requested interpolation style
config.maskObjects.interpolate.undersampleStyle='REDUCE_INTERP_ORDER'

# how large a region of the sky should be used for each background point
config.maskObjects.interpolate.binSize=256

# Sky region size to be used for each background point in X direction. If 0, the binSize config is used.
config.maskObjects.interpolate.binSizeX=0

# Sky region size to be used for each background point in Y direction. If 0, the binSize config is used.
config.maskObjects.interpolate.binSizeY=0

# how to interpolate the background values. This maps to an enum; see afw::math::Background
config.maskObjects.interpolate.algorithm='AKIMA_SPLINE'

# Names of mask planes to ignore while estimating the background
config.maskObjects.interpolate.ignoredPixelMask=['BAD', 'EDGE', 'DETECTED', 'DETECTED_NEGATIVE', 'NO_DATA']

# Ignore NaNs when estimating the background
config.maskObjects.interpolate.isNanSafe=False

# Use Approximate (Chebyshev) to model background.
config.maskObjects.interpolate.useApprox=False

# Approximation order in X for background Chebyshev (valid only with useApprox=True)
config.maskObjects.interpolate.approxOrderX=6

# Approximation order in Y for background Chebyshev (valid only with useApprox=True)
config.maskObjects.interpolate.approxOrderY=-1

# Use inverse variance weighting in calculation (valid only with useApprox=True)
config.maskObjects.interpolate.weighting=True

# Bin size in x
config.largeScaleBackground.xSize=122.88

# Bin size in y
config.largeScaleBackground.ySize=122.88

# Pixel size in same units as xSize/ySize
config.largeScaleBackground.pixelSize=0.015

# Minimum fraction of bin size for good measurement
config.largeScaleBackground.minFrac=0.1

# Mask planes to treat as bad
config.largeScaleBackground.mask=['BAD', 'SAT', 'INTRP', 'DETECTED', 'DETECTED_NEGATIVE', 'EDGE', 'NO_DATA']

# how to interpolate the background values. This maps to an enum; see afw::math::Background
config.largeScaleBackground.interpolation='AKIMA_SPLINE'

# Do smoothing?
config.largeScaleBackground.doSmooth=False

# Smoothing scale, as a multiple of the bin size
config.largeScaleBackground.smoothScale=2.0

# Binning to use for CCD background model (pixels)
config.largeScaleBackground.binning=64

# k-sigma rejection iterations for sky scale
config.sky.skyIter=3

# k-sigma rejection threshold for sky scale
config.sky.skyRej=3.0

# type of statistic to use for grid points
config.sky.background.statistic='MEANCLIP'

# Superpixel size in x
config.sky.background.xBinSize=32

# Superpixel size in y
config.sky.background.yBinSize=32

# How to interpolate the background values. This maps to an enum; see afw::math::Background
config.sky.background.algorithm='NATURAL_SPLINE'

# Names of mask planes to ignore while estimating the background
config.sky.background.mask=['SAT', 'BAD', 'EDGE', 'DETECTED', 'DETECTED_NEGATIVE', 'NO_DATA']

# Number of samples in x for scaling sky frame
config.sky.xNumSamples=4

# Number of samples in y for scaling sky frame
config.sky.yNumSamples=4

# type of statistic to use for grid points
config.sky.stats.statistic='MEANCLIP'

# Clipping threshold for background
config.sky.stats.clip=3.0

# Clipping iterations for background
config.sky.stats.nIter=3

# Mask planes to reject
config.sky.stats.mask=['SAT', 'DETECTED', 'DETECTED_NEGATIVE', 'BAD', 'NO_DATA']

# k-sigma threshold for masking pixels
config.maskThresh=3.0

# Mask planes to consider as contaminated
config.mask=['BAD', 'SAT', 'DETECTED', 'NO_DATA']

