22 __all__ = [
"imageReadFitsWithOptions",
23 "imageWriteFitsWithOptions",
"exposureWriteFitsWithOptions"]
37 """Read an Image, Mask, MaskedImage or Exposure from a FITS file,
43 Fits file path from which to read image, mask, masked image
45 options : `lsst.daf.base.PropertySet`
48 - llcX: bbox minimum x (int)
49 - llcY: bbox minimum y (int, must be present if llcX is present)
50 - width: bbox width (int, must be present if llcX is present)
51 - height: bbox height (int, must be present if llcX is present)
52 - imageOrigin: one of "LOCAL" or "PARENT" (has no effect unless
53 a bbox is specified by llcX, etc.)
58 If options contains an unknown value for "imageOrigin"
59 lsst.pex.exceptions.NotFoundError
60 If options contains "llcX" and is missing any of
61 "llcY", "width", or "height".
64 if options.exists(
"llcX"):
65 llcX = options.getInt(
"llcX")
66 llcY = options.getInt(
"llcY")
67 width = options.getInt(
"width")
68 height = options.getInt(
"height")
71 if options.exists(
"imageOrigin"):
72 originStr = options.getString(
"imageOrigin")
73 if (originStr ==
"LOCAL"):
75 elif (originStr ==
"PARENT"):
78 raise RuntimeError(
"Unknown ImageOrigin type {}".format(originStr))
80 return cls(source, bbox=bbox, origin=origin)
84 """Write an Image or Mask to FITS, with options
89 Fits file path to which to write the image or mask.
90 options : `lsst.daf.base.PropertySet
91 Write options. The item "image" is read. It must contain an
92 `lsst.daf.base.PropertySet` with data for
93 ``lsst.afw.fits.ImageWriteOptions``.
95 if options
is not None:
98 except Exception
as e:
99 log = Log.getLogger(
"lsst.afw.image")
100 log.warn(
"Could not parse options; writing with defaults: {}".format(e))
102 self.writeFits(dest, writeOptions)
108 """Write an Exposure or MaskedImage to FITS, with options
113 Fits file path to which to write the exposure or masked image.
114 options : `lsst.daf.base.PropertySet`
115 Write options. The items "image", "mask" and "variance" are read.
116 Each must be an `lsst.daf.base.PropertySet` with data for
117 ``lsst.afw.fits.ImageWriteOptions``.
119 if options
is not None:
121 writeOptionDict = {name +
"Options":
ImageWriteOptions(options.getPropertySet(name))
122 for name
in (
"image",
"mask",
"variance")}
123 except Exception
as e:
124 log = Log.getLogger(
"lsst.afw.image")
125 log.warn(
"Could not parse options; writing with defaults: {}".format(e))
127 self.writeFits(dest, **writeOptionDict)
def imageWriteFitsWithOptions(self, dest, options)
def imageReadFitsWithOptions(cls, source, options)
def exposureWriteFitsWithOptions(self, dest, options)
Options for writing an image to FITS.