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
Public Member Functions | Static Public Member Functions | List of all members
lsst.obs.base._instrument.Instrument Class Reference
Inheritance diagram for lsst.obs.base._instrument.Instrument:
lsst.obs.decam._instrument.DarkEnergyCamera

Public Member Functions

def filterDefinitions (self)
 
def __init__ (self)
 
def getName (cls)
 
Set[str] getCuratedCalibrationNames (cls)
 
def getCamera (self)
 
def register (self, registry)
 
def getObsDataPackageDir (cls)
 
def getRawFormatter (self, dataId)
 
def applyConfigOverrides (self, name, config)
 
None writeCuratedCalibrations (self, Butler butler, Optional[str] collection=None, Sequence[str] labels=())
 
None writeAdditionalCuratedCalibrations (self, Butler butler, Optional[str] collection=None, Sequence[str] labels=())
 
None writeCameraGeom (self, Butler butler, Optional[str] collection=None, Sequence[str] labels=())
 
None writeStandardTextCuratedCalibrations (self, Butler butler, Optional[str] collection=None, Sequence[str] labels=())
 
TranslatorFactory makeDataIdTranslatorFactory (self)
 
str makeDefaultRawIngestRunName (cls)
 
str makeUnboundedCalibrationRunName (cls, *str labels)
 
str makeCuratedCalibrationRunName (cls, str calibDate, *str labels)
 
str makeCalibrationCollectionName (cls, *str labels)
 
str makeUmbrellaCollectionName (cls)
 
str makeCollectionName (cls, *str labels)
 

Static Public Member Functions

Instrument fromName (str name, Registry registry)
 
None importAll (Registry registry)
 
str formatCollectionTimestamp (Union[str, datetime.datetime] timestamp)
 
str makeCollectionTimestamp ()
 
str makeRefCatCollectionName (*str labels)
 

Detailed Description

Base class for instrument-specific logic for the Gen3 Butler.

Concrete instrument subclasses should be directly constructable with no
arguments.

Definition at line 59 of file _instrument.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.obs.base._instrument.Instrument.__init__ (   self)

Definition at line 109 of file _instrument.py.

109  def __init__(self):
110  self.filterDefinitions.reset()
111  self.filterDefinitions.defineFilters()
112 

Member Function Documentation

◆ applyConfigOverrides()

def lsst.obs.base._instrument.Instrument.applyConfigOverrides (   self,
  name,
  config 
)
Apply instrument-specific overrides for a task config.

Parameters
----------
name : `str`
    Name of the object being configured; typically the _DefaultName
    of a Task.
config : `lsst.pex.config.Config`
    Config instance to which overrides should be applied.

Definition at line 312 of file _instrument.py.

312  def applyConfigOverrides(self, name, config):
313  """Apply instrument-specific overrides for a task config.
314 
315  Parameters
316  ----------
317  name : `str`
318  Name of the object being configured; typically the _DefaultName
319  of a Task.
320  config : `lsst.pex.config.Config`
321  Config instance to which overrides should be applied.
322  """
323  for root in self.configPaths:
324  path = os.path.join(root, f"{name}.py")
325  if os.path.exists(path):
326  config.load(path)
327 

◆ filterDefinitions()

def lsst.obs.base._instrument.Instrument.filterDefinitions (   self)
`~lsst.obs.base.FilterDefinitionCollection`, defining the filters
for this instrument.

Definition at line 103 of file _instrument.py.

103  def filterDefinitions(self):
104  """`~lsst.obs.base.FilterDefinitionCollection`, defining the filters
105  for this instrument.
106  """
107  return None
108 

◆ formatCollectionTimestamp()

str lsst.obs.base._instrument.Instrument.formatCollectionTimestamp ( Union[str, datetime.datetime]  timestamp)
static
Format a timestamp for use in a collection name.

Parameters
----------
timestamp : `str` or `datetime.datetime`
    Timestamp to format.  May be a date or datetime string in extended
    ISO format (assumed UTC), with or without a timezone specifier, a
    datetime string in basic ISO format with a timezone specifier, a
    naive `datetime.datetime` instance (assumed UTC) or a
    timezone-aware `datetime.datetime` instance (converted to UTC).
    This is intended to cover all forms that string ``CALIBDATE``
    metadata values have taken in the past, as well as the format this
    method itself writes out (to enable round-tripping).

Returns
-------
formatted : `str`
    Standardized string form for the timestamp.

Definition at line 626 of file _instrument.py.

