コード例 #1
0
ファイル: ingest.py プロジェクト: fergusL/pipe_tasks
class RegisterConfig(Config):
    """Configuration for the RegisterTask"""
    table = Field(dtype=str, default="raw", doc="Name of table")
    columns = DictField(
        keytype=str,
        itemtype=str,
        doc="List of columns for raw table, with their types",
        itemCheck=lambda x: x in ("text", "int", "double"),
        default={
            'object': 'text',
            'visit': 'int',
            'ccd': 'int',
            'filter': 'text',
            'date': 'text',
            'taiObs': 'text',
            'expTime': 'double',
        },
    )
    unique = ListField(
        dtype=str,
        doc="List of columns to be declared unique for the table",
        default=["visit", "ccd"])
    visit = ListField(dtype=str,
                      default=["visit", "object", "date", "filter"],
                      doc="List of columns for raw_visit table")
    ignore = Field(dtype=bool,
                   default=False,
                   doc="Ignore duplicates in the table?")
    permissions = Field(dtype=int,
                        default=0o664,
                        doc="Permissions mode for registry; 0o664 = rw-rw-r--")
コード例 #2
0
class CalibConfig(Config):
    """Configuration for constructing calibs"""
    clobber = Field(dtype=bool,
                    default=True,
                    doc="Clobber existing processed images?")
    isr = ConfigurableField(target=IsrTask, doc="ISR configuration")
    dateObs = Field(dtype=str,
                    default="dateObs",
                    doc="Key for observation date in exposure registry")
    dateCalib = Field(dtype=str,
                      default="calibDate",
                      doc="Key for calib date in calib registry")
    filter = Field(dtype=str,
                   default="filter",
                   doc="Key for filter name in exposure/calib registries")
    combination = ConfigurableField(target=CalibCombineTask,
                                    doc="Calib combination configuration")
    ccdKeys = ListField(dtype=str,
                        default=["ccd"],
                        doc="DataId keywords specifying a CCD")
    visitKeys = ListField(dtype=str,
                          default=["visit"],
                          doc="DataId keywords specifying a visit")
    calibKeys = ListField(dtype=str,
                          default=[],
                          doc="DataId keywords specifying a calibration")

    def setDefaults(self):
        self.isr.doWrite = False
コード例 #3
0
class CalibsRegisterConfig(RegisterConfig):
    """Configuration for the CalibsRegisterTask"""
    tables = ListField(dtype=str,
                       default=[
                           "bias", "dark", "flat", "fringe", "sky", "defects",
                           "qe_curve", "linearizer", "crosstalk"
                       ],
                       doc="Names of tables")
    calibDate = Field(dtype=str,
                      default="calibDate",
                      doc="Name of column for calibration date")
    validStart = Field(dtype=str,
                       default="validStart",
                       doc="Name of column for validity start")
    validEnd = Field(dtype=str,
                     default="validEnd",
                     doc="Name of column for validity stop")
    detector = ListField(dtype=str,
                         default=["filter", "ccd"],
                         doc="Columns that identify individual detectors")
    validityUntilSuperseded = ListField(
        dtype=str,
        default=["defects", "qe_curve", "linearizer", "crosstalk"],
        doc="Tables for which to set validity for a calib from when it is "
        "taken until it is superseded by the next; validity in other tables "
        "is calculated by applying the validity range.")
    incrementValidEnd = Field(
        dtype=bool,
        default=True,
        doc="Fix the off-by-one error by incrementing validEnd. See "
        "fixSubsetValidity for more details.",
    )
コード例 #4
0
ファイル: ingestCalibs.py プロジェクト: fergusL/pipe_tasks
class CalibsRegisterConfig(RegisterConfig):
    """Configuration for the CalibsRegisterTask"""
    tables = ListField(dtype=str,
                       default=[
                           "bias", "dark", "flat", "fringe", "sky", "defects",
                           "qe_curve"
                       ],
                       doc="Names of tables")
    calibDate = Field(dtype=str,
                      default="calibDate",
                      doc="Name of column for calibration date")
    validStart = Field(dtype=str,
                       default="validStart",
                       doc="Name of column for validity start")
    validEnd = Field(dtype=str,
                     default="validEnd",
                     doc="Name of column for validity stop")
    detector = ListField(dtype=str,
                         default=["filter", "ccd"],
                         doc="Columns that identify individual detectors")
    validityUntilSuperseded = ListField(
        dtype=str,
        default=["defects", "qe_curve"],
        doc="Tables for which to set validity for a calib from when it is "
        "taken until it is superseded by the next; validity in other tables "
        "is calculated by applying the validity range.")
