LSST Applications  21.0.0-172-gfb10e10a+18fedfabac,22.0.0+297cba6710,22.0.0+80564b0ff1,22.0.0+8d77f4f51a,22.0.0+a28f4c53b1,22.0.0+dcf3732eb2,22.0.1-1-g7d6de66+2a20fdde0d,22.0.1-1-g8e32f31+297cba6710,22.0.1-1-geca5380+7fa3b7d9b6,22.0.1-12-g44dc1dc+2a20fdde0d,22.0.1-15-g6a90155+515f58c32b,22.0.1-16-g9282f48+790f5f2caa,22.0.1-2-g92698f7+dcf3732eb2,22.0.1-2-ga9b0f51+7fa3b7d9b6,22.0.1-2-gd1925c9+bf4f0e694f,22.0.1-24-g1ad7a390+a9625a72a8,22.0.1-25-g5bf6245+3ad8ecd50b,22.0.1-25-gb120d7b+8b5510f75f,22.0.1-27-g97737f7+2a20fdde0d,22.0.1-32-gf62ce7b1+aa4237961e,22.0.1-4-g0b3f228+2a20fdde0d,22.0.1-4-g243d05b+871c1b8305,22.0.1-4-g3a563be+32dcf1063f,22.0.1-4-g44f2e3d+9e4ab0f4fa,22.0.1-42-gca6935d93+ba5e5ca3eb,22.0.1-5-g15c806e+85460ae5f3,22.0.1-5-g58711c4+611d128589,22.0.1-5-g75bb458+99c117b92f,22.0.1-6-g1c63a23+7fa3b7d9b6,22.0.1-6-g50866e6+84ff5a128b,22.0.1-6-g8d3140d+720564cf76,22.0.1-6-gd805d02+cc5644f571,22.0.1-8-ge5750ce+85460ae5f3,master-g6e05de7fdc+babf819c66,master-g99da0e417a+8d77f4f51a,w.2021.48
LSST Data Management Base Package
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
lsst.meas.base.tests.TransformTestCase Class Reference
Inheritance diagram for lsst.meas.base.tests.TransformTestCase:
lsst.meas.base.tests.CentroidTransformTestCase lsst.meas.base.tests.FluxTransformTestCase

Public Member Functions

def setUp (self)
 
def tearDown (self)
 
def testTransform (self, baseNames=None)
 
def testRegistration (self)
 

Public Attributes

 calexp
 

Static Public Attributes

string name = "MeasurementTransformTest"
 
 controlClass = None
 
 algorithmClass = None
 
 transformClass = None
 
tuple flagNames = ("flag",)
 
tuple singleFramePlugins = ()
 
tuple forcedPlugins = ()
 

Detailed Description

Base class for testing measurement transformations.

Notes
-----
We test both that the transform itself operates successfully (fluxes are
converted to magnitudes, flags are propagated properly) and that the
transform is registered as the default for the appropriate measurement
algorithms.

In the simple case of one-measurement-per-transformation, the developer
need not directly write any tests themselves: simply customizing the class
variables is all that is required. More complex measurements (e.g.
multiple aperture fluxes) require extra effort.

Definition at line 732 of file tests.py.

Member Function Documentation

◆ setUp()

def lsst.meas.base.tests.TransformTestCase.setUp (   self)

Definition at line 772 of file tests.py.

772  def setUp(self):
773  bbox = lsst.geom.Box2I(lsst.geom.Point2I(0, 0), lsst.geom.Point2I(200, 200))
774  self.calexp = TestDataset.makeEmptyExposure(bbox)
775  self._setupTransform()
776 
An integer coordinate rectangle.
Definition: Box.h:55

◆ tearDown()

def lsst.meas.base.tests.TransformTestCase.tearDown (   self)

Definition at line 777 of file tests.py.

777  def tearDown(self):
778  del self.calexp
779  del self.inputCat
780  del self.mapper
781  del self.transform
782  del self.outputCat
783 

◆ testRegistration()

def lsst.meas.base.tests.TransformTestCase.testRegistration (   self)
Test that the transformation is appropriately registered.

