100 """Compute the approximate psf size and shape.
102 This routine fits how the psf size and shape varies over a field by approximating
103 with a Chebyshev bounded field.
108 Exposure metadata
for a given detector exposure.
110 Right ascension of points to compute size
and shape (degrees).
112 Declination of points to compute size
and shape (degrees).
114 Number of sampling points
in the x direction.
116 Number of sampling points
in the y direction.
117 orderx : `int`, optional
118 Chebyshev polynomial order
for fit
in x direction.
119 ordery : `int`, optional
120 Chebyshev polynomial order
for fit
in y direction.
124 psf_array : `np.ndarray`
125 Record array
with "psf_size",
"psf_e1",
"psf_e2".
128 r, d
in zip(ra, dec)]
129 pixels = ccd_row.getWcs().skyToPixel(pts)
131 ctrl = ChebyshevBoundedFieldControl()
134 ctrl.triangular =
False
136 bbox = ccd_row.getBBox()
137 xSteps = np.linspace(bbox.getMinX(), bbox.getMaxX(), nx)
138 ySteps = np.linspace(bbox.getMinY(), bbox.getMaxY(), ny)
139 x = np.tile(xSteps, nx)
140 y = np.repeat(ySteps, ny)
142 psf_size = np.zeros(x.size)
143 psf_e1 = np.zeros(x.size)
144 psf_e2 = np.zeros(x.size)
145 psf_area = np.zeros(x.size)
147 psf = ccd_row.getPsf()
148 for i
in range(x.size):
150 psf_size[i] = shape.getDeterminantRadius()
155 psf_e1[i] = (ixx - iyy)/(ixx + iyy + 2.*psf_size[i]**2.)
156 psf_e2[i] = (2.*ixy)/(ixx + iyy + 2.*psf_size[i]**2.)
159 psf_area[i] = np.sum(im.array)/np.sum(im.array**2.)
161 pixel_x = np.array([pix.getX()
for pix
in pixels])
162 pixel_y = np.array([pix.getY()
for pix
in pixels])
164 psf_array = np.zeros(pixel_x.size, dtype=[(
"psf_size",
"f8"),
169 cheb_size = ChebyshevBoundedField.fit(
lsst.geom.Box2I(bbox), x, y, psf_size, ctrl)
170 psf_array[
"psf_size"] = cheb_size.evaluate(pixel_x, pixel_y)
171 cheb_e1 = ChebyshevBoundedField.fit(
lsst.geom.Box2I(bbox), x, y, psf_e1, ctrl)
172 psf_array[
"psf_e1"] = cheb_e1.evaluate(pixel_x, pixel_y)
173 cheb_e2 = ChebyshevBoundedField.fit(
lsst.geom.Box2I(bbox), x, y, psf_e2, ctrl)
174 psf_array[
"psf_e2"] = cheb_e2.evaluate(pixel_x, pixel_y)
175 cheb_area = ChebyshevBoundedField.fit(
lsst.geom.Box2I(bbox), x, y, psf_area, ctrl)
176 psf_array[
"psf_area"] = cheb_area.evaluate(pixel_x, pixel_y)
Record class used to store exposure metadata.
An integer coordinate rectangle.
Point in an unspecified spherical coordinate system.
def compute_approx_psf_size_and_shape(ccd_row, ra, dec, nx=20, ny=20, orderx=2, ordery=2)