コード例 #5
0
ファイル: detrends.py プロジェクト: PaulPrice/obs_subaru
class HscFlatCombineConfig(FlatCombineConfig):
    vignette = ConfigField(dtype=VignetteConfig, doc="Vignetting parameters in focal plane coordinates")
    badAmpCcdList = ListField(dtype=int, default=[], doc="List of CCD serial numbers for bad amplifiers")
    badAmpList = ListField(dtype=int, default=[], doc="List of amp serial numbers in CCD")
    maskPlane = Field(dtype=str, default="NO_DATA", doc="Mask plane to set")

    def validate(self):
        super(HscFlatCombineConfig, self).validate()
        if len(self.badAmpCcdList) != len(self.badAmpList):
            raise RuntimeError("Length of badAmpCcdList and badAmpList don't match")
コード例 #6
0
class AffineXYTransformConfig(Config):
    linear = ListField(
        doc="""2x2 linear matrix in the usual numpy order;
            to rotate a vector by theta use: cos(theta), sin(theta), -sin(theta), cos(theta)""",
        dtype=float,
        length=4,
        default=(1, 0, 0, 1),
    )
    translation = ListField(
        doc="x, y translation vector",
        dtype=float,
        length=2,
        default=(0, 0),
    )
コード例 #7
0
class DiscreteSkyMapConfig(CachingSkyMap.ConfigClass):
    """Configuration for the DiscreteSkyMap"""
    raList = ListField(dtype=float, default=[], doc="Right Ascensions of tracts (ICRS, degrees)")
    decList = ListField(dtype=float, default=[], doc="Declinations of tracts (ICRS, degrees)")
    radiusList = ListField(dtype=float, default=[], doc="Radii of tracts (degrees)")

    def validate(self):
        super(DiscreteSkyMapConfig, self).validate()
        if len(self.radiusList) != len(self.raList):
            raise ValueError("Number of radii (%d) and RAs (%d) do not match" %
                             (len(self.radiusList), len(self.raList)))
        if len(self.radiusList) != len(self.decList):
            raise ValueError("Number of radii (%d) and Decs (%d) do not match" %
                             (len(self.radiusList), len(self.decList)))
コード例 #8
0
class FringeConfig(Config):
    """Fringe subtraction options"""
    # TODO DM-28093: change the doc to specify that these are physical labels
    filters = ListField(dtype=str,
                        default=[],
                        doc="Only fringe-subtract these filters")
    # TODO: remove in DM-27177
    useFilterAliases = Field(
        dtype=bool,
        default=False,
        doc="Search filter aliases during check.",
        deprecated=("Removed with no replacement (FilterLabel has no aliases)."
                    "Will be removed after v22."))
    num = Field(dtype=int, default=30000, doc="Number of fringe measurements")
    small = Field(dtype=int,
                  default=3,
                  doc="Half-size of small (fringe) measurements (pixels)")
    large = Field(dtype=int,
                  default=30,
                  doc="Half-size of large (background) measurements (pixels)")
    iterations = Field(dtype=int,
                       default=20,
                       doc="Number of fitting iterations")
    clip = Field(dtype=float, default=3.0, doc="Sigma clip threshold")
    stats = ConfigField(dtype=FringeStatisticsConfig,
                        doc="Statistics for measuring fringes")
    pedestal = Field(dtype=bool, default=False, doc="Remove fringe pedestal?")