Definition at line 848 of file tests.py.

848  def testRegistration(self):
849  """Test that the transformation is appropriately registered.
850  """
851  for pluginName in self.singleFramePlugins:
852  self._checkRegisteredTransform(lsst.meas.base.SingleFramePlugin.registry, pluginName)
853  for pluginName in self.forcedPlugins:
854  self._checkRegisteredTransform(lsst.meas.base.ForcedPlugin.registry, pluginName)
855 
856 

◆ testTransform()

def lsst.meas.base.tests.TransformTestCase.testTransform (   self,
  baseNames = None 
)
Test the transformation on a catalog containing random data.

Parameters
----------
baseNames : iterable of `str`
    Iterable of the initial parts of measurement field names.

Notes
-----
We check that:

- An appropriate exception is raised on an attempt to transform
  between catalogs with different numbers of rows;
- Otherwise, all appropriate conversions are properly appled and that
  flags have been propagated.

The ``baseNames`` argument requires some explanation. This should be
an iterable of the leading parts of the field names for each
measurement; that is, everything that appears before ``_instFlux``,
``_flag``, etc. In the simple case of a single measurement per plugin,
this is simply equal to ``self.name`` (thus measurements are stored as
``self.name + "_instFlux"``, etc). More generally, the developer may
specify whatever iterable they require. For example, to handle
multiple apertures, we could have ``(self.name + "_0", self.name +
"_1", ...)``.

Definition at line 810 of file tests.py.

810  def testTransform(self, baseNames=None):
811  """Test the transformation on a catalog containing random data.
812 
813  Parameters
814  ----------
815  baseNames : iterable of `str`
816  Iterable of the initial parts of measurement field names.
817 
818  Notes
819  -----
820  We check that:
821 
822  - An appropriate exception is raised on an attempt to transform
823  between catalogs with different numbers of rows;
824  - Otherwise, all appropriate conversions are properly appled and that
825  flags have been propagated.
826 
827  The ``baseNames`` argument requires some explanation. This should be
828  an iterable of the leading parts of the field names for each
829  measurement; that is, everything that appears before ``_instFlux``,
830  ``_flag``, etc. In the simple case of a single measurement per plugin,
831  this is simply equal to ``self.name`` (thus measurements are stored as
832  ``self.name + "_instFlux"``, etc). More generally, the developer may
833  specify whatever iterable they require. For example, to handle
834  multiple apertures, we could have ``(self.name + "_0", self.name +
835  "_1", ...)``.
836  """
837  baseNames = baseNames or [self.name]
838  self._populateCatalog(baseNames)
839  self.assertRaises(lsst.pex.exceptions.LengthError, self._runTransform, False)
840  self._runTransform()
841  self._checkOutput(baseNames)
842 
Reports attempts to exceed implementation-defined length limits for some classes.
Definition: Runtime.h:76

Member Data Documentation

◆ algorithmClass

lsst.meas.base.tests.TransformTestCase.algorithmClass = None
static

Definition at line 759 of file tests.py.

◆ calexp

lsst.meas.base.tests.TransformTestCase.calexp

Definition at line 774 of file tests.py.

◆ controlClass

lsst.meas.base.tests.TransformTestCase.controlClass = None
static

Definition at line 758 of file tests.py.

◆ flagNames

tuple lsst.meas.base.tests.TransformTestCase.flagNames = ("flag",)
static

Definition at line 762 of file tests.py.

◆ forcedPlugins

tuple lsst.meas.base.tests.TransformTestCase.forcedPlugins = ()
static

Definition at line 770 of file tests.py.

◆ name

string lsst.meas.base.tests.TransformTestCase.name = "MeasurementTransformTest"
static

Definition at line 747 of file tests.py.

◆ singleFramePlugins

tuple lsst.meas.base.tests.TransformTestCase.singleFramePlugins = ()
static

Definition at line 769 of file tests.py.

◆ transformClass

lsst.meas.base.tests.TransformTestCase.transformClass = None
static

Definition at line 760 of file tests.py.


The documentation for this class was generated from the following file: