Secret Sauce Simulator

Sauce is the Secret Sauce hardware simulator for testing the ShaneAO real-time control software. Sauce can also assist in AO system calibration and in preparing the rtc parameter files.

Sauce simulates everthing beyond the low-level hardware drivers including the hardware itself and the physical optics. Sauce:

1 Pre-generates representative phase screen sets for use as input aberrations

2 Propagates the wavefront from the phase aberration, adding the DM’s phase correction, and generates a representative Hartmann CCD image.

The Sauce package can generate certain prerequisite matrices ( Aw, At, Mw, Mt, and Ctw ) that are used in support of AO system calibration and building rtc parameter files. To use sauce to generate precursor matrices, invoke sauce.init(). The calculations take a few minutes. Save the generated matrices to disk with sauce.save().

sauce.A_tweeter(mode=1, save=False)

Create a set of tweeter modes as expressed in tweeter command vectors

sauce.A_woofer(nmodes=52)

return the woofer A matrix, which is the matrix form of the woofer mode coefficient set

sauce.C_wooferTweeter(wooferModeSet, tweeterModeSet, verbose=0)

create the cross-integral matrix between woofer and tweeter mode sets

sauce.M_tweeter(tweeterModeSet, band=None, verbose=0)

create the tweeter modes self-integral matrix

sauce.M_woofer(wooferModeSet, nmodes=52, verbose=0)

create the M_w matrix, the cross-integrals of all the woofer modes with each other

sauce.aber(kind=None, scale=1.0, zern=3, period=25, length=100)

Insert a simulated aberation. No argument gives a list of kinds to choose from.

sauce.cb()

provides the callback for edt_simulator’s pdv_wait_image call

sauce.corCoef(M)

calculate the correlation coefficients for a symmetric positive definite matrix

sauce.ctr(v)

Roll the 2-d array so that the (0,0) point is at the center

sauce.gen_atmos_t_set(seed=None)

Generate simulated Kolmogorov phase screen set.

sauce.gen_f_set(aber)

Generate a time sequence of aberations based on a fixed single aberation

sauce.gen_ref_t_set()

Generate a time-sequence of static flat wavefronts, for taking reference centroids

sauce.gen_t_set(aber, period=30.0, amplitude=2, length=100)

Generate a time sequence of aberations based on sinusoidal variation of the input aberation

aber = the base aberation

sauce.init(nw=52, verbose=1)

This initializes the mode sets, mode command vector sets, and self- and cross-integral matrices to support parameter matrix generation for rtc. The calculations take several minutes

sauce.light(q='on')

Turn on or off the simulated light source. Argument: ‘on’ or ‘off’

sauce.load(dir=None)

Read the reconstructor support matrices from disk files. The directory from which it reads is the default one for such matrices, unless the argument dir is given

sauce.pattern(kind, pos=(0, 0))

pattern(kind,pos=(0,0)) creates a pattern of phase on the fine grid.

kind = “cross” or “poke” pos = position of the poke

Note that the optional pos argument is (x,y) counter to python row = y because sauce will use a transposed umap

sauce.save(dir=None)

Save the generated reconstructor support matrices to disk files. The directory is the default one for such matrices, unless the argument dir is given.

sauce.tweeter(a_vec, old=False)

Generate the wavefront phase on Sauce’s pre-defined fine grid given the set of actuator commands, a

a = actuator commands in a 32 x 32 numpy array, given in the natural units
of the DM driver, ranging from 0 to 65535
returns the wavefront on a n_fine x n_fine grid at du_fine sampling, in
units of radians at 589 nm wavelength
sauce.tweeterModes(verbose=0)

produce the tweeter mode set, given a set of actuator vectors defining the modes. The mode set is defined on the sauce fine grid

sauce.tweeterPokes(sigma=1.4)

generate a generic poke for the tweeter and a set of tweeter locations on the sauce fine grid

sauce.tweeter_oldVersion(a)

Generate the wavefront phase on Sauce’s pre-defined fine grid given the set of actuator commands, a

a = actuator commands in a 32 x 32 numpy array, given in the natural units
of the DM driver, ranging from 0 to 65535
returns the wavefront on a n_fine x n_fine grid at du_fine sampling, in
units of radians at 589 nm wavelength
sauce.update_tweeter()

provides the callback for dpio2_simulator’s DPIO2_CMD_DMA_START call

sauce.update_woofer(aw)

provides the callback for the virtual woofer server <woofer_client.virtual_woofer_server> in sumulate mode

sauce.wfs(s)

Create the Hartmann sensor CCD image given the phase of the wavefront

s = the phase on Sauce’s pre-defined fine grid (n_fine x n_fine at du_fine sampling), in units of radians at 589 nm wavelength Returns the 160x160 CCD image

You will have to normalize the CCD image to any brightness you like but it will have to be in the range of ‘uint16’ if it is sent to the rtc

sauce.woofer(a)

Generate the wavefront phase on Sauce’s pre-defined fine grid given the set of woofer actuator commands, a

a must be a 52-element list

sauce.wooferModes(nmodes=52, verbose=0)

create the woofer modes on the fine grid, given the set of woofer mode vectors already in the woof object

sauce.wooferPokes(verbose=0)

resample the woofer pokes on sauce’s fine grid (du_fine) given the woofer object’s sampling (woof.dx)

sauce.zernset(n)

Generate a set of Zernike screens up to 5th order

n = size of screen (n,n)

sauce.zeropad(u, n)

r = zeropad(u,n)

Zero-pad the array by centering it in a larger array and padding with zeros

u - original array n - size of new array (2-tuple)

sauce.zeropad_a(u, n)

This is a special zero-pad that assumes the data is initially centered with 0,0 in the middle of the array but in the end is centered with 0,0 at the corner of the array. Tricky, so use this only internally.