コード例 #9
0
ファイル: background.py プロジェクト: surhudm/pipe_drivers
class FocalPlaneBackgroundConfig(Config):
    """Configuration for FocalPlaneBackground

    Note that `xSize` and `ySize` are floating-point values, as
    the focal plane frame is usually defined in units of microns
    or millimetres rather than pixels. As such, their values will
    need to be revised according to each particular camera. For
    this reason, no defaults are set for those.
    """
    xSize = Field(dtype=float, doc="Bin size in x")
    ySize = Field(dtype=float, doc="Bin size in y")
    minFrac = Field(dtype=float, default=0.1, doc="Minimum fraction of bin size for good measurement")
    mask = ListField(dtype=str, doc="Mask planes to treat as bad",
                     default=["BAD", "SAT", "INTRP", "DETECTED", "DETECTED_NEGATIVE", "EDGE", "NO_DATA"])
    interpolation = ChoiceField(
        doc="how to interpolate the background values. This maps to an enum; see afw::math::Background",
        dtype=str, default="AKIMA_SPLINE", optional=True,
        allowed={
            "CONSTANT": "Use a single constant value",
            "LINEAR": "Use linear interpolation",
            "NATURAL_SPLINE": "cubic spline with zero second derivative at endpoints",
            "AKIMA_SPLINE": "higher-level nonlinear spline that is more robust to outliers",
            "NONE": "No background estimation is to be attempted",
        },
    )
    doSmooth = Field(dtype=bool, default=False, doc="Do smoothing?")
    smoothScale = Field(dtype=float, default=2.0, doc="Smoothing scale, as a multiple of the bin size")
    binning = Field(dtype=int, default=64, doc="Binning to use for CCD background model (pixels)")
コード例 #10
0
class SingleFrameDriverConfig(Config):
    processCcd = ConfigurableField(
        target=ProcessCcdTask, doc="CCD processing task")
    ignoreCcdList = ListField(dtype=int, default=[],
                              doc="List of CCDs to ignore when processing")
    ccdKey = Field(dtype=str, default="ccd",
                   doc="DataId key corresponding to a single sensor")
コード例 #11
0
ファイル: skyObjects.py プロジェクト: lsst/meas_algorithms
class SkyObjectsConfig(Config):
    """Configuration for generating sky objects"""
    avoidMask = ListField(
        dtype=str,
        default=["DETECTED", "DETECTED_NEGATIVE", "BAD", "NO_DATA"],
        doc="Avoid pixels masked with these mask planes")
    growMask = Field(
        dtype=int,
        default=0,
        doc="Number of pixels to grow the masked pixels when adding sky objects"
    )
    sourceRadius = Field(dtype=float,
                         default=8,
                         doc="Radius, in pixels, of sky objects")
    nSources = Field(dtype=int,
                     default=100,
                     doc="Try to add this many sky objects")
    nTrialSources = Field(dtype=int,
                          default=None,
                          optional=True,
                          doc="Maximum number of trial sky object positions\n"
                          "(default: nSkySources*nTrialSkySourcesMultiplier)")
    nTrialSourcesMultiplier = Field(
        dtype=int,
        default=5,
        doc="Set nTrialSkySources to\n"
        "    nSkySources*nTrialSkySourcesMultiplier\n"
        "if nTrialSkySources is None")
コード例 #12
0
class MergeDetectionsConfig(PipelineTaskConfig, pipelineConnections=MergeDetectionsConnections):
    """!
    @anchor MergeDetectionsConfig_

    @brief Configuration parameters for the MergeDetectionsTask.
    """
    minNewPeak = Field(dtype=float, default=1,
                       doc="Minimum distance from closest peak to create a new one (in arcsec).")

    maxSamePeak = Field(dtype=float, default=0.3,
                        doc="When adding new catalogs to the merge, all peaks less than this distance "
                        " (in arcsec) to an existing peak will be flagged as detected in that catalog.")
    cullPeaks = ConfigField(dtype=CullPeaksConfig, doc="Configuration for how to cull peaks.")

    skyFilterName = Field(dtype=str, default="sky",
                          doc="Name of `filter' used to label sky objects (e.g. flag merge_peak_sky is set)\n"
                          "(N.b. should be in MergeMeasurementsConfig.pseudoFilterList)")
    skyObjects = ConfigurableField(target=SkyObjectsTask, doc="Generate sky objects")
    priorityList = ListField(dtype=str, default=[],
                             doc="Priority-ordered list of bands for the merge.")
    coaddName = Field(dtype=str, default="deep", doc="Name of coadd")

    def setDefaults(self):
        Config.setDefaults(self)
        self.skyObjects.avoidMask = ["DETECTED"]  # Nothing else is available in our custom mask

    def validate(self):
        super().validate()
        if len(self.priorityList) == 0:
            raise RuntimeError("No priority list provided")
