Skip to content

alignment

Main driver script for running the alignment. You typically want to use the lat_alignment entrypoint rather than calling this directly.

adjust_panel(panel, mnum, cfg)

Helper function to get the adjustments for a single panel.

Parameters:

Name Type Description Default
panel Panel

The mirror panel to adjust.

required
mnum int

The mirror number. 1 for the primary and 2 for the secondary.

required
cfg dict

The configuration dictionairy.

required

Returns:

Name Type Description
adjustments NDArray[float32]

The adjustments to make for the panel. This is a 17 element array with the following structure: [mnum, panel_row, panel_col, dx, dy, d_adj1, ..., d_adj5, dx_err, dy_err, d_adj1_err, ..., d_adj5_err].

Source code in lat_alignment/alignment.py
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
def adjust_panel(panel: mir.Panel, mnum: int, cfg: dict) -> NDArray[np.float32]:
    """
    Helper function to get the adjustments for a single panel.

    Parameters
    ----------
    panel : mir.Panel
        The mirror panel to adjust.
    mnum : int
        The mirror number.
        1 for the primary and 2 for the secondary.
    cfg : dict
        The configuration dictionairy.

    Returns
    -------
    adjustments : NDArray[np.float32]
        The adjustments to make for the panel.
        This is a 17 element array with the following structure:
        `[mnum, panel_row, panel_col, dx, dy, d_adj1, ..., d_adj5, dx_err, dy_err, d_adj1_err, ..., d_adj5_err]`.
    """
    adjustments = np.zeros(17, np.float32)
    adjustments[0] = mnum
    adjustments[1] = panel.row
    adjustments[2] = panel.col
    meas_adj = panel.meas_adj.copy()
    meas_adj[:, 2] += panel.meas_adj_resid
    meas_surface = panel.meas_surface.copy()
    meas_surface[:, 2] += panel.meas_adj_resid
    dx, dy, d_adj, dx_err, dy_err, d_adj_err = adj.calc_adjustments(
        panel.can_surface, meas_surface, meas_adj, **cfg.get("adjust", {})
    )
    adjustments[3:] = np.array(
        [dx, dy] + list(d_adj) + [dx_err, dy_err] + list(d_adj_err)
    )

    return adjustments