626  def formatCollectionTimestamp(timestamp: Union[str, datetime.datetime]) -> str:
627  """Format a timestamp for use in a collection name.
628 
629  Parameters
630  ----------
631  timestamp : `str` or `datetime.datetime`
632  Timestamp to format. May be a date or datetime string in extended
633  ISO format (assumed UTC), with or without a timezone specifier, a
634  datetime string in basic ISO format with a timezone specifier, a
635  naive `datetime.datetime` instance (assumed UTC) or a
636  timezone-aware `datetime.datetime` instance (converted to UTC).
637  This is intended to cover all forms that string ``CALIBDATE``
638  metadata values have taken in the past, as well as the format this
639  method itself writes out (to enable round-tripping).
640 
641  Returns
642  -------
643  formatted : `str`
644  Standardized string form for the timestamp.
645  """
646  if isinstance(timestamp, str):
647  if "-" in timestamp:
648  # extended ISO format, with - and : delimiters
649  timestamp = datetime.datetime.fromisoformat(timestamp)
650  else:
651  # basic ISO format, with no delimiters (what this method
652  # returns)
653  timestamp = datetime.datetime.strptime(timestamp, "%Y%m%dT%H%M%S%z")
654  if not isinstance(timestamp, datetime.datetime):
655  raise TypeError(f"Unexpected date/time object: {timestamp!r}.")
656  if timestamp.tzinfo is not None:
657  timestamp = timestamp.astimezone(datetime.timezone.utc)
658  return f"{timestamp:%Y%m%dT%H%M%S}Z"
659 

◆ fromName()

Instrument lsst.obs.base._instrument.Instrument.fromName ( str  name,
Registry  registry 
)
static
Given an instrument name and a butler, retrieve a corresponding
instantiated instrument object.

Parameters
----------
name : `str`
    Name of the instrument (must match the return value of `getName`).
registry : `lsst.daf.butler.Registry`
    Butler registry to query to find the information.

Returns
-------
instrument : `Instrument`
    An instance of the relevant `Instrument`.

Notes
-----
The instrument must be registered in the corresponding butler.

Raises
------
LookupError
    Raised if the instrument is not known to the supplied registry.
ModuleNotFoundError
    Raised if the class could not be imported.  This could mean
    that the relevant obs package has not been setup.
TypeError
    Raised if the class name retrieved is not a string.

Definition at line 206 of file _instrument.py.

206  def fromName(name: str, registry: Registry) -> Instrument:
207  """Given an instrument name and a butler, retrieve a corresponding
208  instantiated instrument object.
209 
210  Parameters
211  ----------
212  name : `str`
213  Name of the instrument (must match the return value of `getName`).
214  registry : `lsst.daf.butler.Registry`
215  Butler registry to query to find the information.
216 
217  Returns
218  -------
219  instrument : `Instrument`
220  An instance of the relevant `Instrument`.
221 
222  Notes
223  -----
224  The instrument must be registered in the corresponding butler.
225 
226  Raises
227  ------
228  LookupError
229  Raised if the instrument is not known to the supplied registry.
230  ModuleNotFoundError
231  Raised if the class could not be imported. This could mean
232  that the relevant obs package has not been setup.
233  TypeError
234  Raised if the class name retrieved is not a string.
235  """
236  records = list(registry.queryDimensionRecords("instrument", instrument=name))
237  if not records:
238  raise LookupError(f"No registered instrument with name '{name}'.")
239  cls = records[0].class_name
240  if not isinstance(cls, str):
241  raise TypeError(f"Unexpected class name retrieved from {name} instrument dimension (got {cls})")
242  instrument = doImport(cls)
243  return instrument()
244 
daf::base::PropertyList * list
Definition: fits.cc:913

◆ getCamera()

def lsst.obs.base._instrument.Instrument.getCamera (   self)
Retrieve the cameraGeom representation of this instrument.

This is a temporary API that should go away once ``obs`` packages have
a standardized approach to writing versioned cameras to a Gen3 repo.

Reimplemented in lsst.obs.decam._instrument.DarkEnergyCamera.

Definition at line 158 of file _instrument.py.

158  def getCamera(self):
159  """Retrieve the cameraGeom representation of this instrument.
160 
161  This is a temporary API that should go away once ``obs`` packages have
162  a standardized approach to writing versioned cameras to a Gen3 repo.
163  """
164  raise NotImplementedError()
165 

◆ getCuratedCalibrationNames()

Set[str] lsst.obs.base._instrument.Instrument.getCuratedCalibrationNames (   cls)
Return the names of all the curated calibration dataset types.

Returns
-------
names : `set` of `str`
    The dataset type names of all curated calibrations. This will
    include the standard curated calibrations even if the particular
    instrument does not support them.

Notes
-----
The returned list does not indicate whether a particular dataset
is present in the Butler repository, simply that these are the
dataset types that are handled by ``writeCuratedCalibrations``.

Definition at line 126 of file _instrument.py.

