22 __all__ = (
"FitsGenericFormatter", )
26 from lsst.daf.butler.formatters.file
import FileFormatter
30 """Interface for reading and writing objects that support the standard
31 afw I/O readFits/writeFits methods.
33 supportedExtensions = frozenset({
".fits",
".fits.gz",
".fits.fz",
".fz",
".fit"})
36 def _readFile(self, path, pytype):
37 """Read a file from the path in FITS format.
42 Path to use to open the file.
44 Class to use to read the FITS file.
49 Instance of class `pytype` read from FITS file. None
50 if the file could not be opened.
52 if not os.path.exists(path):
55 return pytype.readFits(path)
57 def _writeFile(self, inMemoryDataset):
58 """Write the in memory dataset to file on disk.
62 inMemoryDataset : `object`
68 The file could not be written.
70 inMemoryDataset.writeFits(self.fileDescriptor.location.path)