align_channels#
- esis.optics.align_channels(instruments, parameters, frames, scene_position, wavelengths, bounds, free=None, anchor=1, num_sky=1600, num_tile=6, num_pass=4, ridge=0.001, damping=0.8, degree=2, seed=0, mask_windows=True, log=None)[source]#
Align the channels to one another in their physical parameters.
Each pass samples every channel’s frame on a common sky grid through its current distortion at every wavelength in wavelengths, measures the tile shifts of each channel against the anchor, and solves for the increments of that channel’s free parameters whose change of the mapping best reproduces the measured shifts. The mapping’s Jacobian with respect to the parameters comes from one linearization per free parameter; the solve is a ridge-regularized least squares with sigma clipping of tiles whose correlation locked onto the wrong peak. Using two lines lets a geometric error (the same shift in both) be told from a dispersion error (different shifts).
- Parameters:
instruments (list[AbstractInstrument]) – The base model of each channel.
parameters (list[DistortionParameters]) – The current parameters of each channel, usually the result of the absolute fit against the proxy scene.
frames (list[ndarray]) – The observed frame of each channel, indexed
[y, x].scene_position (AbstractCartesian2dVectorArray) – The sky positions spanned by the scene, which set the extent of the sky grid.
wavelengths (dict[str, Quantity]) – The lines at which the sky images are made, by name.
bounds (tuple[DistortionParameters, DistortionParameters] | list[tuple[DistortionParameters, DistortionParameters]]) – The lower and upper bounds of the parameters, in the units of parameters, as for
fit_distortion(): one pair for every channel, or a list of pairs, one per channel. The solved free parameters are clipped to them, and their widths set the scale of the finite differences and of the ridge penalty.free (None | tuple[str, ...]) – The names of the parameters the alignment may change. If
None, the grating terms and the sensor placement are free and the pointing, the primary terms and the field-stop roll are held where the absolute fit put them.anchor (int) – The channel the others are aligned to.
num_sky (int) – The number of samples along each axis of the sky grid.
num_tile (int) – The number of tiles along each axis when measuring shifts.
num_pass (int) – The number of measure-and-solve passes.
ridge (float) – The ridge penalty on the parameter increments, in units of the parameter bounds, which keeps the solve off the flat directions of the mapping.
damping (float) – The fraction of each solved increment that is applied.
degree (int) – The degree of the polynomial distortion model.
seed (int) – The seed of the draws which place the samples every channel is linearized on, see
LinearMerit.mask_windows (bool) – Whether to read each channel’s frame only inside the window the line illuminates, see
window_mask(). Outside it the frame holds other lines, which the correlation would otherwise take for misplaced structure.log (None | Callable[[str], None]) – A callable to report the median shift of each channel after every pass.
- Returns:
The aligned parameters of every channel, and the median shift of every
channel against the anchor after the last pass, in detector pixels.
- Return type: