LSST Applications g063fba187b+fee0456c91,g0f08755f38+ea96e5a5a3,g1653933729+a8ce1bb630,g168dd56ebc+a8ce1bb630,g1a2382251a+90257ff92a,g20f6ffc8e0+ea96e5a5a3,g217e2c1bcf+937a289c59,g28da252d5a+daa7da44eb,g2bbee38e9b+253935c60e,g2bc492864f+253935c60e,g3156d2b45e+6e55a43351,g32e5bea42b+31359a2a7a,g347aa1857d+253935c60e,g35bb328faa+a8ce1bb630,g3a166c0a6a+253935c60e,g3b1af351f3+a8ce1bb630,g3e281a1b8c+c5dd892a6c,g414038480c+416496e02f,g41af890bb2+afe91b1188,g599934f4f4+0db33f7991,g7af13505b9+e36de7bce6,g80478fca09+da231ba887,g82479be7b0+a4516e59e3,g858d7b2824+ea96e5a5a3,g89c8672015+f4add4ffd5,g9125e01d80+a8ce1bb630,ga5288a1d22+bc6ab8dfbd,gb58c049af0+d64f4d3760,gc28159a63d+253935c60e,gcab2d0539d+3f2b72788c,gcf0d15dbbd+4ea9c45075,gda6a2b7d83+4ea9c45075,gdaeeff99f8+1711a396fd,ge79ae78c31+253935c60e,gef2f8181fd+3031e3cf99,gf0baf85859+c1f95f4921,gfa517265be+ea96e5a5a3,gfa999e8aa5+17cd334064,w.2024.50
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Attributes | List of all members
lsst.afw.display.rgb._rgbContinued.LinearMapping Class Reference
Inheritance diagram for lsst.afw.display.rgb._rgbContinued.LinearMapping:
lsst.afw.display.rgb._rgbContinued.Mapping lsst.afw.display.rgb._rgbContinued.ZScaleMapping

Public Member Functions

 __init__ (self, minimum=None, maximum=None, image=None)
 
 mapIntensityToUint8 (self, intensity)
 

Public Attributes

 maximum
 

Protected Attributes

 _range
 

Detailed Description

A linear map of red, blue, green intensities into uint8 values

Parameters
----------
minimum : `float` or sequence of `float`
    Intensity that should be mapped to black. If an array, has three
    elements for R, G, B.
maximum : `float`
    Intensity that should be mapped to white
image
    Image to estimate minimum/maximum if not explicitly set

Definition at line 213 of file _rgbContinued.py.

Constructor & Destructor Documentation

◆ __init__()

lsst.afw.display.rgb._rgbContinued.LinearMapping.__init__ ( self,
minimum = None,
maximum = None,
image = None )

Reimplemented from lsst.afw.display.rgb._rgbContinued.Mapping.

Reimplemented in lsst.afw.display.rgb._rgbContinued.ZScaleMapping.

Definition at line 227 of file _rgbContinued.py.

227 def __init__(self, minimum=None, maximum=None, image=None):
228 if minimum is None or maximum is None:
229 assert image is not None, "You must provide an image if you don't set both minimum and maximum"
230
231 stats = afwMath.makeStatistics(image, afwMath.MIN | afwMath.MAX)
232 if minimum is None:
233 minimum = stats.getValue(afwMath.MIN)
234 if maximum is None:
235 maximum = stats.getValue(afwMath.MAX)
236
237 Mapping.__init__(self, minimum, image)
238 self.maximum = maximum
239
240 if maximum is None:
241 self._range = None
242 else:
243 assert maximum - minimum != 0, "minimum and maximum values must not be equal"
244 self._range = float(maximum - minimum)
245
Statistics makeStatistics(lsst::afw::image::Image< Pixel > const &img, lsst::afw::image::Mask< image::MaskPixel > const &msk, int const flags, StatisticsControl const &sctrl=StatisticsControl())
Handle a watered-down front-end to the constructor (no variance)
Definition Statistics.h:361

Member Function Documentation

◆ mapIntensityToUint8()

lsst.afw.display.rgb._rgbContinued.LinearMapping.mapIntensityToUint8 ( self,
intensity )
Return an array which, when multiplied by an image, returns that
image mapped to the range of a uint8, [0, 255] (but not converted to uint8)

The intensity is assumed to have had ``minimum`` subtracted (as that
can be done per-band)

Reimplemented from lsst.afw.display.rgb._rgbContinued.Mapping.

Definition at line 246 of file _rgbContinued.py.

246 def mapIntensityToUint8(self, intensity):
247 """Return an array which, when multiplied by an image, returns that
248 image mapped to the range of a uint8, [0, 255] (but not converted to uint8)
249
250 The intensity is assumed to have had ``minimum`` subtracted (as that
251 can be done per-band)
252 """
253 with np.errstate(invalid='ignore', divide='ignore'): # n.b. np.where can't and doesn't short-circuit
254 return np.where(intensity <= 0, 0,
255 np.where(intensity >= self._range,
256 self._uint8Max/intensity, self._uint8Max/self._range))
257
258

Member Data Documentation

◆ _range

lsst.afw.display.rgb._rgbContinued.LinearMapping._range
protected

Definition at line 241 of file _rgbContinued.py.

◆ maximum

lsst.afw.display.rgb._rgbContinued.LinearMapping.maximum

Definition at line 238 of file _rgbContinued.py.


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