22Intrinsic Zernikes storage class.
25__all__ = [
"IntrinsicZernikes"]
28from astropy
import units
as u
29from astropy.table
import Table
30from scipy.interpolate
import LinearNDInterpolator
36 """Intrinsic Zernike coefficients.
38 Stores Zernike wavefront-error coefficients sampled at a set of
39 focal-plane field angles. At query time the coefficients are
40 interpolated to an arbitrary field position.
42 Field angles are expressed in the Camera Coordinate System (CCS), also
43 known as the Engineering Diagram Coordinate System. See
44 `LSE-349 <https://ls.st/LSE-349>`_ for the definition.
48 table : `astropy.table.Table`, optional
49 Source table. Must contain columns:
52 Field x positions (in CCS) with angular units (e.g. ``u.deg``).
54 Field y positions (in CCS) with angular units (e.g. ``u.deg``).
56 One column per Noll index *j*, with length units
61 field_x : `numpy.ndarray`
62 CCS x field positions in degrees for all sample points,
63 shape ``(n_points,)``.
64 field_y : `numpy.ndarray`
65 CCS y field positions in degrees for all sample points,
66 shape ``(n_points,)``.
67 noll_indices : `numpy.ndarray`
68 Noll indices of the stored Zernike terms, shape ``(n_zernikes,)``.
69 values : `numpy.ndarray`
70 Zernike coefficients in microns, shape
71 ``(n_points, n_zernikes)``.
72 interpolator : `scipy.interpolate.LinearNDInterpolator` or `None`
73 Interpolator built from ``field_x``, ``field_y``, and
74 ``values``. ``None`` until the calibration is populated.
77 _OBSTYPE =
"INTRINSIC_ZERNIKES"
78 _SCHEMA =
"Intrinsic Zernikes"
91 self.
field_x = table[
"x"].to(
"deg").value
92 self.
field_y = table[
"y"].to(
"deg").value
93 zcols = [col
for col
in table.colnames
if col.startswith(
"Z")]
94 self.
noll_indices = np.array(sorted([int(col[1:])
for col
in zcols]))
95 zks = np.column_stack(
97 table[col].to(
"um").value
for col
in zcols
113 """Construct an IntrinsicZernikes from dictionary of properties.
118 Dictionary of properties.
122 calib : `lsst.ip.isr.IntrinsicZernikes`
123 Constructed calibration.
128 Raised if the supplied dictionary is for a different
133 if calib._OBSTYPE != dictionary[
"metadata"][
"OBSTYPE"]:
135 f
"Incorrect intrinsic zernikes supplied. "
136 f
"Expected {calib._OBSTYPE}, found {dictionary['metadata']['OBSTYPE']}"
139 calib.setMetadata(dictionary[
"metadata"])
140 calib.field_x = np.array(dictionary[
"field_x"])
141 calib.field_y = np.array(dictionary[
"field_y"])
142 calib.values = np.array(dictionary[
"values"])
143 calib.noll_indices = np.array(dictionary[
"noll_indices"])
144 calib._createInterpolator()
146 calib.updateMetadata()
150 """Return a dictionary containing the calibration properties.
152 The dictionary should be able to be round-tripped through
158 Dictionary of properties.
164 outDict[
"field_x"] = self.
field_x.tolist()
165 outDict[
"field_y"] = self.
field_y.tolist()
166 outDict[
"values"] = self.
values.tolist()
173 """Construct calibration from a list of tables.
177 tableList : `list` [`astropy.table.Table`]
178 List of tables to use to construct the intrinsic zernikes
183 calib : `lsst.ip.isr.IntrinsicZernikes`
184 The calibration defined in the tables.
187 calib = cls(table=table)
188 calib.setMetadata(table.meta)
189 calib.updateMetadata()
193 """Construct a list of tables containing the information in this
196 The list of tables should be able to be round-tripped through
201 tableList : `list` [`astropy.table.Table`]
202 List of tables containing the intrinsic zernikes calibration
212 data[f
"Z{j}"] = self.
values[:, i] * u.um
217 outMeta = {k: v
for k, v
in inMeta.items()
if v
is not None}
218 outMeta.update({k:
"" for k, v
in inMeta.items()
if v
is None})
225 Get the intrinsic Zernike coefficients at a given field position.
229 field_x : `array-like`
230 CCS x-field positions in degrees.
231 field_y : `array-like`
232 CCS y-field positions in degrees.
233 noll_indices : `list` [`int`], optional
234 List of Noll indices to return. If None, return all.
238 zernikes : `array-like`
239 Array of Zernike coefficient values in microns corresponding to the
240 requested Noll indices and field positions.
242 if noll_indices
is None:
245 point = np.array([field_x, field_y]).T
248 noll_indices = np.array(noll_indices)
250 return interpolated_values[..., noll_mask]
updateMetadata(self, camera=None, detector=None, filterName=None, setCalibId=False, setCalibInfo=False, setDate=False, **kwargs)
fromTable(cls, tableList)
getIntrinsicZernikes(self, field_x, field_y, noll_indices=None)
fromDict(cls, dictionary)
__init__(self, table=None, **kwargs)
_createInterpolator(self)