pyTomoAO.slope_conversion.slope_conversion_matrix

pyTomoAO.slope_conversion.slope_conversion_matrix(validLLMap, nWFS, D, subapOrder='F', slopesOrder='simu', slopeScale=1.0, xSign=1.0, ySign=1.0)[source]

Sparse matrix taking external slopes to pyTomoAO’s gradient-operator convention.

P @ s returns, for an input slope vector s covering nWFS sensors (sensor blocks concatenated in pyTomoAO’s LGS order), the slopes in the order of the tomographic gradient operator and in units of d * angle [m], ready for RecStatSA.

Parameters:
  • validLLMap (array_like of bool) – Valid-subaperture map, (nLenslet, nLenslet), the same for every sensor.

  • nWFS (int) – Number of sensors in the slope vector.

  • D (float) – Telescope diameter [m]; the subaperture size is d = D / nLenslet.

  • subapOrder ({"F", "C"}, optional) – Enumeration of the valid subapertures in the input: "F" column-major (pyTomoAO’s own), "C" row-major (e.g. SPECULA). Default "F".

  • slopesOrder ({"simu", "inverted", "keck"}, optional) – Layout of each sensor’s block in the input: "simu" all X then all Y, "inverted" all Y then all X, "keck" interleaved [x0, y0, x1, y1, ...]. Default "simu".

  • slopeScale (float, optional) – Factor converting the input slopes to angles of arrival in radians (e.g. specula_slope_scale()). Default 1 (input already in radians).

  • xSign (float, optional) – Sign (or extra factor) applied to the X and Y slopes, for inputs whose axes point the other way. Default +1.

  • ySign (float, optional) – Sign (or extra factor) applied to the X and Y slopes, for inputs whose axes point the other way. Default +1.

Returns:

scipy.sparse.csr_matrix – (nWFS * 2 * nValid, nWFS * 2 * nValid), one non-zero per row.

Notes

pyTomoAO’s X slope is the derivative along the columns of validLLMap and Y along its rows. An input whose X runs along the rows corresponds to slopesOrder="inverted" (with the same subaperture enumeration), not to a sign change.

Examples

SPECULA IdealDerivativeSensor or Shack-Hartmann slopes of six LGS, concatenated in the order of the asterism:

>>> P = slope_conversion_matrix(
...     validLLMap, 6, 10.0, subapOrder="C", slopeScale=specula_slope_scale(4.0, 8)
... )
>>> opd = rec.RecStatSA @ (P @ slopes)  # OPD [m] on rec.gridMask