126  def getCuratedCalibrationNames(cls) -> Set[str]:
127  """Return the names of all the curated calibration dataset types.
128 
129  Returns
130  -------
131  names : `set` of `str`
132  The dataset type names of all curated calibrations. This will
133  include the standard curated calibrations even if the particular
134  instrument does not support them.
135 
136  Notes
137  -----
138  The returned list does not indicate whether a particular dataset
139  is present in the Butler repository, simply that these are the
140  dataset types that are handled by ``writeCuratedCalibrations``.
141  """
142 
143  # Camera is a special dataset type that is also handled as a
144  # curated calibration.
145  curated = {"camera"}
146 
147  # Make a cursory attempt to filter out curated dataset types
148  # that are not present for this instrument
149  for datasetTypeName in cls.standardCuratedDatasetTypes:
150  calibPath = cls._getSpecificCuratedCalibrationPath(datasetTypeName)
151  if calibPath is not None:
152  curated.add(datasetTypeName)
153 
154  curated.update(cls.additionalCuratedDatasetTypes)
155  return frozenset(curated)
156 

◆ getName()

def lsst.obs.base._instrument.Instrument.getName (   cls)
Return the short (dimension) name for this instrument.

This is not (in general) the same as the class name - it's what is used
as the value of the "instrument" field in data IDs, and is usually an
abbreviation of the full name.

Reimplemented in lsst.obs.decam._instrument.DarkEnergyCamera.

Definition at line 115 of file _instrument.py.

115  def getName(cls):
116  """Return the short (dimension) name for this instrument.
117 
118  This is not (in general) the same as the class name - it's what is used
119  as the value of the "instrument" field in data IDs, and is usually an
120  abbreviation of the full name.
121  """
122  raise NotImplementedError()
123 
std::string const & getName() const noexcept
Return a filter's name.
Definition: Filter.h:78

◆ getObsDataPackageDir()

def lsst.obs.base._instrument.Instrument.getObsDataPackageDir (   cls)
The root of the obs data package that provides specializations for
this instrument.

returns
-------
dir : `str`
    The root of the relevat obs data package.

Definition at line 192 of file _instrument.py.

192  def getObsDataPackageDir(cls):
193  """The root of the obs data package that provides specializations for
194  this instrument.
195 
196  returns
197  -------
198  dir : `str`
199  The root of the relevat obs data package.
200  """
201  if cls.obsDataPackage is None:
202  return None
203  return getPackageDir(cls.obsDataPackage)
204 
std::string getPackageDir(std::string const &packageName)
return the root directory of a setup package
Definition: packaging.cc:33

◆ getRawFormatter()

def lsst.obs.base._instrument.Instrument.getRawFormatter (   self,
  dataId 
)
Return the Formatter class that should be used to read a particular
raw file.

Parameters
----------
dataId : `DataCoordinate`
    Dimension-based ID for the raw file or files being ingested.

Returns
-------
formatter : `Formatter` class
    Class to be used that reads the file into an
    `lsst.afw.image.Exposure` instance.

Reimplemented in lsst.obs.decam._instrument.DarkEnergyCamera.

Definition at line 295 of file _instrument.py.

295  def getRawFormatter(self, dataId):
296  """Return the Formatter class that should be used to read a particular
297  raw file.
298 
299  Parameters
300  ----------
301  dataId : `DataCoordinate`
302  Dimension-based ID for the raw file or files being ingested.
303 
304  Returns
305  -------
306  formatter : `Formatter` class
307  Class to be used that reads the file into an
308  `lsst.afw.image.Exposure` instance.
309  """
310  raise NotImplementedError()
311 

◆ importAll()

None lsst.obs.base._instrument.Instrument.importAll ( Registry  registry)
static
Import all the instruments known to this registry.

This will ensure that all metadata translators have been registered.

Parameters
----------
registry : `lsst.daf.butler.Registry`
    Butler registry to query to find the information.

Notes
-----
It is allowed for a particular instrument class to fail on import.
This might simply indicate that a particular obs package has
not been setup.

Definition at line 246 of file _instrument.py.

246  def importAll(registry: Registry) -> None:
247  """Import all the instruments known to this registry.
248 
249  This will ensure that all metadata translators have been registered.
250 
251  Parameters
252  ----------
253  registry : `lsst.daf.butler.Registry`
254  Butler registry to query to find the information.
255 
256  Notes
257  -----
258  It is allowed for a particular instrument class to fail on import.
259  This might simply indicate that a particular obs package has
260  not been setup.
261  """
262  records = list(registry.queryDimensionRecords("instrument"))
263  for record in records:
264  cls = record.class_name
265  try:
266  doImport(cls)
267  except Exception:
268  pass
269 

◆ makeCalibrationCollectionName()

str lsst.obs.base._instrument.Instrument.makeCalibrationCollectionName (   cls,
*str  labels 
)
Make a CALIBRATION collection name appropriate for associating
calibration datasets with validity ranges.

Parameters
----------
*labels : `str`
    Strings to be appended to the base name, using the default
    delimiter for collection names.  Usually this is the name of the
    ticket on which the calibration collection is being created.

