Formatter¶
- 
class lsst.daf.butler.Formatter(fileDescriptor)¶
- Bases: - object- Interface for reading and writing Datasets with a particular - StorageClass.- Parameters: - fileDescriptor : FileDescriptor, 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.
 - Attributes Summary - fileDescriptor- FileDescriptor associated with this formatter ( - Formatter, read-only)- unsupportedParameters- 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. - predictPath()- 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 - 
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, component=None)¶
- Reads serialized data into a Dataset or its component. - Parameters: - serializedDataset : bytes
- Bytes object to unserialize. 
- fileDescriptor : FileDescriptor
- Identifies type to read it as and parameters to be used for reading. 
- component : str, optional
- Component to read from the Dataset. Only used if the - StorageClassfor reading differed from the- StorageClassused to write the file.
 - Returns: - inMemoryDataset : object
- The requested data as a Python object. The type of object is controlled by the specific formatter. 
 
- serializedDataset : 
 - 
classmethod name()¶
- Returns the fully qualified name of the formatter. - Returns: - name : str
- Fully-qualified name of formatter class. 
 
- name : 
 - 
predictPath()¶
- Return the path that would be returned by write, without actually writing. - Uses the - FileDescriptorassociated with the instance.- Returns: 
 - 
classmethod predictPathFromLocation(location)¶
- Return the path that would be returned by write, without actually writing. - Parameters: - location : Location
- Location of file for which path prediction is required. 
 - Returns: - path : str
- Path within datastore that would be associated with this location. 
 
- location : 
 - 
read(component=None)¶
- Read a Dataset. - Parameters: - component : str, optional
- Component to read from the file. Only used if the - StorageClassfor reading differed from the- StorageClassused to write the file.
 - Returns: - inMemoryDataset : object
- The requested Dataset. 
 
- component : 
 - 
segregateParameters(parameters=None)¶
- 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: - parameters : dict, 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.
 - Returns: 
- parameters : 
 - 
toBytes(inMemoryDataset)¶
- Serialize the Dataset to bytes based on formatter. - Parameters: - inMemoryDataset : object
- The Python object to serialize. 
- fileDescriptor : FileDescriptor
- Identifies type to read the dataset as and parameters to be used for reading. 
 - Returns: - serializedDataset : bytes
- Bytes representing the serialized dataset. 
 
- inMemoryDataset : 
 
- fileDescriptor :