FormatterFactory¶
- 
class lsst.daf.butler.FormatterFactory¶
- Bases: - object- Factory for - Formatterinstances.- Methods Summary - getFormatter(entity)- Get a new formatter instance. - getFormatterWithMatch(entity)- Get a new formatter instance along with the matching registry key. - getLookupKeys()- Retrieve the look up keys for all the registry entries. - normalizeDimensions(universe)- Normalize formatter lookups that use dimensions. - registerFormatter(type_, formatter)- Register a - Formatter.- registerFormatters(config)- Bulk register formatters from a config. - Methods Documentation - 
getFormatter(entity)¶
- Get a new formatter instance. - Parameters: - entity : DatasetRef,DatasetTypeorStorageClass, orstr
- Entity to use to determine the formatter to return. - StorageClasswill be used as a last resort if- DatasetRefor- DatasetTypeinstance is provided. Supports instrument override if a- DatasetRefis provided configured with an- instrumentvalue for the data ID.
 - Returns: - formatter : Formatter
- An instance of the registered formatter. 
 
- entity : 
 - 
getFormatterWithMatch(entity)¶
- Get a new formatter instance along with the matching registry key. - Parameters: - entity : DatasetRef,DatasetTypeorStorageClass, orstr
- Entity to use to determine the formatter to return. - StorageClasswill be used as a last resort if- DatasetRefor- DatasetTypeinstance is provided. Supports instrument override if a- DatasetRefis provided configured with an- instrumentvalue for the data ID.
 - Returns: 
- entity : 
 - 
getLookupKeys()¶
- Retrieve the look up keys for all the registry entries. - Returns: 
 - 
normalizeDimensions(universe)¶
- Normalize formatter lookups that use dimensions. - Parameters: - universe : DimensionUniverse
- The set of all known dimensions. If - None, returns without action.
 - Raises: - ValueError
- Raised if a key exists where a dimension is not part of the - universe.
 - Notes - Goes through all registered formatters, and for keys that include dimensions, rewrites those keys to use a verified set of dimensions. - Returns without action if the formatter keys have already been normalized. 
- universe : 
 - 
registerFormatter(type_, formatter)¶
- Register a - Formatter.- Parameters: - type_ : LookupKey,strorStorageClassorDatasetType
- Type for which this formatter is to be used. If a - LookupKeyis not provided, one will be constructed from the supplied string or by using the- nameproperty of the supplied entity.
- formatter : str
- Identifies a - Formattersubclass to use for reading and writing Datasets of this type.
 - Raises: - ValueError
- Raised if the formatter does not name a valid formatter type. 
 
- type_ : 
 - 
registerFormatters(config)¶
- Bulk register formatters from a config. - Parameters: - config : Config
- formatterssection of a configuration.
 - Notes - The configuration can include one level of hierarchy where an instrument-specific section can be defined to override more general template specifications. This is represented in YAML using a key of form - instrument<name>which can then define templates that will be returned if a- DatasetRefcontains a matching instrument name in the data ID.- The config is parsed using the function - processLookupConfigs.
- config : 
 
-