Returns
-------
name : `str`
    Calibration collection name.

Definition at line 727 of file _instrument.py.

727  def makeCalibrationCollectionName(cls, *labels: str) -> str:
728  """Make a CALIBRATION collection name appropriate for associating
729  calibration datasets with validity ranges.
730 
731  Parameters
732  ----------
733  *labels : `str`
734  Strings to be appended to the base name, using the default
735  delimiter for collection names. Usually this is the name of the
736  ticket on which the calibration collection is being created.
737 
738  Returns
739  -------
740  name : `str`
741  Calibration collection name.
742  """
743  return cls.makeCollectionName("calib", *labels)
744 

◆ makeCollectionName()

str lsst.obs.base._instrument.Instrument.makeCollectionName (   cls,
*str  labels 
)
Get the instrument-specific collection string to use as derived
from the supplied labels.

Parameters
----------
*labels : `str`
    Strings to be combined with the instrument name to form a
    collection name.

Returns
-------
name : `str`
    Collection name to use that includes the instrument name.

Definition at line 788 of file _instrument.py.

788  def makeCollectionName(cls, *labels: str) -> str:
789  """Get the instrument-specific collection string to use as derived
790  from the supplied labels.
791 
792  Parameters
793  ----------
794  *labels : `str`
795  Strings to be combined with the instrument name to form a
796  collection name.
797 
798  Returns
799  -------
800  name : `str`
801  Collection name to use that includes the instrument name.
802  """
803  return "/".join((cls.getName(),) + labels)
804 
805 

◆ makeCollectionTimestamp()

str lsst.obs.base._instrument.Instrument.makeCollectionTimestamp ( )
static
Create a timestamp string for use in a collection name from the
current time.

Returns
-------
formatted : `str`
    Standardized string form of the current time.

Definition at line 661 of file _instrument.py.

661  def makeCollectionTimestamp() -> str:
662  """Create a timestamp string for use in a collection name from the
663  current time.
664 
665  Returns
666  -------
667  formatted : `str`
668  Standardized string form of the current time.
669  """
670  return Instrument.formatCollectionTimestamp(datetime.datetime.now(tz=datetime.timezone.utc))
671 

◆ makeCuratedCalibrationRunName()

str lsst.obs.base._instrument.Instrument.makeCuratedCalibrationRunName (   cls,
str  calibDate,
*str  labels 
)
Make a RUN collection name appropriate for inserting curated
calibration datasets with the given ``CALIBDATE`` metadata value.

Parameters
----------
calibDate : `str`
    The ``CALIBDATE`` metadata value.
*labels : `str`
    Strings to be included in the collection name (before
    ``calibDate``, but after all other terms), using the default
    delimiter for collection names.  Usually this is the name of the
    ticket on which the calibration collection is being created.

Returns
-------
name : `str`
    Run collection name.

Definition at line 705 of file _instrument.py.

705  def makeCuratedCalibrationRunName(cls, calibDate: str, *labels: str) -> str:
706  """Make a RUN collection name appropriate for inserting curated
707  calibration datasets with the given ``CALIBDATE`` metadata value.
708 
709  Parameters
710  ----------
711  calibDate : `str`
712  The ``CALIBDATE`` metadata value.
713  *labels : `str`
714  Strings to be included in the collection name (before
715  ``calibDate``, but after all other terms), using the default
716  delimiter for collection names. Usually this is the name of the
717  ticket on which the calibration collection is being created.
718 
719  Returns
720  -------
721  name : `str`
722  Run collection name.
723  """
724  return cls.makeCollectionName("calib", *labels, "curated", cls.formatCollectionTimestamp(calibDate))
725 

◆ makeDataIdTranslatorFactory()

TranslatorFactory lsst.obs.base._instrument.Instrument.makeDataIdTranslatorFactory (   self)
Return a factory for creating Gen2->Gen3 data ID translators,
specialized for this instrument.

Derived class implementations should generally call
`TranslatorFactory.addGenericInstrumentRules` with appropriate
arguments, but are not required to (and may not be able to if their
Gen2 raw data IDs are sufficiently different from the HSC/DECam/CFHT
norm).

Returns
-------
factory : `TranslatorFactory`.
    Factory for `Translator` objects.

Reimplemented in lsst.obs.decam._instrument.DarkEnergyCamera.

Definition at line 608 of file _instrument.py.

608  def makeDataIdTranslatorFactory(self) -> TranslatorFactory:
609  """Return a factory for creating Gen2->Gen3 data ID translators,
610  specialized for this instrument.
611 
612  Derived class implementations should generally call
613  `TranslatorFactory.addGenericInstrumentRules` with appropriate
614  arguments, but are not required to (and may not be able to if their
615  Gen2 raw data IDs are sufficiently different from the HSC/DECam/CFHT
616  norm).
617 
618  Returns
619  -------
620  factory : `TranslatorFactory`.
621  Factory for `Translator` objects.
622  """
623  raise NotImplementedError("Must be implemented by derived classes.")
624 

