LSST Applications  21.0.0+75b29a8a7f,21.0.0+e70536a077,21.0.0-1-ga51b5d4+62c747d40b,21.0.0-10-gbfb87ad6+3307648ee3,21.0.0-15-gedb9d5423+47cba9fc36,21.0.0-2-g103fe59+fdf0863a2a,21.0.0-2-g1367e85+d38a93257c,21.0.0-2-g45278ab+e70536a077,21.0.0-2-g5242d73+d38a93257c,21.0.0-2-g7f82c8f+e682ffb718,21.0.0-2-g8dde007+d179fbfa6a,21.0.0-2-g8f08a60+9402881886,21.0.0-2-ga326454+e682ffb718,21.0.0-2-ga63a54e+08647d4b1b,21.0.0-2-gde069b7+26c92b3210,21.0.0-2-gecfae73+0445ed2f95,21.0.0-2-gfc62afb+d38a93257c,21.0.0-27-gbbd0d29+ae871e0f33,21.0.0-28-g5fc5e037+feb0e9397b,21.0.0-3-g21c7a62+f4b9c0ff5c,21.0.0-3-g357aad2+57b0bddf0b,21.0.0-3-g4be5c26+d38a93257c,21.0.0-3-g65f322c+3f454acf5d,21.0.0-3-g7d9da8d+75b29a8a7f,21.0.0-3-gaa929c8+9e4ef6332c,21.0.0-3-ge02ed75+4b120a55c4,21.0.0-4-g3300ddd+e70536a077,21.0.0-4-g591bb35+4b120a55c4,21.0.0-4-gc004bbf+4911b9cd27,21.0.0-4-gccdca77+f94adcd104,21.0.0-4-ge8fba5a+2b3a696ff9,21.0.0-5-gb155db7+2c5429117a,21.0.0-5-gdf36809+637e4641ee,21.0.0-6-g00874e7+c9fd7f7160,21.0.0-6-g4e60332+4b120a55c4,21.0.0-7-gc8ca178+40eb9cf840,21.0.0-8-gfbe0b4b+9e4ef6332c,21.0.0-9-g2fd488a+d83b7cd606,w.2021.05
LSST Data Management Base Package
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 861 of file _instrument.py.

861 def loadCamera(butler: Butler, dataId: DataId, *, collections: Any = None) -> Tuple[Camera, bool]:
862  """Attempt to load versioned camera geometry from a butler, but fall back
863  to obtaining a nominal camera from the `Instrument` class if that fails.
864 
865  Parameters
866  ----------
867  butler : `lsst.daf.butler.Butler`
868  Butler instance to attempt to query for and load a ``camera`` dataset
869  from.
870  dataId : `dict` or `DataCoordinate`
871  Data ID that identifies at least the ``instrument`` and ``exposure``
872  dimensions.
873  collections : Any, optional
874  Collections to be searched, overriding ``self.butler.collections``.
875  Can be any of the types supported by the ``collections`` argument
876  to butler construction.
877 
878  Returns
879  -------
880  camera : `lsst.afw.cameraGeom.Camera`
881  Camera object.
882  versioned : `bool`
883  If `True`, the camera was obtained from the butler and should represent
884  a versioned camera from a calibration repository. If `False`, no
885  camera datasets were found, and the returned camera was produced by
886  instantiating the appropriate `Instrument` class and calling
887  `Instrument.getCamera`.
888  """
889  if collections is None:
890  collections = butler.collections
891  # Registry would do data ID expansion internally if we didn't do it first,
892  # but we might want an expanded data ID ourselves later, so we do it here
893  # to ensure it only happens once.
894  # This will also catch problems with the data ID not having keys we need.
895  dataId = butler.registry.expandDataId(dataId, graph=butler.registry.dimensions["exposure"].graph)
896  try:
897  cameraRef = butler.get("camera", dataId=dataId, collections=collections)
898  return cameraRef, True
899  except LookupError:
900  pass
901  instrument = Instrument.fromName(dataId["instrument"], butler.registry)
902  return instrument.getCamera(), False
Tuple[Camera, bool] loadCamera(Butler butler, DataId dataId, *Any collections=None)
Definition: _instrument.py:861

◆ 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 806 of file _instrument.py.

806 def makeExposureRecordFromObsInfo(obsInfo, universe):
807  """Construct an exposure DimensionRecord from
808  `astro_metadata_translator.ObservationInfo`.
809 
810  Parameters
811  ----------
812  obsInfo : `astro_metadata_translator.ObservationInfo`
813  A `~astro_metadata_translator.ObservationInfo` object corresponding to
814  the exposure.
815  universe : `DimensionUniverse`
816  Set of all known dimensions.
817 
818  Returns
819  -------
820  record : `DimensionRecord`
821  A record containing exposure metadata, suitable for insertion into
822  a `Registry`.
823  """
824  dimension = universe["exposure"]
825 
826  ra, dec, sky_angle, zenith_angle = (None, None, None, None)
827  if obsInfo.tracking_radec is not None:
828  icrs = obsInfo.tracking_radec.icrs
829  ra = icrs.ra.degree
830  dec = icrs.dec.degree
831  if obsInfo.boresight_rotation_coord == "sky":
832  sky_angle = obsInfo.boresight_rotation_angle.degree
833  if obsInfo.altaz_begin is not None:
834  zenith_angle = obsInfo.altaz_begin.zen.degree
835 
836  return dimension.RecordClass(
837  instrument=obsInfo.instrument,
838  id=obsInfo.exposure_id,
839  obs_id=obsInfo.observation_id,
840  group_name=obsInfo.exposure_group,
841  group_id=obsInfo.visit_id,
842  datetime_begin=obsInfo.datetime_begin,
843  datetime_end=obsInfo.datetime_end,
844  exposure_time=obsInfo.exposure_time.to_value("s"),
845  # we are not mandating that dark_time be calculable
846  dark_time=obsInfo.dark_time.to_value("s") if obsInfo.dark_time is not None else None,
847  observation_type=obsInfo.observation_type,
848  observation_reason=obsInfo.observation_reason,
849  day_obs=obsInfo.observing_day,
850  seq_num=obsInfo.observation_counter,
851  physical_filter=obsInfo.physical_filter,
852  science_program=obsInfo.science_program,
853  target_name=obsInfo.object,
854  tracking_ra=ra,
855  tracking_dec=dec,
856  sky_angle=sky_angle,
857  zenith_angle=zenith_angle,
858  )
859 
860 
def makeExposureRecordFromObsInfo(obsInfo, universe)
Definition: _instrument.py:806

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 52 of file _instrument.py.