make_a

jwst.ami.utils.make_a(nh)[source]

Write the ‘NRM matrix’.

The NRM matrix later (?) gets pseudo-inverted to provide (arbitrarily constrained) zero-mean phases of the holes. Algorithm is taken verbatim from Anand’s pseudoinverse.py

Parameters:
nhint

Number of holes in NR mask

Returns:
matrix_a: 2D float array

Shape nh columns, nh(nh-1)/2 rows (eg 21 for nh=7)

Notes

Ax = b where x are the nh hole phases, b the nh(nh-1)/2 fringe phases, and A the NRM matrix

Solve for the hole phases:

Apinv = np.linalg.pinv(A) Solution for unknown x’s: x = np.dot(Apinv, b)

Following Noah Gamper’s convention of fringe phases, for holes ‘a b c d e f g’, rows of A are

(-1 +1 0 0 …) (0 -1 +1 0 …)

which is implemented in make_a() as:

matrix_a[row,h2] = -1 matrix_a[row,h1] = +1

To change the convention just reverse the signs of the ‘ones’.

When tested against Alex’’ nrm_model.py ‘piston_phase’ text output of fringe phases, these signs appear to be correct - anand@stsci.edu 12 Nov 2014