◆ makeDefaultRawIngestRunName()

str lsst.obs.base._instrument.Instrument.makeDefaultRawIngestRunName (   cls)
Make the default instrument-specific run collection string for raw
data ingest.

Returns
-------
coll : `str`
    Run collection name to be used as the default for ingestion of
    raws.

Definition at line 673 of file _instrument.py.

673  def makeDefaultRawIngestRunName(cls) -> str:
674  """Make the default instrument-specific run collection string for raw
675  data ingest.
676 
677  Returns
678  -------
679  coll : `str`
680  Run collection name to be used as the default for ingestion of
681  raws.
682  """
683  return cls.makeCollectionName("raw", "all")
684 

◆ makeRefCatCollectionName()

str lsst.obs.base._instrument.Instrument.makeRefCatCollectionName ( *str  labels)
static
Return a global (not instrument-specific) name for a collection that
holds reference catalogs.

With no arguments, this returns the name of the collection that holds
all reference catalogs (usually a ``CHAINED`` collection, at least in
long-lived repos that may contain more than one reference catalog).

Parameters
----------
*labels : `str`
    Strings to be added to the global collection name, in order to
    define a collection name for one or more reference catalogs being
    ingested at the same time.

Returns
-------
name : `str`
    Collection name.

Notes
-----
This is a ``staticmethod``, not a ``classmethod``, because it should
be the same for all instruments.

Definition at line 746 of file _instrument.py.

746  def makeRefCatCollectionName(*labels: str) -> str:
747  """Return a global (not instrument-specific) name for a collection that
748  holds reference catalogs.
749 
750  With no arguments, this returns the name of the collection that holds
751  all reference catalogs (usually a ``CHAINED`` collection, at least in
752  long-lived repos that may contain more than one reference catalog).
753 
754  Parameters
755  ----------
756  *labels : `str`
757  Strings to be added to the global collection name, in order to
758  define a collection name for one or more reference catalogs being
759  ingested at the same time.
760 
761  Returns
762  -------
763  name : `str`
764  Collection name.
765 
766  Notes
767  -----
768  This is a ``staticmethod``, not a ``classmethod``, because it should
769  be the same for all instruments.
770  """
771  return "/".join(("refcats",) + labels)
772 

◆ makeUmbrellaCollectionName()

str lsst.obs.base._instrument.Instrument.makeUmbrellaCollectionName (   cls)
Return the name of the umbrella ``CHAINED`` collection for this
instrument that combines all standard recommended input collections.

This method should almost never be overridden by derived classes.

Returns
-------
name : `str`
    Name for the umbrella collection.

Definition at line 774 of file _instrument.py.

774  def makeUmbrellaCollectionName(cls) -> str:
775  """Return the name of the umbrella ``CHAINED`` collection for this
776  instrument that combines all standard recommended input collections.
777 
778  This method should almost never be overridden by derived classes.
779 
780  Returns
781  -------
782  name : `str`
783  Name for the umbrella collection.
784  """
785  return cls.makeCollectionName("defaults")
786 

◆ makeUnboundedCalibrationRunName()

str lsst.obs.base._instrument.Instrument.makeUnboundedCalibrationRunName (   cls,
*str  labels 
)
Make a RUN collection name appropriate for inserting calibration
datasets whose validity ranges are unbounded.

Parameters
----------
*labels : `str`
    Extra strings to be included in the base name, using the default
    delimiter for collection names.  Usually this is the name of the
    ticket on which the calibration collection is being created.

Returns
-------
name : `str`
    Run collection name.

Definition at line 686 of file _instrument.py.

686  def makeUnboundedCalibrationRunName(cls, *labels: str) -> str:
687  """Make a RUN collection name appropriate for inserting calibration
688  datasets whose validity ranges are unbounded.
689 
690  Parameters
691  ----------
692  *labels : `str`
693  Extra strings to be included in the base name, using the default
694  delimiter for collection names. Usually this is the name of the
695  ticket on which the calibration collection is being created.
696 
697  Returns
698  -------
699  name : `str`
700  Run collection name.
701  """
702  return cls.makeCollectionName("calib", *labels, "unbounded")
703 

◆ register()

def lsst.obs.base._instrument.Instrument.register (   self,
  registry 
)
Insert instrument, physical_filter, and detector entries into a
`Registry`.

Implementations should guarantee that registration is atomic (the
registry should not be modified if any error occurs) and idempotent at
the level of individual dimension entries; new detectors and filters
should be added, but changes to any existing record should not be.
This can generally be achieved via a block like::

    with registry.transaction():
        registry.syncDimensionData("instrument", ...)
        registry.syncDimensionData("detector", ...)
        self.registerFilters(registry)

