LSSTApplications  19.0.0-14-gb0260a2+72efe9b372,20.0.0+7927753e06,20.0.0+8829bf0056,20.0.0+995114c5d2,20.0.0+b6f4b2abd1,20.0.0+bddc4f4cbe,20.0.0-1-g253301a+8829bf0056,20.0.0-1-g2b7511a+0d71a2d77f,20.0.0-1-g5b95a8c+7461dd0434,20.0.0-12-g321c96ea+23efe4bbff,20.0.0-16-gfab17e72e+fdf35455f6,20.0.0-2-g0070d88+ba3ffc8f0b,20.0.0-2-g4dae9ad+ee58a624b3,20.0.0-2-g61b8584+5d3db074ba,20.0.0-2-gb780d76+d529cf1a41,20.0.0-2-ged6426c+226a441f5f,20.0.0-2-gf072044+8829bf0056,20.0.0-2-gf1f7952+ee58a624b3,20.0.0-20-geae50cf+e37fec0aee,20.0.0-25-g3dcad98+544a109665,20.0.0-25-g5eafb0f+ee58a624b3,20.0.0-27-g64178ef+f1f297b00a,20.0.0-3-g4cc78c6+e0676b0dc8,20.0.0-3-g8f21e14+4fd2c12c9a,20.0.0-3-gbd60e8c+187b78b4b8,20.0.0-3-gbecbe05+48431fa087,20.0.0-38-ge4adf513+a12e1f8e37,20.0.0-4-g97dc21a+544a109665,20.0.0-4-gb4befbc+087873070b,20.0.0-4-gf910f65+5d3db074ba,20.0.0-5-gdfe0fee+199202a608,20.0.0-5-gfbfe500+d529cf1a41,20.0.0-6-g64f541c+d529cf1a41,20.0.0-6-g9a5b7a1+a1cd37312e,20.0.0-68-ga3f3dda+5fca18c6a4,20.0.0-9-g4aef684+e18322736b,w.2020.45
LSSTDataManagementBasePackage
Classes | Functions | Variables
lsst.obs.base._instrument Namespace Reference

Classes

class  Instrument
 

Functions

def makeExposureRecordFromObsInfo (obsInfo, universe)
 
Tuple[Camera, bool] loadCamera (Butler butler, DataId dataId, *Any collections=None)
 

Variables

dictionary StandardCuratedCalibrationDatasetTypes
 

Function Documentation

◆ loadCamera()

Tuple[Camera, bool] lsst.obs.base._instrument.loadCamera ( Butler  butler,
DataId  dataId,
*Any   collections = None 
)
Attempt to load versioned camera geometry from a butler, but fall back
to obtaining a nominal camera from the `Instrument` class if that fails.

Parameters
----------
butler : `lsst.daf.butler.Butler`
    Butler instance to attempt to query for and load a ``camera`` dataset
    from.
dataId : `dict` or `DataCoordinate`
    Data ID that identifies at least the ``instrument`` and ``exposure``
    dimensions.
collections : Any, optional
    Collections to be searched, overriding ``self.butler.collections``.
    Can be any of the types supported by the ``collections`` argument
    to butler construction.

Returns
-------
camera : `lsst.afw.cameraGeom.Camera`
    Camera object.
versioned : `bool`
    If `True`, the camera was obtained from the butler and should represent
    a versioned camera from a calibration repository.  If `False`, no
    camera datasets were found, and the returned camera was produced by
    instantiating the appropriate `Instrument` class and calling
    `Instrument.getCamera`.

Definition at line 757 of file _instrument.py.

757 def loadCamera(butler: Butler, dataId: DataId, *, collections: Any = None) -> Tuple[Camera, bool]:
758  """Attempt to load versioned camera geometry from a butler, but fall back
759  to obtaining a nominal camera from the `Instrument` class if that fails.
760 
761  Parameters
762  ----------
763  butler : `lsst.daf.butler.Butler`
764  Butler instance to attempt to query for and load a ``camera`` dataset
765  from.
766  dataId : `dict` or `DataCoordinate`
767  Data ID that identifies at least the ``instrument`` and ``exposure``
768  dimensions.
769  collections : Any, optional
770  Collections to be searched, overriding ``self.butler.collections``.
771  Can be any of the types supported by the ``collections`` argument
772  to butler construction.
773 
774  Returns
775  -------
776  camera : `lsst.afw.cameraGeom.Camera`
777  Camera object.
778  versioned : `bool`
779  If `True`, the camera was obtained from the butler and should represent
780  a versioned camera from a calibration repository. If `False`, no
781  camera datasets were found, and the returned camera was produced by
782  instantiating the appropriate `Instrument` class and calling
783  `Instrument.getCamera`.
784  """
785  if collections is None:
786  collections = butler.collections
787  # Registry would do data ID expansion internally if we didn't do it first,
788  # but we might want an expanded data ID ourselves later, so we do it here
789  # to ensure it only happens once.
790  # This will also catch problems with the data ID not having keys we need.
791  dataId = butler.registry.expandDataId(dataId, graph=butler.registry.dimensions["exposure"].graph)
792  try:
793  cameraRef = butler.get("camera", dataId=dataId, collections=collections)
794  return cameraRef, True
795  except LookupError:
796  pass
797  instrument = Instrument.fromName(dataId["instrument"], butler.registry)
798  return instrument.getCamera(), False

