lsst.obs.base  14.0-24-g714dd46+1
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
lsst.obs.base.makeRawVisitInfo.MakeRawVisitInfo Class Reference
Inheritance diagram for lsst.obs.base.makeRawVisitInfo.MakeRawVisitInfo:

Public Member Functions

def __init__ (self, log=None)
 
def __call__ (self, md, exposureId)
 
def setArgDict (self, md, argDict)
 
def getDateAvg (self, md, exposureTime)
 
def getDarkTime (self, argDict)
 
def offsetDate (self, date, offsetSec)
 
def popItem (self, md, key, default=None)
 
def popFloat (self, md, key)
 
def popAngle (self, md, key, units=astropy.units.deg)
 
def popIsoDate (self, md, key, timesys=None)
 
def popMjdDate (self, md, key, timesys=None)
 

Static Public Member Functions

def eraFromLstAndLongitude (lst, longitude)
 
def altitudeFromZenithDistance (zd)
 
def centigradeFromKelvin (tempK)
 
def pascalFromMBar (mbar)
 
def pascalFromMmHg (mmHg)
 
def pascalFromTorr (torr)
 
def defaultMetadata (value, defaultValue, minimum=None, maximum=None)
 

Public Attributes

 log
 

Detailed Description

Base class functor to make a VisitInfo from the FITS header of a raw image

A subclass will be wanted for each camera. Subclasses should override
- setArgDict: the override can call the base implementation,
                which simply sets exposure time and date of observation
- setDateAvg

The design philosophy is to make a best effort and log warnings of problems,
rather than raising exceptions, in order to extract as much VisitInfo information as possible
from a messy FITS header without the user needing to add a lot of error handling.

However, the methods that transform units are less forgiving; they assume
the user provides proper data types, since type errors in arguments to those
are almost certainly due to coding mistakes.

Definition at line 50 of file makeRawVisitInfo.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.obs.base.makeRawVisitInfo.MakeRawVisitInfo.__init__ (   self,
  log = None 
)
Construct a MakeRawVisitInfo

Definition at line 67 of file makeRawVisitInfo.py.

Member Function Documentation

◆ __call__()

def lsst.obs.base.makeRawVisitInfo.MakeRawVisitInfo.__call__ (   self,
  md,
  exposureId 
)
Construct a VisitInfo and strip associated data from the metadata

@param[in,out] md  metadata, as an lsst.daf.base.PropertyList or PropertySet;
    items that are used are stripped from the metadata
    (except TIMESYS, because it may apply to more than one other keyword).
@param[in] exposureId  exposure ID

The basic implementation sets date and exposureTime using typical values
found in FITS files and logs a warning if neither can be set.

Definition at line 74 of file makeRawVisitInfo.py.

◆ altitudeFromZenithDistance()

def lsst.obs.base.makeRawVisitInfo.MakeRawVisitInfo.altitudeFromZenithDistance (   zd)
static
Convert zenith distance to altitude (lsst.afw.geom.Angle)

Definition at line 279 of file makeRawVisitInfo.py.

◆ centigradeFromKelvin()

def lsst.obs.base.makeRawVisitInfo.MakeRawVisitInfo.centigradeFromKelvin (   tempK)
static
Convert temperature from Kelvin to Centigrade

Definition at line 284 of file makeRawVisitInfo.py.

◆ defaultMetadata()

def lsst.obs.base.makeRawVisitInfo.MakeRawVisitInfo.defaultMetadata (   value,
  defaultValue,
  minimum = None,
  maximum = None 
)
static
Check metadata for valid values against defaults.

@param[in] value  metadata value returned by popItem, popFloat, or popAngle
@param[in] defaultValue  default value to use if the metadata value is invalid
@param[in] minimum  Minimum possible valid value, optional
@param[in] maximum  Maximum possible valid value, optional

Definition at line 311 of file makeRawVisitInfo.py.

◆ eraFromLstAndLongitude()

def lsst.obs.base.makeRawVisitInfo.MakeRawVisitInfo.eraFromLstAndLongitude (   lst,
  longitude 
)
static
Return an approximate Earth Rotation Angle (afw:Angle) computed from
local sidereal time and longitude (both as afw:Angle; Longitude shares
the afw:Observatory covention: positive values are E of Greenwich).

NOTE: if we properly compute ERA via UT1 a la DM-8053, we should remove
this method.

Definition at line 267 of file makeRawVisitInfo.py.

◆ getDarkTime()

def lsst.obs.base.makeRawVisitInfo.MakeRawVisitInfo.getDarkTime (   self,
  argDict 
)
Get the darkTime from the DARKTIME keyword, else expTime, else NaN

Subclasses should call this function if desired, by putting:
argDict['darkTime'] = self.getDarkTime(argDict)
in their __init__() method of the derived class.

@param[in] argDict  argDict
@return darkTime darkTime, as inferred from the metadata

Definition at line 125 of file makeRawVisitInfo.py.

◆ getDateAvg()

def lsst.obs.base.makeRawVisitInfo.MakeRawVisitInfo.getDateAvg (   self,
  md,
  exposureTime 
)
Return date at the middle of the exposure

@param[in,out] md  metadata, as an lsst.daf.base.PropertyList or PropertySet;
    items that are used are stripped from the metadata
    (except TIMESYS, because it may apply to more than one other keyword).
@param[in] exposureTime  exposure time (sec)

Subclasses must override. Here is a typical implementation:
dateObs = self.popIsoDate(md, "DATE-OBS")
return self.offsetDate(dateObs, 0.5*exposureTime)

