LSST Applications g0265f82a02+d6b5cd48b5,g02d81e74bb+7bcba2e4e8,g2079a07aa2+14824f138e,g212a7c68fe+4b38ad7149,g2305ad1205+906def1e41,g295015adf3+564da5d084,g2bbee38e9b+d6b5cd48b5,g337abbeb29+d6b5cd48b5,g3ddfee87b4+cff7e20090,g487adcacf7+50712f9db4,g50ff169b8f+5929b3527e,g52b1c1532d+a6fc98d2e7,g591dd9f2cf+d19d1a10d7,g5a732f18d5+66d966b544,g64a986408d+7bcba2e4e8,g858d7b2824+7bcba2e4e8,g8a8a8dda67+a6fc98d2e7,g99cad8db69+808e2eeadf,g9ddcbc5298+d4bad12328,ga1e77700b3+246acaaf9c,ga8c6da7877+9e3c062e8e,gb0e22166c9+3863383f4c,gb6a65358fc+d6b5cd48b5,gb983acf43b+60bb7664b7,gba4ed39666+9664299f35,gbb8dafda3b+6623599aa9,gc07e1c2157+f6e5778202,gc120e1dc64+6e28925a4e,gc28159a63d+d6b5cd48b5,gcf0d15dbbd+cff7e20090,gdaeeff99f8+a38ce5ea23,ge6526c86ff+bcc88f9437,ge79ae78c31+d6b5cd48b5,gee10cc3b42+a6fc98d2e7,gf1cff7945b+7bcba2e4e8,v24.1.5.rc1
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
lsst.meas.algorithms.simple_curve.AmpCurve Class Reference
Inheritance diagram for lsst.meas.algorithms.simple_curve.AmpCurve:
lsst.meas.algorithms.simple_curve.Curve

Public Member Functions

 __init__ (self, amp_name_list, wavelength, efficiency, metadata)
 
 __eq__ (self, other)
 
 fromTable (cls, table)
 
 toTable (self)
 
 evaluate (self, detector, position, wavelength, kind='linear', bounds_error=False, fill_value=0)
 

Public Attributes

 data
 

Static Public Attributes

str mode = 'AMP'
 

Detailed Description

Subclass of `Curve` that represents a curve per amp.

Parameters
----------
amp_name_list : iterable of `str`
    The name of the amp for each entry
wavelength : `astropy.units.Quantity`
    Wavelength values for this curve
efficiency : `astropy.units.Quantity`
    Quantum efficiency values for this curve
metadata : `dict`
    Dictionary of metadata for this curve

Definition at line 331 of file simple_curve.py.

Constructor & Destructor Documentation

◆ __init__()

lsst.meas.algorithms.simple_curve.AmpCurve.__init__ ( self,
amp_name_list,
wavelength,
efficiency,
metadata )

Reimplemented from lsst.meas.algorithms.simple_curve.Curve.

Definition at line 347 of file simple_curve.py.

347 def __init__(self, amp_name_list, wavelength, efficiency, metadata):
348 super().__init__(wavelength, efficiency, metadata)
349 amp_names = set(amp_name_list)
350 self.data = {}
351 for amp_name in sorted(amp_names):
352 idx = numpy.where(amp_name_list == amp_name)[0]
353 # Deal with the case where the keys are bytes from FITS
354 name = amp_name
355 if isinstance(name, bytes):
356 name = name.decode()
357 self.data[name] = (wavelength[idx], efficiency[idx])
358
daf::base::PropertySet * set
Definition fits.cc:931

Member Function Documentation

◆ __eq__()

lsst.meas.algorithms.simple_curve.AmpCurve.__eq__ ( self,
other )
Define equality for this class

Reimplemented from lsst.meas.algorithms.simple_curve.Curve.

Definition at line 359 of file simple_curve.py.

359 def __eq__(self, other):
360 if not self.compare_metadata(other):
361 return False
362 for k in self.data:
363 if not numpy.array_equal(self.data[k][0], other.data[k][0]):
364 return False
365 if not numpy.array_equal(self.data[k][1], other.data[k][1]):
366 return False
367 return True
368

◆ evaluate()