Raises
------
lsst.daf.butler.registry.ConflictingDefinitionError
    Raised if any existing record has the same key but a different
    definition as one being registered.

Reimplemented in lsst.obs.decam._instrument.DarkEnergyCamera.

Definition at line 167 of file _instrument.py.

167  def register(self, registry):
168  """Insert instrument, physical_filter, and detector entries into a
169  `Registry`.
170 
171  Implementations should guarantee that registration is atomic (the
172  registry should not be modified if any error occurs) and idempotent at
173  the level of individual dimension entries; new detectors and filters
174  should be added, but changes to any existing record should not be.
175  This can generally be achieved via a block like::
176 
177  with registry.transaction():
178  registry.syncDimensionData("instrument", ...)
179  registry.syncDimensionData("detector", ...)
180  self.registerFilters(registry)
181 
182  Raises
183  ------
184  lsst.daf.butler.registry.ConflictingDefinitionError
185  Raised if any existing record has the same key but a different
186  definition as one being registered.
187  """
188  raise NotImplementedError()
189 

◆ writeAdditionalCuratedCalibrations()

None lsst.obs.base._instrument.Instrument.writeAdditionalCuratedCalibrations (   self,
Butler  butler,
Optional[str]   collection = None,
Sequence[str]   labels = () 
)
Write additional curated calibrations that might be instrument
specific and are not part of the standard set.

Default implementation does nothing.

Parameters
----------
butler : `lsst.daf.butler.Butler`
    Butler to use to store these calibrations.
collection : `str`, optional
    Name to use for the calibration collection that associates all
    datasets with a validity range.  If this collection already exists,
    it must be a `~CollectionType.CALIBRATION` collection, and it must
    not have any datasets that would conflict with those inserted by
    this method.  If `None`, a collection name is worked out
    automatically from the instrument name and other metadata by
    calling ``makeCalibrationCollectionName``, but this
    default name may not work well for long-lived repositories unless
    ``labels`` is also provided (and changed every time curated
    calibrations are ingested).
labels : `Sequence` [ `str` ], optional
    Extra strings to include in collection names, after concatenating
    them with the standard collection name delimeter.  If provided,
    these are inserted into the names of the `~CollectionType.RUN`
    collections that datasets are inserted directly into, as well the
    `~CollectionType.CALIBRATION` collection if it is generated
    automatically (i.e. if ``collection is None``).  Usually this is
    just the name of the ticket on which the calibration collection is
    being created.

Definition at line 374 of file _instrument.py.

375  labels: Sequence[str] = ()) -> None:
376  """Write additional curated calibrations that might be instrument
377  specific and are not part of the standard set.
378 
379  Default implementation does nothing.
380 
381  Parameters
382  ----------
383  butler : `lsst.daf.butler.Butler`
384  Butler to use to store these calibrations.
385  collection : `str`, optional
386  Name to use for the calibration collection that associates all
387  datasets with a validity range. If this collection already exists,
388  it must be a `~CollectionType.CALIBRATION` collection, and it must
389  not have any datasets that would conflict with those inserted by
390  this method. If `None`, a collection name is worked out
391  automatically from the instrument name and other metadata by
392  calling ``makeCalibrationCollectionName``, but this
393  default name may not work well for long-lived repositories unless
394  ``labels`` is also provided (and changed every time curated
395  calibrations are ingested).
396  labels : `Sequence` [ `str` ], optional
397  Extra strings to include in collection names, after concatenating
398  them with the standard collection name delimeter. If provided,
399  these are inserted into the names of the `~CollectionType.RUN`
400  collections that datasets are inserted directly into, as well the
401  `~CollectionType.CALIBRATION` collection if it is generated
402  automatically (i.e. if ``collection is None``). Usually this is
403  just the name of the ticket on which the calibration collection is
404  being created.
405  """
406  return
407 

◆ writeCameraGeom()

None lsst.obs.base._instrument.Instrument.writeCameraGeom (   self,
Butler  butler,
Optional[str]   collection = None,
Sequence[str]   labels = () 
)
Write the default camera geometry to the butler repository and
associate it with the appropriate validity range in a calibration
collection.

Parameters
----------
butler : `lsst.daf.butler.Butler`
    Butler to use to store these calibrations.
collection : `str`, optional
    Name to use for the calibration collection that associates all
    datasets with a validity range.  If this collection already exists,
    it must be a `~CollectionType.CALIBRATION` collection, and it must
    not have any datasets that would conflict with those inserted by
    this method.  If `None`, a collection name is worked out
    automatically from the instrument name and other metadata by
    calling ``makeCalibrationCollectionName``, but this
    default name may not work well for long-lived repositories unless
    ``labels`` is also provided (and changed every time curated
    calibrations are ingested).