◆ makeExposureRecordFromObsInfo()

def lsst.obs.base._instrument.makeExposureRecordFromObsInfo (   obsInfo,
  universe 
)
Construct an exposure DimensionRecord from
`astro_metadata_translator.ObservationInfo`.

Parameters
----------
obsInfo : `astro_metadata_translator.ObservationInfo`
    A `~astro_metadata_translator.ObservationInfo` object corresponding to
    the exposure.
universe : `DimensionUniverse`
    Set of all known dimensions.

Returns
-------
record : `DimensionRecord`
    A record containing exposure metadata, suitable for insertion into
    a `Registry`.

Definition at line 702 of file _instrument.py.

702 def makeExposureRecordFromObsInfo(obsInfo, universe):
703  """Construct an exposure DimensionRecord from
704  `astro_metadata_translator.ObservationInfo`.
705 
706  Parameters
707  ----------
708  obsInfo : `astro_metadata_translator.ObservationInfo`
709  A `~astro_metadata_translator.ObservationInfo` object corresponding to
710  the exposure.
711  universe : `DimensionUniverse`
712  Set of all known dimensions.
713 
714  Returns
715  -------
716  record : `DimensionRecord`
717  A record containing exposure metadata, suitable for insertion into
718  a `Registry`.
719  """
720  dimension = universe["exposure"]
721 
722  ra, dec, sky_angle, zenith_angle = (None, None, None, None)
723  if obsInfo.tracking_radec is not None:
724  icrs = obsInfo.tracking_radec.icrs
725  ra = icrs.ra.degree
726  dec = icrs.dec.degree
727  if obsInfo.boresight_rotation_coord == "sky":
728  sky_angle = obsInfo.boresight_rotation_angle.degree
729  if obsInfo.altaz_begin is not None:
730  zenith_angle = obsInfo.altaz_begin.zen.degree
731 
732  return dimension.RecordClass(
733  instrument=obsInfo.instrument,
734  id=obsInfo.exposure_id,
735  obs_id=obsInfo.observation_id,
736  group_name=obsInfo.exposure_group,
737  group_id=obsInfo.visit_id,
738  datetime_begin=obsInfo.datetime_begin,
739  datetime_end=obsInfo.datetime_end,
740  exposure_time=obsInfo.exposure_time.to_value("s"),
741  # we are not mandating that dark_time be calculable
742  dark_time=obsInfo.dark_time.to_value("s") if obsInfo.dark_time is not None else None,
743  observation_type=obsInfo.observation_type,
744  observation_reason=obsInfo.observation_reason,
745  day_obs=obsInfo.observing_day,
746  seq_num=obsInfo.observation_counter,
747  physical_filter=obsInfo.physical_filter,
748  science_program=obsInfo.science_program,
749  target_name=obsInfo.object,
750  tracking_ra=ra,
751  tracking_dec=dec,
752  sky_angle=sky_angle,
753  zenith_angle=zenith_angle,
754  )
755 
756 

Variable Documentation

◆ StandardCuratedCalibrationDatasetTypes

dictionary lsst.obs.base._instrument.StandardCuratedCalibrationDatasetTypes
Initial value:
1 = {
2  "defects": {"dimensions": ("instrument", "detector"), "storageClass": "Defects"},
3  "qe_curve": {"dimensions": ("instrument", "detector"), "storageClass": "QECurve"},
4  "crosstalk": {"dimensions": ("instrument", "detector"), "storageClass": "CrosstalkCalib"},
5 }

Definition at line 51 of file _instrument.py.

lsst.obs.base._instrument.loadCamera
Tuple[Camera, bool] loadCamera(Butler butler, DataId dataId, *Any collections=None)
Definition: _instrument.py:757
lsst.obs.base._instrument.makeExposureRecordFromObsInfo
def makeExposureRecordFromObsInfo(obsInfo, universe)
Definition: _instrument.py:702