lsst.meas.algorithms.simple_curve.AmpCurve.evaluate ( self,
detector,
position,
wavelength,
kind = 'linear',
bounds_error = False,
fill_value = 0 )
Interpolate the curve at the specified position and wavelength.

Parameters
----------
detector : `lsst.afw.cameraGeom.Detector`
    Is used to find the appropriate curve given the position for
    curves that vary over the detector.  Ignored in the case where
    there is only a single curve per detector.
position : `lsst.geom.Point2D`
    The position on the detector at which to evaluate the curve.
wavelength : `astropy.units.Quantity`
    The wavelength(s) at which to make the interpolation.
kind : `str`, optional
    The type of interpolation to do (default is 'linear').
    See documentation for `scipy.interpolate.interp1d` for
    accepted values.
bounds_error : `bool`, optional
    Raise error if interpolating outside the range of x?
    (default is False)
fill_value : `float`, optional
    Fill values outside the range of x with this value
    (default is 0).

Returns
-------
value : `astropy.units.Quantity`
    Interpolated value(s).  Number of values returned will match the
    length of `wavelength`.

Raises
------
ValueError
    If the ``bounds_error`` is changed from the default, it will raise
    a `ValueError` if evaluating outside the bounds of the curve.

Reimplemented from lsst.meas.algorithms.simple_curve.Curve.

Definition at line 401 of file simple_curve.py.

401 def evaluate(self, detector, position, wavelength, kind='linear', bounds_error=False, fill_value=0):
402 # Docstring inherited from base classs
403 amp = cgUtils.findAmp(detector, Point2I(position)) # cast to Point2I if Point2D passed
404 w, e = self.data[amp.getName()]
405 return self.interpolate(w, e, wavelength, kind=kind, bounds_error=bounds_error,
406 fill_value=fill_value)
407
408

◆ fromTable()

lsst.meas.algorithms.simple_curve.AmpCurve.fromTable ( cls,
table )
Class method for constructing a `Curve` object.

Parameters
----------
table : `astropy.table.QTable`
    Table containing metadata and columns necessary
    for constructing a `Curve` object.

Returns
-------
curve : `Curve`
    A `Curve` subclass of the appropriate type according
    to the table metadata

Reimplemented from lsst.meas.algorithms.simple_curve.Curve.

Definition at line 370 of file simple_curve.py.

370 def fromTable(cls, table):
371 # Docstring inherited from base classs
372 cls._check_cols(['amp_name', 'wavelength', 'efficiency'], table)
373 return cls(table['amp_name'], table['wavelength'],
374 table['efficiency'], table.meta)
375

◆ toTable()

lsst.meas.algorithms.simple_curve.AmpCurve.toTable ( self)
Convert this `Curve` object to an `astropy.table.QTable`.

Returns
-------
table : `astropy.table.QTable`
    A table object containing the data from this `Curve`.

Reimplemented from lsst.meas.algorithms.simple_curve.Curve.

Definition at line 376 of file simple_curve.py.

376 def toTable(self):
377 # Docstring inherited from base classs
378 wavelength = None
379 efficiency = None
380 names = numpy.array([])
381 # Loop over the amps and concatenate into three same length columns to feed
382 # to the Table constructor.
383 for amp_name, val in self.data.items():
384 # This will preserve the quantity
385 if wavelength is None:
386 wunit = val[0].unit
387 wavelength = val[0].value
388 else:
389 wavelength = numpy.concatenate([wavelength, val[0].value])
390 if efficiency is None:
391 eunit = val[1].unit
392 efficiency = val[1].value
393 else:
394 efficiency = numpy.concatenate([efficiency, val[1].value])
395 names = numpy.concatenate([names, numpy.full(val[0].shape, amp_name)])
396 names = numpy.array(names)
397 # Note that in future, the astropy.unit should make it through concatenation
398 return QTable({'amp_name': names, 'wavelength': wavelength*wunit, 'efficiency': efficiency*eunit},
399 meta=self.metadata)
400
std::vector< SchemaItem< Flag > > * items

Member Data Documentation

◆ data

lsst.meas.algorithms.simple_curve.AmpCurve.data

Definition at line 350 of file simple_curve.py.

◆ mode

str lsst.meas.algorithms.simple_curve.AmpCurve.mode = 'AMP'
static

Definition at line 345 of file simple_curve.py.


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