LSSTApplications  8.0.0.0+107,8.0.0.1+13,9.1+18,9.2,master-g084aeec0a4,master-g0aced2eed8+6,master-g15627eb03c,master-g28afc54ef9,master-g3391ba5ea0,master-g3d0fb8ae5f,master-g4432ae2e89+36,master-g5c3c32f3ec+17,master-g60f1e072bb+1,master-g6a3ac32d1b,master-g76a88a4307+1,master-g7bce1f4e06+57,master-g8ff4092549+31,master-g98e65bf68e,master-ga6b77976b1+53,master-gae20e2b580+3,master-gb584cd3397+53,master-gc5448b162b+1,master-gc54cf9771d,master-gc69578ece6+1,master-gcbf758c456+22,master-gcec1da163f+63,master-gcf15f11bcc,master-gd167108223,master-gf44c96c709
LSSTDataManagementBasePackage
Public Member Functions | Static Public Member Functions | Public Attributes | Static Private Attributes | List of all members
lsst.meas.photocal.colorterms.Colorterm Class Reference
Inheritance diagram for lsst.meas.photocal.colorterms.Colorterm:

Public Member Functions

def __init__
 
def __str__
 

Static Public Member Functions

def setColorterms
 
def setActiveDevice
 
def getColorterm
 
def transformSource
 
def transformMags
 
def propagateFluxErrors
 

Public Attributes

 primary
 
 secondary
 
 c0
 
 c1
 
 c2
 

Static Private Attributes

dictionary _colorterms = {}
 
 _activeColorterms = None
 

Detailed Description

A class to describe colour terms between photometric bands

Definition at line 24 of file colorterms.py.

Constructor & Destructor Documentation

def lsst.meas.photocal.colorterms.Colorterm.__init__ (   self,
  primary,
  secondary,
  c0,
  c1 = 0.0,
  c2 = 0.0 
)
The transformed magnitude p' is given by
p' = primary + c0 + c1*(primary - secondary) + c2*(primary - secondary)**2

Definition at line 30 of file colorterms.py.

30 
31  def __init__(self, primary, secondary, c0, c1=0.0, c2=0.0):
32  """The transformed magnitude p' is given by
33  p' = primary + c0 + c1*(primary - secondary) + c2*(primary - secondary)**2
34  """
35  self.primary = primary
36  self.secondary = secondary
37  self.c0 = c0
38  self.c1 = c1
39  self.c2 = c2

Member Function Documentation

def lsst.meas.photocal.colorterms.Colorterm.__str__ (   self)

Definition at line 40 of file colorterms.py.

40 
41  def __str__(self):
42  return "%s %s [%g %g %g]" % (self.primary, self.secondary, self.c0, self.c1, self.c2)
def lsst.meas.photocal.colorterms.Colorterm.getColorterm (   band)
static
Return the Colorterm for the specified band (or None if unknown)

Definition at line 67 of file colorterms.py.

67 
68  def getColorterm(band):
69  """Return the Colorterm for the specified band (or None if unknown)"""
70  return Colorterm._activeColorterms.get(band) if Colorterm._activeColorterms else None
def lsst.meas.photocal.colorterms.Colorterm.propagateFluxErrors (   band,
  primaryFluxErr,
  secondaryFluxErr,
  reverse = False,
  colorterms = None 
)
static

Definition at line 112 of file colorterms.py.

113  def propagateFluxErrors(band, primaryFluxErr, secondaryFluxErr, reverse=False, colorterms=None):
114  if not colorterms:
115  colorterms = Colorterm._activeColorterms
116 
117  if not colorterms:
118  return primaryFluxErr
119 
120  ct = colorterms[band]
121 
122  return np.hypot((1 + ct.c1)*primaryFluxErr, ct.c1*secondaryFluxErr)
123 
def lsst.meas.photocal.colorterms.Colorterm.setActiveDevice (   device,
  allowRaise = True 
)
static
Set the default colour terms to those appropriate for <device>

Definition at line 56 of file colorterms.py.

