LSSTApplications  17.0+124,17.0+14,17.0+73,18.0.0+37,18.0.0+80,18.0.0-4-g68ffd23+4,18.1.0-1-g0001055+12,18.1.0-1-g03d53ef+5,18.1.0-1-g1349e88+55,18.1.0-1-g2505f39+44,18.1.0-1-g5315e5e+4,18.1.0-1-g5e4b7ea+14,18.1.0-1-g7e8fceb+4,18.1.0-1-g85f8cd4+48,18.1.0-1-g8ff0b9f+4,18.1.0-1-ga2c679d+1,18.1.0-1-gd55f500+35,18.1.0-10-gb58edde+2,18.1.0-11-g0997b02+4,18.1.0-13-gfe4edf0b+12,18.1.0-14-g259bd21+21,18.1.0-19-gdb69f3f+2,18.1.0-2-g5f9922c+24,18.1.0-2-gd3b74e5+11,18.1.0-2-gfbf3545+32,18.1.0-26-g728bddb4+5,18.1.0-27-g6ff7ca9+2,18.1.0-3-g52aa583+25,18.1.0-3-g8ea57af+9,18.1.0-3-gb69f684+42,18.1.0-3-gfcaddf3+6,18.1.0-32-gd8786685a,18.1.0-4-gf3f9b77+6,18.1.0-5-g1dd662b+2,18.1.0-5-g6dbcb01+41,18.1.0-6-gae77429+3,18.1.0-7-g9d75d83+9,18.1.0-7-gae09a6d+30,18.1.0-9-gc381ef5+4,w.2019.45
LSSTDataManagementBasePackage
Classes | Functions
lsst.obs.base.instrument Namespace Reference

Classes

class  Instrument
 

Functions

def makeExposureRecordFromObsInfo (obsInfo, universe)
 
def makeVisitRecordFromObsInfo (obsInfo, universe, region=None)
 
def addUnboundedCalibrationLabel (registry, instrumentName)
 

Function Documentation

◆ addUnboundedCalibrationLabel()

def lsst.obs.base.instrument.addUnboundedCalibrationLabel (   registry,
  instrumentName 
)
Add a special 'unbounded' calibration_label dimension entry for the
given camera that is valid for any exposure.

If such an entry already exists, this function just returns a `DataId`
for the existing entry.

Parameters
----------
registry : `Registry`
    Registry object in which to insert the dimension entry.
instrumentName : `str`
    Name of the instrument this calibration label is associated with.

Returns
-------
dataId : `DataId`
    New or existing data ID for the unbounded calibration.

Definition at line 208 of file instrument.py.

208 def addUnboundedCalibrationLabel(registry, instrumentName):
209  """Add a special 'unbounded' calibration_label dimension entry for the
210  given camera that is valid for any exposure.
211 
212  If such an entry already exists, this function just returns a `DataId`
213  for the existing entry.
214 
215  Parameters
216  ----------
217  registry : `Registry`
218  Registry object in which to insert the dimension entry.
219  instrumentName : `str`
220  Name of the instrument this calibration label is associated with.
221 
222  Returns
223  -------
224  dataId : `DataId`
225  New or existing data ID for the unbounded calibration.
226  """
227  d = dict(instrument=instrumentName, calibration_label="unbounded")
228  try:
229  return registry.expandDataId(d)
230  except LookupError:
231  pass
232  entry = d.copy()
233  entry["datetime_begin"] = datetime.min
234  entry["datetime_end"] = datetime.max
235  registry.insertDimensionData("calibration_label", entry)
236  return registry.expandDataId(d)
237 
def addUnboundedCalibrationLabel(registry, instrumentName)
Definition: instrument.py:208

◆ 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 142 of file instrument.py.

142 def makeExposureRecordFromObsInfo(obsInfo, universe):
143  """Construct an exposure DimensionRecord from
144  `astro_metadata_translator.ObservationInfo`.
145 
146  Parameters
147  ----------
148  obsInfo : `astro_metadata_translator.ObservationInfo`
149  A `~astro_metadata_translator.ObservationInfo` object corresponding to
150  the exposure.
151  universe : `DimensionUniverse`
152  Set of all known dimensions.
153 
154  Returns
155  -------
156  record : `DimensionRecord`
157  A record containing exposure metadata, suitable for insertion into
158  a `Registry`.
159  """
160  dimension = universe["exposure"]
161  return dimension.RecordClass.fromDict({
162  "instrument": obsInfo.instrument,
163  "id": obsInfo.exposure_id,
164  "name": obsInfo.observation_id,
165  "datetime_begin": obsInfo.datetime_begin.to_datetime(),
166  "datetime_end": obsInfo.datetime_end.to_datetime(),
167  "exposure_time": obsInfo.exposure_time.to_value("s"),
168  "dark_time": obsInfo.dark_time.to_value("s"),
169  "observation_type": obsInfo.observation_type,
170  "physical_filter": obsInfo.physical_filter,
171  "visit": obsInfo.visit_id,
172  })
173 
174 
def makeExposureRecordFromObsInfo(obsInfo, universe)
Definition: instrument.py:142

◆ makeVisitRecordFromObsInfo()

def lsst.obs.base.instrument.makeVisitRecordFromObsInfo (   obsInfo,
  universe,
  region = None 
)
Construct a visit `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.
region : `lsst.sphgeom.Region`, optional
    Spatial region for the visit.

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

Definition at line 175 of file instrument.py.

175 def makeVisitRecordFromObsInfo(obsInfo, universe, *, region=None):
176  """Construct a visit `DimensionRecord` from
177  `astro_metadata_translator.ObservationInfo`.
178 
179  Parameters
180  ----------
181  obsInfo : `astro_metadata_translator.ObservationInfo`
182  A `~astro_metadata_translator.ObservationInfo` object corresponding to
183  the exposure.
184  universe : `DimensionUniverse`
185  Set of all known dimensions.
186  region : `lsst.sphgeom.Region`, optional
187  Spatial region for the visit.
188 
189  Returns
190  -------
191  record : `DimensionRecord`
192  A record containing visit metadata, suitable for insertion into a
193  `Registry`.
194  """
195  dimension = universe["visit"]
196  return dimension.RecordClass.fromDict({
197  "instrument": obsInfo.instrument,
198  "id": obsInfo.visit_id,
199  "name": obsInfo.observation_id,
200  "datetime_begin": obsInfo.datetime_begin.to_datetime(),
201  "datetime_end": obsInfo.datetime_end.to_datetime(),
202  "exposure_time": obsInfo.exposure_time.to_value("s"),
203  "physical_filter": obsInfo.physical_filter,
204  "region": region,
205  })
206 
207 
def makeVisitRecordFromObsInfo(obsInfo, universe, region=None)
Definition: instrument.py:175