Deformable Mirrors

The module simulating Deformable Mirrors in Soapy

DMs in Soapy

DMs are represented in Soapy by python objects which are initialised at startup with some configuration parameters given, as well as a list of one or more WFS objects which can be used to measure an interaction matrix.

Upon creation of an interaction matrix, the object first generations all the possible independant shapes which the DM may form, known as “influence functions”. Then each influence function is passed to the specified WFS(s) and the response noted to form an interaction matrix. The interaction matrix may then be used to forma reconstructor.

During the AO loop, commands corresponding to the required amplitude of each DM influence function are sent to the DM.dmFrame() method, which returns an array representing the DMs shape.

Adding New DMs

New DMs are easy to add into the simulation. At its simplest, the DM class is inherited by the new DM class. Only a ``makeIMatShapes` method need be provided, which creates the independent influence function the DM can make. The base class deals with the rest, including making interaction matrices and loop operation.

Base DM Class

class soapy.DM.DM(soapy_config, n_dm=0, wfss=None, mask=None)[source]

Bases: object

The base DM class

This class is intended to be inherited by other DM classes which describe real DMs. It provides methods to create DM shapes and then interaction matrices, given a specific WFS or WFSs.

Parameters:
  • soapy_config (ConfigObj) – The soapy configuration object
  • n_dm (int) – The ID number of this DM
  • wfss (list, optional) – A list of Soapy WFS object with which to record the interaction matrix
  • mask (ndarray, optional) – An array or size (simConfig.simSize, simConfig.simSize) which is 1 at the telescope aperture and 0 else-where. If None then a circle is generated.
dmFrame(dmCommands)[source]

Uses DM commands to calculate the final DM shape.

Multiplies each of the DM influence functions by the corresponding DM command, then sums to create the final DM shape. Lastly, the mean value is subtracted to avoid piston terms building up.

Parameters:
  • dmCommands (ndarray) – A 1-dimensional vector of the multiplying factor of each DM influence function
  • closed (bool, optional) – Specifies how to great gain. If ``True’’ (closed) then ``dmCommands’’ are multiplied by gain and summed with previous commands. If ``False’’ (open), then ``dmCommands’’ are multiplied by gain, and summed withe previous commands multiplied by (1-gain).
Returns:

A 2-d array with the DM shape

Return type:

ndarray

getActiveActs()[source]

Method returning the total number of actuators used by the DM - May be overwritten in DM classes

Returns:number of active DM actuators
Return type:int
makeIMatShapes()[source]

Virtual method to generate the DM influence functions

Real DM Classes

class soapy.DM.TT(soapy_config, n_dm=0, wfss=None, mask=None)[source]

Bases: soapy.DM.DM

A class representing a tip-tilt mirror.

This can be used as a tip-tilt mirror, it features two actuators, where each influence function is simply a tip and a tilt.

getActiveActs()[source]

Returns the number of active actuators on the DM. Always 2 for a TT.

makeIMatShapes()[source]

Forms the DM influence functions, in this case just a tip and a tilt.

class soapy.DM.Zernike(soapy_config, n_dm=0, wfss=None, mask=None)[source]

Bases: soapy.DM.DM

A DM which corrects using a provided number of Zernike Polynomials

makeIMatShapes()[source]

Creates all the DM shapes which are required for creating the interaction Matrix. In this case, this is a number of Zernike Polynomials

class soapy.DM.Piezo(soapy_config, n_dm=0, wfss=None, mask=None)[source]

Bases: soapy.DM.DM

A DM emulating a Piezo actuator style stack-array DM.

This class represents a standard stack-array style DM with push-pull actuators behind a continuous phase sheet. The number of actuators is given in the configuration file.

Each influence function is created by started with an N x N grid of zeros, where N is the number of actuators in one direction, and setting a single value to 1, which corresponds with a “pushed” actuator. This grid is then interpolated up to the pupilSize, to form the shape of the DM when that actuator is activated. This is repeated for all actuators.

getActiveActs()[source]

Finds the actuators which will affect phase whithin the pupil to avoid reconstructing for redundant actuators.

makeIMatShapes()[source]

Generate Piezo DM influence functions

Generates the shape of each actuator on a Piezo stack DM (influence functions). These are created by interpolating a grid on the size of the number of actuators, with only the ‘poked’ actuator set to 1 and all others set to zero, up to the required simulation size. This grid is actually padded with 1 extra actuator spacing to avoid strange edge effects.

class soapy.DM.GaussStack(soapy_config, n_dm=0, wfss=None, mask=None)[source]

Bases: soapy.DM.Piezo

A Stack Array DM where each influence function is a 2-D Gaussian shape.

This class represents a Stack-Array DM, similar to the Piezo DM, where each influence function is a 2-dimensional Gaussian function. Though not realistic, it provides a known influence function which can be useful for some analysis.

makeIMatShapes()[source]

Generates the influence functions for the GaussStack DM.

Creates a number of Guassian distributions which are centred at points across the pupil to act as DM influence functions. The width of the guassian is determined from the configuration file.