Definition at line 111 of file makeRawVisitInfo.py.

◆ offsetDate()

def lsst.obs.base.makeRawVisitInfo.MakeRawVisitInfo.offsetDate (   self,
  date,
  offsetSec 
)
Return a date offset by a specified number of seconds

@param[in] date  date (an lsst.daf.base.DateTime)
@param[in] offsetSec  offset, in seconds (float)
@return the offset date (an lsst.daf.base.DateTime)

Definition at line 147 of file makeRawVisitInfo.py.

◆ pascalFromMBar()

def lsst.obs.base.makeRawVisitInfo.MakeRawVisitInfo.pascalFromMBar (   mbar)
static
Convert pressure from millibars to Pascals

Definition at line 289 of file makeRawVisitInfo.py.

◆ pascalFromMmHg()

def lsst.obs.base.makeRawVisitInfo.MakeRawVisitInfo.pascalFromMmHg (   mmHg)
static
Convert pressure from mm Hg to Pascals

@note could use the following, but astropy.units.cds is not fully compatible with Python 2
as of astropy 1.2.1 (see https://github.com/astropy/astropy/issues/5350#issuecomment-248612824):
astropy.units.cds.mmHg.to(astropy.units.pascal, mmHg)

Definition at line 295 of file makeRawVisitInfo.py.

◆ pascalFromTorr()

def lsst.obs.base.makeRawVisitInfo.MakeRawVisitInfo.pascalFromTorr (   torr)
static
Convert pressure from torr to Pascals

Definition at line 305 of file makeRawVisitInfo.py.

◆ popAngle()

def lsst.obs.base.makeRawVisitInfo.MakeRawVisitInfo.popAngle (   self,
  md,
  key,
  units = astropy.units.deg 
)
Pop an lsst.afw.geom.Angle, whose metadata is in the specified units, with a default of Nan

The angle may be specified as a float or sexagesimal string with 1-3 fields.

@param[in,out] md  metadata, as an lsst.daf.base.PropertyList or PropertySet
@param[in] key  date key to read and remove from md
@return angle, as an lsst.afw.geom.Angle; Angle(NaN) if the key is not found

Definition at line 200 of file makeRawVisitInfo.py.

◆ popFloat()

def lsst.obs.base.makeRawVisitInfo.MakeRawVisitInfo.popFloat (   self,
  md,
  key 
)
Pop a float with a default of Nan

@param[in,out] md  metadata, as an lsst.daf.base.PropertyList or PropertySet
@param[in] key  date key to read and remove from md
@return the value of the specified key as a float; float("nan") if the key is not found

Definition at line 186 of file makeRawVisitInfo.py.

◆ popIsoDate()

def lsst.obs.base.makeRawVisitInfo.MakeRawVisitInfo.popIsoDate (   self,
  md,
  key,
  timesys = None 
)
Pop a FITS ISO date as an lsst.daf.base.DateTime

@param[in,out] md  metadata, as an lsst.daf.base.PropertyList or PropertySet
@param[in] key  date key to read and remove from md
@param[in] timesys  time system as a string (not case sensitive), e.g. "UTC" or None;
    if None then look for TIMESYS (but do NOT pop it, since it may be used
    for more than one date) and if not found, use UTC
@return date as an lsst.daf.base.DateTime; DateTime() if the key is not found

Definition at line 217 of file makeRawVisitInfo.py.

◆ popItem()

def lsst.obs.base.makeRawVisitInfo.MakeRawVisitInfo.popItem (   self,
  md,
  key,
  default = None 
)
Remove an item of metadata and return the value

@param[in,out] md  metadata, as an lsst.daf.base.PropertyList or PropertySet;
    the popped key is removed
@param[in] key  metadata key
@param[in] default  default value to return if key not found; ignored if doRaise true
@return the value of the specified key, using whatever type md.get(key) returns

Log a warning if the key is not found

Definition at line 163 of file makeRawVisitInfo.py.

◆ popMjdDate()

def lsst.obs.base.makeRawVisitInfo.MakeRawVisitInfo.popMjdDate (   self,
  md,
  key,
  timesys = None 
)
Get a FITS MJD date as an lsst.daf.base.DateTime

@param[in,out] md  metadata, as an lsst.daf.base.PropertyList or PropertySet
@param[in] dateKey  date key to read and remove from md
@param[in] timesys  time system as a string, e.g. "UTC" or None;
    if None then look for TIMESYS (but do NOT pop it, since it may be used
    for more than one date) and if not found, use UTC
@return date as an lsst.daf.base.DateTime; DateTime() if the key is not found

Definition at line 243 of file makeRawVisitInfo.py.

◆ setArgDict()

def lsst.obs.base.makeRawVisitInfo.MakeRawVisitInfo.setArgDict (   self,
  md,
  argDict 
)
Fill an argument dict with arguments for VisitInfo and pop associated metadata

Subclasses are expected to override this method, though the override
may wish to call this default implementation, which:
- sets exposureTime from "EXPTIME"
- sets date by calling getDateAvg

@param[in,out] md  metadata, as an lsst.daf.base.PropertyList or PropertySet;
    items that are used are stripped from the metadata
    (except TIMESYS, because it may apply to more than one other keyword).
@param[in,out] argdict  a dict of arguments

Subclasses should expand this or replace it.

Definition at line 93 of file makeRawVisitInfo.py.

Member Data Documentation

◆ log

lsst.obs.base.makeRawVisitInfo.MakeRawVisitInfo.log

Definition at line 72 of file makeRawVisitInfo.py.


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