Formatter¶
- 
class lsst.daf.butler.Formatter(fileDescriptor: lsst.daf.butler.core.fileDescriptor.FileDescriptor)¶
- Bases: - object- Interface for reading and writing Datasets with a particular - StorageClass.- Parameters
- fileDescriptorFileDescriptor, optional
- Identifies the file to read or write, and the associated storage classes and parameter information. Its value can be - Noneif the caller will never call- Formatter.reador- Formatter.write.
 
- fileDescriptor
 - Attributes Summary - FileDescriptor associated with this formatter ( - FileDescriptor, read-only)- Set of parameters not understood by this - Formatter.- Methods Summary - fromBytes(serializedDataset[, component])- Reads serialized data into a Dataset or its component. - name()- Returns the fully qualified name of the formatter. - Return the path that would be returned by write, without actually writing. - predictPathFromLocation(location)- Return the path that would be returned by write, without actually writing. - read([component])- Read a Dataset. - segregateParameters([parameters])- Segregate the supplied parameters into those understood by the formatter and those not understood by the formatter. - toBytes(inMemoryDataset)- Serialize the Dataset to bytes based on formatter. - write(inMemoryDataset)- Write a Dataset. - Attributes Documentation - 
fileDescriptor¶
- FileDescriptor associated with this formatter ( - FileDescriptor, read-only)
 - 
unsupportedParameters= frozenset({})¶
- Set of parameters not understood by this - Formatter. An empty set means all parameters are supported.- Noneindicates that no parameters are supported (- frozenset).
 - Methods Documentation - 
fromBytes(serializedDataset: bytes, component: Optional[str] = None) → object¶
- Reads serialized data into a Dataset or its component. - Parameters
- serializedDatasetbytes
- Bytes object to unserialize. 
- componentstr, optional
- Component to read from the Dataset. Only used if the - StorageClassfor reading differed from the- StorageClassused to write the file.
 
- serializedDataset
- Returns
- inMemoryDatasetobject
- The requested data as a Python object. The type of object is controlled by the specific formatter. 
 
- inMemoryDataset
 
 - 
classmethod name() → str¶
- Returns the fully qualified name of the formatter. - Returns
- namestr
- Fully-qualified name of formatter class. 
 
- name
 
 - 
predictPath() → str¶
- Return the path that would be returned by write, without actually writing. - Uses the - FileDescriptorassociated with the instance.
 - 
abstract classmethod predictPathFromLocation(location: lsst.daf.butler.core.location.Location) → str¶
- Return the path that would be returned by write, without actually writing. 
 - 
abstract read(component: Optional[str] = None) → object¶
- Read a Dataset. - Parameters
- componentstr, optional
- Component to read from the file. Only used if the - StorageClassfor reading differed from the- StorageClassused to write the file.
 
- component
- Returns
- inMemoryDatasetobject
- The requested Dataset. 
 
- inMemoryDataset
 
 - 
segregateParameters(parameters: Optional[Dict[str, Any]] = None) → Tuple[Dict, Dict]¶
- Segregate the supplied parameters into those understood by the formatter and those not understood by the formatter. - Any unsupported parameters are assumed to be usable by associated assemblers. - Parameters
- parametersdict, optional
- Parameters with values that have been supplied by the caller and which might be relevant for the formatter. If - Noneparameters will be read from the registered- FileDescriptor.
 
- parameters
- Returns
 
 - 
toBytes(inMemoryDataset: Any) → bytes¶
- Serialize the Dataset to bytes based on formatter.