56 
57  def setActiveDevice(device, allowRaise=True):
58  """Set the default colour terms to those appropriate for <device>"""
59  try:
60  Colorterm._activeColorterms = Colorterm._colorterms[device]
61  except KeyError:
62  if device is not None and allowRaise:
63  raise RuntimeError("No colour terms are available for %s" % device)
64 
65  Colorterm._activeColorterms = None
def lsst.meas.photocal.colorterms.Colorterm.setColorterms (   colorterms,
  device = None 
)
static
Set the cached Colorterms dict for <device> to <colorterms>
If device is omitted, set the dictionary of known devices' Colorterms

Definition at line 44 of file colorterms.py.

44 
45  def setColorterms(colorterms, device=None):
46  """Set the cached Colorterms dict for <device> to <colorterms>
47 If device is omitted, set the dictionary of known devices' Colorterms
48 """
49  if device:
50  Colorterm._colorterms[device] = colorterms[device]
51  else:
52  Colorterm._colorterms = colorterms
53 
54  Colorterm.setActiveDevice(device, allowRaise=False)
def lsst.meas.photocal.colorterms.Colorterm.transformMags (   band,
  primary,
  secondary,
  reverse = False,
  colorterms = None 
)
static
Transform the magnitudes <primary> and <secondary> to the specified <band> and return it.
Use the colorterms (or the cached set if colorterms is None); if no set is available, return the <band> flux
If reverse is True, return the inverse transformed magnitude

Definition at line 90 of file colorterms.py.

90 
91  def transformMags(band, primary, secondary, reverse=False, colorterms=None):
92  """Transform the magnitudes <primary> and <secondary> to the specified <band> and return it.
93 Use the colorterms (or the cached set if colorterms is None); if no set is available, return the <band> flux
94 If reverse is True, return the inverse transformed magnitude
95  """
96  if not colorterms:
97  colorterms = Colorterm._activeColorterms
98 
99  if not colorterms:
100  return p
101 
102  ct = colorterms[band]
103 
104  p = primary
105  s = secondary
106 
107  if reverse:
108  raise NotImplemented("reverse photometric transformations are not implemented")
109  else:
110  return p + ct.c0 + (p - s)*(ct.c1 + (p - s)*ct.c2)
def lsst.meas.photocal.colorterms.Colorterm.transformSource (   band,
  source,
  reverse = False,
  colorterms = None 
)
static
Transform the magnitudes in <source> to the specified <band> and return it. The <source> must
support a get(band) (e.g. source.get("r")) method, as do afw::Source and dicts.
Use the colorterms (or the cached set if colorterms is None); if no set is available, return the <band> flux
If reverse is True, return the inverse transformed magnitude

Definition at line 72 of file colorterms.py.

72 
73  def transformSource(band, source, reverse=False, colorterms=None):
74  """Transform the magnitudes in <source> to the specified <band> and return it. The <source> must
75 support a get(band) (e.g. source.get("r")) method, as do afw::Source and dicts.
76 Use the colorterms (or the cached set if colorterms is None); if no set is available, return the <band> flux
77 If reverse is True, return the inverse transformed magnitude
78  """
79  if not colorterms:
80  colorterms = Colorterm._activeColorterms
81 
82  if not colorterms:
83  return source.get(band)
84 
85  ct = colorterms[band]
86 
87  return Colorterm.transformMags(band, source.get(ct.primary), source.get(ct.secondary),
88  reverse, colorterms)

Member Data Documentation

lsst.meas.photocal.colorterms.Colorterm._activeColorterms = None
staticprivate

Definition at line 28 of file colorterms.py.

dictionary lsst.meas.photocal.colorterms.Colorterm._colorterms = {}
staticprivate

Definition at line 27 of file colorterms.py.

lsst.meas.photocal.colorterms.Colorterm.c0

Definition at line 36 of file colorterms.py.

lsst.meas.photocal.colorterms.Colorterm.c1

Definition at line 37 of file colorterms.py.

lsst.meas.photocal.colorterms.Colorterm.c2

Definition at line 38 of file colorterms.py.

lsst.meas.photocal.colorterms.Colorterm.primary

Definition at line 34 of file colorterms.py.

lsst.meas.photocal.colorterms.Colorterm.secondary

Definition at line 35 of file colorterms.py.


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