コード例 #13
0
class FringeStatisticsConfig(Config):
    """Options for measuring fringes on an exposure"""
    badMaskPlanes = ListField(dtype=str, default=["SAT"], doc="Ignore pixels with these masks")
    stat = Field(dtype=int, default=int(afwMath.MEDIAN), doc="Statistic to use")
    clip = Field(dtype=float, default=3.0, doc="Sigma clip threshold")
    iterations = Field(dtype=int, default=3, doc="Number of fitting iterations")
    rngSeedOffset = Field(dtype=int, default=0,
                          doc="Offset to the random number generator seed (full seed includes exposure ID)")
コード例 #14
0
class SetPrimaryFlagsConfig(Config):
    nChildKeyName = Field(dtype=str,
                          default="deprecated",
                          doc="Deprecated. This parameter is not used.")
    pseudoFilterList = ListField(
        dtype=str,
        default=['sky'],
        doc="Names of filters which should never be primary")
コード例 #15
0
ファイル: focus.py プロジェクト: PaulPrice/hscPipeline
class FocusConfig(Config):
    # Defaults are appropriate for HSC, but also shouldn't get in the way for Suprime-Cam
    # (because Suprime-Cam CCDs aren't indexed over 10).
    corrCoeff = ListField(
        dtype=float,
        default=[8.238421, 1.607829, 1.563773, 0.029580],
        doc=
        "Correction polynomial coefficients: reconstructed_focus = corr(true_focus)"
    )
    aboveList = ListField(dtype=int,
                          default=[107, 104, 111, 108],
                          doc="Indices of CCDs above focus")
    belowList = ListField(dtype=int,
                          default=[105, 106, 109, 110],
                          doc="Indices of CCDs below focus")
    offset = Field(dtype=float, default=0.12, doc="Focus offset for CCDs")
    radialBinEdges = ListField(
        dtype=float,
        default=[16600, 17380.580580580579, 17728.128128128126, 18000],
        doc="Radii edges for bins")
    radialBinCenters = ListField(
        dtype=float,
        default=[17112.514461756149, 17563.380665628181, 17868.148132145379],
        doc="Radii centers for bins")
    doPlot = Field(dtype=bool, default=False, doc="Plot focus calculation?")
    shape = Field(dtype=str,
                  default="ext_simpleShape_SimpleShape",
                  doc="Measurement to use for shape")
    pixelScale = Field(dtype=float,
                       default=0.015,
                       doc="Conversion factor for pixel scale --> mm")

    def isFocusCcd(self, ccdId):
        return ccdId in self.aboveList or ccdId in self.belowList

    def validate(self):
        super(FocusConfig, self).validate()
        numRadialBins = len(self.radialBinCenters)
        if len(self.radialBinEdges) != numRadialBins + 1:
            raise RuntimeError(
                "Expected %d radialBinEdges for the %d radialBinCenters" %
                (numRadialBins + 1, numRadialBins))
        if len(self.aboveList) != len(self.belowList):
            raise RuntimeError(
                "List of CCDs above and below focus not of equal length: %d %d"
                % (len(self.aboveList), len(self.belowList)))
コード例 #16
0
class ForcedPhotCcdDiaDriverConfig(Config):
    ignoreCcdList = ListField(dtype=int,
                              default=[],
                              doc="List of CCDs to ignore when processing")
    ccdKey = Field(dtype=str,
                   default="detector",
                   doc="DataId key corresponding to a single sensor")
    forced = ConfigurableField(target=ForcedPhotCcdDiaTask,
                               doc="CCD processing task")
コード例 #17
0
class MeasurementDebuggerConfig(Config):
    sourceId = ListField(dtype=int,
                         default=[],
                         doc="List of source identifiers to measure")
    outputName = Field(dtype=str,
                       default="catalog.fits",
                       doc="Output name for source catalog")
    measurement = ConfigurableField(target=SourceMeasurementTask,
                                    doc="Measurements")
コード例 #18
0
class SetPrimaryFlagsConfig(Config):
    nChildKeyName = Field(
        dtype=str,
        default="deblend_nChild",
        doc="Name of field in schema with number of deblended children")
    pseudoFilterList = ListField(
        dtype=str,
        default=['sky'],
        doc="Names of filters which should never be primary")
