MatplotlibFormatter¶
- class lsst.daf.butler.formatters.matplotlib.MatplotlibFormatter(file_descriptor: FileDescriptor, *, ref: DatasetRef, write_parameters: Mapping[str, Any] | None = None, write_recipes: Mapping[str, Any] | None = None, **kwargs: Any)¶
Bases:
FormatterV2
Format matplotlib figures.
Does not support writes.
Attributes Summary
Default extension to use when writing a file.
Methods Summary
write_local_file
(in_memory_dataset, uri)Serialize the in-memory dataset to a local file.
Attributes Documentation
- default_extension: ClassVar[str | None] = '.png'¶
Default extension to use when writing a file.
Can be
None
if the extension is determined dynamically. Use theget_write_extension
method to get the actual extension to use.
Methods Documentation
- write_local_file(in_memory_dataset: Any, uri: ResourcePath) None ¶
Serialize the in-memory dataset to a local file.
- Parameters:
- in_memory_dataset
object
The Python object to serialize.
- uri
ResourcePath
The URI to use when writing the file.
- in_memory_dataset
- Raises:
- FormatterNotImplementedError
Raised if the formatter subclass has not implemented this method or has failed to implement the
to_bytes
method.
Notes
By default this method will attempt to call
to_bytes
and then write these bytes to the file.