def register(cls, name, target, ConfigClass=None): """Register an AlgorithmControl subclass. This is a class method, so you can either use it on the registry instance or its class (this works because the registry is a singleton, so the class knows to use cls.all as the instance). If it does not have a ConfigClass attribute pointing to the corresponding Config class, a config class will be created using pex.config.makeConfigClass. A new config class will also be created if the ConfigClass attribute was inherited from a base class, @param[in] name Name the algorithm will be registered with; also the name of the source fields it will fill. @param[in] target An AlgorithmControl subclass. @param[in] ConfigClass A Config class to be paired with the control class. """ self = cls.all if not issubclass(target, algorithmsLib.AlgorithmControl): raise TypeError("Registry targets must be subclasses of AlgorithmControl") if ConfigClass is None: if hasattr(target, "ConfigClass") and (not hasattr(target.__base__, "ConfigClass") or target.ConfigClass != target.__base__.ConfigClass): ConfigClass = target.ConfigClass # class attributes else: if not hasattr(target.__base__, "ConfigClass"): raise ValueError("Cannot create a config class for %s unless its base class " "has a ConfigClass attribute." % target) ConfigClass = pexConf.makeConfigClass(target, base=target.__base__.ConfigClass, module=2) target = self.Configurable(name, ConfigClass) pexConf.Registry.register(self, name, target)
def register(cls, name, target, ConfigClass=None): """Register an AlgorithmControl subclass. This is a class method, so you can either use it on the registry instance or its class (this works because the registry is a singleton, so the class knows to use cls.all as the instance). If it does not have a ConfigClass attribute pointing to the corresponding Config class, a config class will be created using pex.config.makeConfigClass. A new config class will also be created if the ConfigClass attribute was inherited from a base class, @param[in] name Name the algorithm will be registered with; also the name of the source fields it will fill. @param[in] target An AlgorithmControl subclass. @param[in] ConfigClass A Config class to be paired with the control class. """ self = cls.all if not issubclass(target, algorithmsLib.AlgorithmControl): raise TypeError("Registry targets must be subclasses of AlgorithmControl") if ConfigClass is None: if hasattr(target, "ConfigClass") and (not hasattr(target.__base__, "ConfigClass") or target.ConfigClass != target.__base__.ConfigClass): ConfigClass = target.ConfigClass # class attributes else: if not hasattr(target.__base__, "ConfigClass"): raise ValueError("Cannot create a config class for %s unless its base class " "has a ConfigClass attribute." % target) ConfigClass = pexConf.makeConfigClass(target, base=target.__base__.ConfigClass, module=2) target = self.Configurable(name, ConfigClass) pexConf.Registry.register(self, name, target)
from lsst.afw.geom.skyWcs import makeWcsPairTransform __all__ = ("SingleFrameConvolvedFluxPlugin", "SingleFrameConvolvedFluxConfig", "ForcedConvolvedFluxPlugin", "ForcedConvolvedFluxConfig",) SIGMA_TO_FWHM = 2.0*math.sqrt(2.0*(math.log(2.0))) # Multiply sigma by this to get FWHM PLUGIN_NAME = "ext_convolved_ConvolvedFlux" # Usual name for plugin class DeconvolutionError(RuntimeError): """Convolving to the target seeing would require deconvolution""" pass ApertureFluxConfig = makeConfigClass(lsst.meas.base.ApertureFluxControl) class ConvolvedFluxData(Struct): """A `lsst.pipe.base.Struct` for convolved fluxes Attributes ---------- deconvKey : `lsst.afw.table.Key_Flag` Key to set flag indicating no measurement was made due to the need to deconvolve aperture : `lsst.meas.base.CircularApertureFluxAlgorithm` Measurement algorithm to perform aperture flux measurements kronKeys : `lsst.pipe.base.Struct` Container for Kron results or `None` if no Kron radius is available; when set, includes `result` (`lsst.meas.base.FluxResultKey`: keys to set results from Kron flux measurement) and `flag` (`lsst.afw.table.Key_Flag`: key to set failure flag
import os from types import SimpleNamespace import pickle import numpy as np from lsst.pex.config import Config, Field, ConfigField, makeConfigClass from lsst.pipe.base import Task from pfs.drp.stella import DispersionCorrectionControl __all__ = ["IdentifyConfig", "IdentifyLinesConfig", "IdentifyLinesTask"] IdentifyConfig = makeConfigClass(DispersionCorrectionControl, "IdentifyConfig") class IdentifyLinesConfig(Config): """Configuration for IdentifyLinesTask""" doInteractive = Field(dtype=bool, default=False, doc="Identify lines interactively?") identify = ConfigField(dtype=IdentifyConfig, doc="Automated line identification") class IdentifyLinesTask(Task): ConfigClass = IdentifyLinesConfig _DefaultName = "identifyLines" def run(self, spectra, detectorMap, lines): """Identify arc lines on the extracted spectra Parameters ---------- spectra : `pfs.drp.stella.SpectrumSet` Set of extracted spectra.
# # You should have received a copy of the LSST License Statement and # the GNU General Public License along with this program. If not, # see <http://www.lsstcorp.org/LegalNotices/>. # from __future__ import absolute_import, division, print_function # The Plugin classes here are accessed via registries, not direct imports. __all__ = ("CModelStageConfig", "CModelConfig") from .cmodel import CModelStageControl, CModelControl, CModelAlgorithm from lsst.pex.config import makeConfigClass import lsst.meas.base CModelStageConfig = makeConfigClass(CModelStageControl) CModelConfig = makeConfigClass(CModelControl) apCorrList = ("modelfit_CModel", "modelfit_CModel_initial", "modelfit_CModel_exp", "modelfit_CModel_dev") class CModelSingleFrameConfig(lsst.meas.base.SingleFramePluginConfig, CModelConfig): def setDefaults(self): lsst.meas.base.SingleFramePluginConfig.setDefaults(self) CModelConfig.setDefaults(self) @lsst.meas.base.register("modelfit_CModel", apCorrList=apCorrList) class CModelSingleFramePlugin(lsst.meas.base.SingleFramePlugin):
# # LSST Data Management System # Copyright 2017 LSST/AURA. # # This product includes software developed by the # LSST Project (http://www.lsst.org/). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the LSST License Statement and # the GNU General Public License along with this program. If not, # see <http://www.lsstcorp.org/LegalNotices/>. # __all__ = ("PixelFitRegionConfig",) from lsst.pex.config import makeConfigClass from .pixelFitRegion import PixelFitRegionControl PixelFitRegionConfig = makeConfigClass(PixelFitRegionControl)
__all__ = ("fitMixture", "SemiEmpiricalPriorConfig", "SoftenedLinearPriorControl") import numpy as np from lsst.pex.config import makeConfigClass from lsst.utils import continueClass from ..mixture import Mixture from .priors import (SemiEmpiricalPriorControl, SemiEmpiricalPrior, SoftenedLinearPriorControl, SoftenedLinearPrior, MixturePrior) SemiEmpiricalPriorConfig = makeConfigClass(SemiEmpiricalPriorControl) SoftenedLinearPriorConfig = makeConfigClass(SoftenedLinearPriorControl) @continueClass # noqa class SemiEmpiricalPrior: ConfigClass = SemiEmpiricalPriorConfig @continueClass # noqa class SoftenedLinearPrior: ConfigClass = SoftenedLinearPriorConfig
__all__ = ("fitMixture", "SemiEmpiricalPriorConfig", "SoftenedLinearPriorControl") from builtins import range import numpy as np from lsst.pex.config import makeConfigClass from lsst.utils import continueClass from ..mixture import Mixture from .priors import (SemiEmpiricalPriorControl, SemiEmpiricalPrior, SoftenedLinearPriorControl, SoftenedLinearPrior, MixturePrior) SemiEmpiricalPriorConfig = makeConfigClass(SemiEmpiricalPriorControl) SoftenedLinearPriorConfig = makeConfigClass(SoftenedLinearPriorControl) @continueClass class SemiEmpiricalPrior: ConfigClass = SemiEmpiricalPriorConfig @continueClass class SoftenedLinearPrior: ConfigClass = SoftenedLinearPriorConfig
import lsst.pex.config as pexConfig from lsst.pipe.base import Task import pfs.drp.stella as drpStella __all__ = ["FiberTraceFunctionConfig", "FiberTraceFindingConfig", "FiberTraceProfileFittingConfig", "FindAndTraceAperturesConfig", "FindAndTraceAperturesTask", ] FiberTraceFunctionConfig = pexConfig.makeConfigClass(drpStella.FiberTraceFunctionControl) FiberTraceFindingConfig = pexConfig.makeConfigClass(drpStella.FiberTraceFindingControl) FiberTraceProfileFittingConfig = pexConfig.makeConfigClass(drpStella.FiberTraceProfileFittingControl) class FindAndTraceAperturesConfig(pexConfig.Config): finding = pexConfig.ConfigField(dtype=FiberTraceFindingConfig, doc="Trace finding") function = pexConfig.ConfigField(dtype=FiberTraceFunctionConfig, doc="Interpolation function") fitting = pexConfig.ConfigField(dtype=FiberTraceProfileFittingConfig, doc="Profile fitting") class FindAndTraceAperturesTask(Task): ConfigClass = FindAndTraceAperturesConfig _DefaultName = "findAndTraceApertures" def run(self, maskedImage, detectorMap): """Find and trace fibers on the image Parameters ---------- maskedImage : `lsst.afw.image.MaskedImage` Image on which to find and trace fibers.
# # You should have received a copy of the LSST License Statement and # the GNU General Public License along with this program. If not, # see <http://www.lsstcorp.org/LegalNotices/>. # # The Plugin classes here are accessed via registries, not direct imports. __all__ = ("CModelStageConfig", "CModelConfig") from .cmodel import CModelStageControl, CModelControl, CModelAlgorithm from lsst.pex.config import makeConfigClass import lsst.meas.base CModelStageConfig = makeConfigClass(CModelStageControl) CModelConfig = makeConfigClass(CModelControl) apCorrList = ("modelfit_CModel", "modelfit_CModel_initial", "modelfit_CModel_exp", "modelfit_CModel_dev") class CModelSingleFrameConfig(lsst.meas.base.SingleFramePluginConfig, CModelConfig): def setDefaults(self): lsst.meas.base.SingleFramePluginConfig.setDefaults(self) CModelConfig.setDefaults(self) @lsst.meas.base.register("modelfit_CModel", apCorrList=apCorrList) class CModelSingleFramePlugin(lsst.meas.base.SingleFramePlugin): """Single-frame measurement interface for CModelAlgorithm.
# # LSST Data Management System # # Copyright 2008-2017 AURA/LSST. # # This product includes software developed by the # LSST Project (http://www.lsst.org/). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the LSST License Statement and # the GNU General Public License along with this program. If not, # see <https://www.lsstcorp.org/LegalNotices/>. # __all__ = ["CoaddPsfConfig"] from .coaddPsf import CoaddPsfControl from lsst.pex.config import makeConfigClass CoaddPsfConfig = makeConfigClass(CoaddPsfControl, "CoaddPsfConfig")
# # LSST Data Management System # Copyright 2017 LSST/AURA. # # This product includes software developed by the # LSST Project (http://www.lsst.org/). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the LSST License Statement and # the GNU General Public License along with this program. If not, # see <http://www.lsstcorp.org/LegalNotices/>. # __all__ = ("PixelFitRegionConfig", ) from lsst.pex.config import makeConfigClass from .pixelFitRegion import PixelFitRegionControl PixelFitRegionConfig = makeConfigClass(PixelFitRegionControl)