コード例 #19
0
ファイル: ingest.py プロジェクト: ih64/pipe_tasks
class ParseConfig(Config):
    """Configuration for ParseTask"""
    translation = DictField(keytype=str, itemtype=str, default={},
                            doc="Translation table for property --> header")
    translators = DictField(keytype=str, itemtype=str, default={},
                            doc="Properties and name of translator method")
    defaults = DictField(keytype=str, itemtype=str, default={},
                         doc="Default values if header is not present")
    hdu = Field(dtype=int, default=0, doc="HDU to read for metadata")
    extnames = ListField(dtype=str, default=[], doc="Extension names to search for")
コード例 #20
0
ファイル: background.py プロジェクト: surhudm/pipe_drivers
class SkyStatsConfig(Config):
    """Parameters controlling the measurement of sky statistics"""
    statistic = ChoiceField(dtype=str, default="MEANCLIP", doc="type of statistic to use for grid points",
                            allowed={"MEANCLIP": "clipped mean",
                                     "MEAN": "unclipped mean",
                                     "MEDIAN": "median"})
    clip = Field(doc="Clipping threshold for background", dtype=float, default=3.0)
    nIter = Field(doc="Clipping iterations for background", dtype=int, default=3)
    mask = ListField(doc="Mask planes to reject", dtype=str,
                     default=["SAT", "DETECTED", "DETECTED_NEGATIVE", "BAD", "NO_DATA"])
コード例 #21
0
class FringeConfig(Config):
    """Fringe subtraction options"""
    filters = ListField(dtype=str, default=[], doc="Only fringe-subtract these filters")
    num = Field(dtype=int, default=30000, doc="Number of fringe measurements")
    small = Field(dtype=int, default=3, doc="Half-size of small (fringe) measurements (pixels)")
    large = Field(dtype=int, default=30, doc="Half-size of large (background) measurements (pixels)")
    iterations = Field(dtype=int, default=20, doc="Number of fitting iterations")
    clip = Field(dtype=float, default=3.0, doc="Sigma clip threshold")
    stats = ConfigField(dtype=FringeStatisticsConfig, doc="Statistics for measuring fringes")
    pedestal = Field(dtype=bool, default=False, doc="Remove fringe pedestal?")
コード例 #22
0
class StrayLightConfig(Config):
    doRotatorAngleCorrection = Field(
        dtype=bool,
        doc="",
        default=False,
    )
    filters = ListField(
        dtype=str,
        doc="Filters that need straylight correction.",
        default=[],
    )
コード例 #23
0
ファイル: straylight.py プロジェクト: bsipocz/ip_isr
class StrayLightConfig(Config):
    doRotatorAngleCorrection = Field(
        dtype=bool,
        doc="",
        default=False,
    )
    # TODO DM-28093: change the doc to specify that these are physical labels
    filters = ListField(
        dtype=str,
        doc="Filters that need straylight correction.",
        default=[],
    )
コード例 #24
0
class AffineTransformConfig(Config):
    """A Config representing an affine ``Transform``.

    See Also
    --------
    lsst.afw.geom.makeTransform
    """
    linear = ListField(
        doc="2x2 linear matrix in the usual numpy order; "
        "to rotate a vector by theta use: cos(theta), sin(theta), "
        "-sin(theta), cos(theta)",
        dtype=float,
        length=4,
        default=(1, 0, 0, 1),
    )
    translation = ListField(
        doc="x, y translation vector",
        dtype=float,
        length=2,
        default=(0, 0),
    )