labels : `Sequence` [ `str` ], optional
    Extra strings to include in collection names, after concatenating
    them with the standard collection name delimeter.  If provided,
    these are inserted into the names of the `~CollectionType.RUN`
    collections that datasets are inserted directly into, as well the
    `~CollectionType.CALIBRATION` collection if it is generated
    automatically (i.e. if ``collection is None``).  Usually this is
    just the name of the ticket on which the calibration collection is
    being created.

Definition at line 408 of file _instrument.py.

409  labels: Sequence[str] = ()) -> None:
410  """Write the default camera geometry to the butler repository and
411  associate it with the appropriate validity range in a calibration
412  collection.
413 
414  Parameters
415  ----------
416  butler : `lsst.daf.butler.Butler`
417  Butler to use to store these calibrations.
418  collection : `str`, optional
419  Name to use for the calibration collection that associates all
420  datasets with a validity range. If this collection already exists,
421  it must be a `~CollectionType.CALIBRATION` collection, and it must
422  not have any datasets that would conflict with those inserted by
423  this method. If `None`, a collection name is worked out
424  automatically from the instrument name and other metadata by
425  calling ``makeCalibrationCollectionName``, but this
426  default name may not work well for long-lived repositories unless
427  ``labels`` is also provided (and changed every time curated
428  calibrations are ingested).
429  labels : `Sequence` [ `str` ], optional
430  Extra strings to include in collection names, after concatenating
431  them with the standard collection name delimeter. If provided,
432  these are inserted into the names of the `~CollectionType.RUN`
433  collections that datasets are inserted directly into, as well the
434  `~CollectionType.CALIBRATION` collection if it is generated
435  automatically (i.e. if ``collection is None``). Usually this is
436  just the name of the ticket on which the calibration collection is
437  being created.
438  """
439  if collection is None:
440  collection = self.makeCalibrationCollectionName(*labels)
441  butler.registry.registerCollection(collection, type=CollectionType.CALIBRATION)
442  run = self.makeUnboundedCalibrationRunName(*labels)
443  butler.registry.registerRun(run)
444  datasetType = DatasetType("camera", ("instrument",), "Camera", isCalibration=True,
445  universe=butler.registry.dimensions)
446  butler.registry.registerDatasetType(datasetType)
447  camera = self.getCamera()
448  ref = butler.put(camera, datasetType, {"instrument": self.getName()}, run=run)
449  butler.registry.certify(collection, [ref], Timespan(begin=None, end=None))
450 

◆ writeCuratedCalibrations()

None lsst.obs.base._instrument.Instrument.writeCuratedCalibrations (   self,
Butler  butler,
Optional[str]   collection = None,
Sequence[str]   labels = () 
)
Write human-curated calibration Datasets to the given Butler with
the appropriate validity ranges.

Parameters
----------
butler : `lsst.daf.butler.Butler`
    Butler to use to store these calibrations.
collection : `str`, optional
    Name to use for the calibration collection that associates all
    datasets with a validity range.  If this collection already exists,
    it must be a `~CollectionType.CALIBRATION` collection, and it must
    not have any datasets that would conflict with those inserted by
    this method.  If `None`, a collection name is worked out
    automatically from the instrument name and other metadata by
    calling ``makeCalibrationCollectionName``, but this
    default name may not work well for long-lived repositories unless
    ``labels`` is also provided (and changed every time curated
    calibrations are ingested).
labels : `Sequence` [ `str` ], optional
    Extra strings to include in collection names, after concatenating
    them with the standard collection name delimeter.  If provided,
    these are inserted into the names of the `~CollectionType.RUN`
    collections that datasets are inserted directly into, as well the
    `~CollectionType.CALIBRATION` collection if it is generated
    automatically (i.e. if ``collection is None``).  Usually this is
    just the name of the ticket on which the calibration collection is
    being created.

Notes
-----
Expected to be called from subclasses.  The base method calls
``writeCameraGeom``, ``writeStandardTextCuratedCalibrations``,
and ``writeAdditionalCuratdCalibrations``.

Definition at line 328 of file _instrument.py.

329  labels: Sequence[str] = ()) -> None:
330  """Write human-curated calibration Datasets to the given Butler with
331  the appropriate validity ranges.
332 
333  Parameters
334  ----------
335  butler : `lsst.daf.butler.Butler`
336  Butler to use to store these calibrations.
337  collection : `str`, optional
338  Name to use for the calibration collection that associates all
339  datasets with a validity range. If this collection already exists,
340  it must be a `~CollectionType.CALIBRATION` collection, and it must
341  not have any datasets that would conflict with those inserted by
342  this method. If `None`, a collection name is worked out
343  automatically from the instrument name and other metadata by
344  calling ``makeCalibrationCollectionName``, but this
345  default name may not work well for long-lived repositories unless
346  ``labels`` is also provided (and changed every time curated
347  calibrations are ingested).
348  labels : `Sequence` [ `str` ], optional
349  Extra strings to include in collection names, after concatenating
350  them with the standard collection name delimeter. If provided,
351  these are inserted into the names of the `~CollectionType.RUN`
352  collections that datasets are inserted directly into, as well the
353  `~CollectionType.CALIBRATION` collection if it is generated
354  automatically (i.e. if ``collection is None``). Usually this is
355  just the name of the ticket on which the calibration collection is
356  being created.
357 
358  Notes
359  -----
360  Expected to be called from subclasses. The base method calls
361  ``writeCameraGeom``, ``writeStandardTextCuratedCalibrations``,
362  and ``writeAdditionalCuratdCalibrations``.
363  """
364  # Delegate registration of collections (and creating names for them)
365  # to other methods so they can be called independently with the same
366  # preconditions. Collection registration is idempotent, so this is
367  # safe, and while it adds a bit of overhead, as long as it's one
368  # registration attempt per method (not per dataset or dataset type),
369  # that's negligible.
370  self.writeCameraGeom(butler, collection, labels=labels)
371  self.writeStandardTextCuratedCalibrations(butler, collection, labels=labels)
372  self.writeAdditionalCuratedCalibrations(butler, collection, labels=labels)
373 

◆ writeStandardTextCuratedCalibrations()

None lsst.obs.base._instrument.Instrument.writeStandardTextCuratedCalibrations (   self,
Butler  butler,
Optional[str]   collection = None,
Sequence[str]   labels = () 
)
Write the set of standardized curated text calibrations to
the repository.

Parameters
----------
butler : `lsst.daf.butler.Butler`
    Butler to receive these calibration datasets.
collection : `str`, optional
    Name to use for the calibration collection that associates all
    datasets with a validity range.  If this collection already exists,
    it must be a `~CollectionType.CALIBRATION` collection, and it must
    not have any datasets that would conflict with those inserted by
    this method.  If `None`, a collection name is worked out
    automatically from the instrument name and other metadata by
    calling ``makeCalibrationCollectionName``, but this
    default name may not work well for long-lived repositories unless
    ``labels`` is also provided (and changed every time curated
    calibrations are ingested).
labels : `Sequence` [ `str` ], optional
    Extra strings to include in collection names, after concatenating
    them with the standard collection name delimeter.  If provided,
    these are inserted into the names of the `~CollectionType.RUN`
    collections that datasets are inserted directly into, as well the
    `~CollectionType.CALIBRATION` collection if it is generated
    automatically (i.e. if ``collection is None``).  Usually this is
    just the name of the ticket on which the calibration collection is
    being created.

Definition at line 451 of file _instrument.py.

452  labels: Sequence[str] = ()) -> None:
453  """Write the set of standardized curated text calibrations to
454  the repository.
455 
456  Parameters
457  ----------
458  butler : `lsst.daf.butler.Butler`
459  Butler to receive these calibration datasets.
460  collection : `str`, optional
461  Name to use for the calibration collection that associates all
462  datasets with a validity range. If this collection already exists,
463  it must be a `~CollectionType.CALIBRATION` collection, and it must
464  not have any datasets that would conflict with those inserted by
465  this method. If `None`, a collection name is worked out
466  automatically from the instrument name and other metadata by
467  calling ``makeCalibrationCollectionName``, but this
468  default name may not work well for long-lived repositories unless
469  ``labels`` is also provided (and changed every time curated
470  calibrations are ingested).
471  labels : `Sequence` [ `str` ], optional
472  Extra strings to include in collection names, after concatenating
473  them with the standard collection name delimeter. If provided,
474  these are inserted into the names of the `~CollectionType.RUN`
475  collections that datasets are inserted directly into, as well the
476  `~CollectionType.CALIBRATION` collection if it is generated
477  automatically (i.e. if ``collection is None``). Usually this is
478  just the name of the ticket on which the calibration collection is
479  being created.
480  """
481  if collection is None:
482  collection = self.makeCalibrationCollectionName(*labels)
483  butler.registry.registerCollection(collection, type=CollectionType.CALIBRATION)
484  runs = set()
485  for datasetTypeName in self.standardCuratedDatasetTypes:
486  # We need to define the dataset types.
487  if datasetTypeName not in StandardCuratedCalibrationDatasetTypes:
488  raise ValueError(f"DatasetType {datasetTypeName} not in understood list"
489  f" [{'.'.join(StandardCuratedCalibrationDatasetTypes)}]")
490  definition = StandardCuratedCalibrationDatasetTypes[datasetTypeName]
491  datasetType = DatasetType(datasetTypeName,
492  universe=butler.registry.dimensions,
493  isCalibration=True,
494  **definition)
495  self._writeSpecificCuratedCalibrationDatasets(butler, datasetType, collection, runs=runs,
496  labels=labels)
497 
daf::base::PropertySet * set
Definition: fits.cc:912

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