コード例 #25
0
class MeasureCrosstalkConfig(Config):
    """Configuration for MeasureCrosstalkTask."""
    isr = ConfigurableField(
        target=IsrTask,
        doc="Instrument signature removal task to use to process data.")
    threshold = Field(
        dtype=float,
        default=30000,
        doc="Minimum level of source pixels for which to measure crosstalk.")
    doRerunIsr = Field(
        dtype=bool,
        default=True,
        doc="Rerun the ISR, even if postISRCCD files are available?")
    badMask = ListField(
        dtype=str,
        default=["SAT", "BAD", "INTRP"],
        doc="Mask planes to ignore when identifying source pixels.")
    rejIter = Field(
        dtype=int,
        default=3,
        doc="Number of rejection iterations for final coefficient calculation."
    )
    rejSigma = Field(
        dtype=float,
        default=2.0,
        doc="Rejection threshold (sigma) for final coefficient calculation.")
    isTrimmed = Field(
        dtype=bool,
        default=True,
        doc="Have the amplifiers been trimmed before measuring CT?")

    def setDefaults(self):
        Config.setDefaults(self)
        # Set ISR processing to run up until we would be applying the CT
        # correction.  Applying subsequent stages may corrupt the signal.
        self.isr.doWrite = False
        self.isr.doOverscan = True
        self.isr.doAssembleCcd = True
        self.isr.doBias = True
        self.isr.doVariance = False  # This isn't used in the calculation below.
        self.isr.doLinearize = True  # This is the last ISR step we need.
        self.isr.doCrosstalk = False
        self.isr.doBrighterFatter = False
        self.isr.doDark = False
        self.isr.doStrayLight = False
        self.isr.doFlat = False
        self.isr.doFringe = False
        self.isr.doApplyGains = False
        self.isr.doDefect = True  # Masking helps remove spurious pixels.
        self.isr.doSaturationInterpolation = False
        self.isr.growSaturationFootprintSize = 0  # We want the saturation spillover: it's good signal.
コード例 #26
0
ファイル: dataSelectors.py プロジェクト: lsst/analysis_drp
class MainFlagSelector(FlagSelector):
    """The main set of flags to use to select valid sources for QA"""

    bands = ListField(doc="The bands to apply the flags in",
                      dtype=str,
                      default=["g", "r", "i", "z", "y"])

    def setDefaults(self):
        super().setDefaults()
        flagCols = ["PixelFlags", "Blendedness_flag"]
        filterColumns = [
            band + flag for flag in flagCols for band in self.bands
        ]
        self.selectWhenFalse = filterColumns
コード例 #27
0
class ScaleVarianceConfig(Config):
    background = ConfigurableField(target=SubtractBackgroundTask, doc="Background subtraction")
    maskPlanes = ListField(
        dtype=str,
        default=["DETECTED", "DETECTED_NEGATIVE", "BAD", "SAT", "NO_DATA", "INTRP"],
        doc="Mask planes for pixels to ignore when scaling variance",
    )
    limit = Field(dtype=float, default=10.0, doc="Maximum variance scaling value to permit")

    def setDefaults(self):
        self.background.binSize = 32
        self.background.useApprox = False
        self.background.undersampleStyle = "REDUCE_INTERP_ORDER"
        self.background.ignoredPixelMask = ["DETECTED", "DETECTED_NEGATIVE", "BAD", "SAT", "NO_DATA", "INTRP"]
コード例 #28
0
class RadialXYTransformConfig(Config):
    coeffs = ListField(
        doc = "Coefficients for the radial polynomial; coeff[0] must be 0",
        dtype = float,
        minLength = 1,
        optional = False,
    )
    def validate(self):
        if len(self.coeffs) == 0:
            return
        if len(self.coeffs) == 1 or self.coeffs[0] != 0 or self.coeffs[1] == 0:
            raise RuntimeError(
                "invalid RadialXYTransform coeffs %s: " % (self.coeffs,) \
                + " need len(coeffs)=0 or len(coeffs)>1, coeffs[0]==0, and coeffs[1]!=0")
コード例 #29
0
class CalibStatsConfig(Config):
    """Parameters controlling the measurement of background statistics"""
    stat = Field(
        doc="Statistic to use to estimate background (from lsst.afw.math)",
        dtype=int,
        default=int(afwMath.MEANCLIP))
    clip = Field(doc="Clipping threshold for background",
                 dtype=float,
                 default=3.0)
    nIter = Field(doc="Clipping iterations for background",
                  dtype=int,
                  default=3)
    mask = ListField(doc="Mask planes to reject",
                     dtype=str,
                     default=["DETECTED", "BAD"])
コード例 #30
0
class DonutDriverConfig(Config):
    fitDonut = ConfigurableField(
        target = FitDonutTask,
        doc = "Donut fitting task"
    )
    ignoreCcdList = ListField(
        dtype = int,
        default = [],
        doc = "List of CCDs to ignore when processing"
    )
    ccdKey = Field(
        dtype = str,
        default = "ccd",
        doc = "DataId key corresponding to a single sensor"
    )