Deformable Mirror¶
misReg
instance-attribute
¶
validActThreshpercentage
instance-attribute
¶
__init__ ¶
__init__(
telescope,
nActs: float,
mechCoupling: float = 0.6,
coordinates: ndarray = None,
pitch: float = None,
modes: ndarray = None,
misReg=None,
typeDM: str = "cartesian",
floating_precision: int = 64,
altitude: float = None,
flip=False,
flip_lr=False,
sign=1,
valid_act_thresh_outer=None,
logger=None,
**kwargs,
)
Initialize a Deformable Mirror (DM) with zonal or modal influence functions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
telescope
|
Telescope
|
Telescope associated with this DM. |
required |
nActs
|
float
|
Number of actuators in the horizontal axis of the pupil. |
required |
mechCoupling
|
float
|
Coupling factor between actuators, by default 0.60. |
0.6
|
coordinates
|
ndarray
|
Custom actuator coordinates. |
None
|
pitch
|
float
|
Actuator pitch in meters. |
None
|
modes
|
ndarray
|
Influence functions or modal basis. |
None
|
misReg
|
MisRegistration
|
Misregistration object for geometrical offsets. |
None
|
typeDM
|
str
|
Type of the DM: {cartesian, radial, custom}. By default, custom. |
'cartesian'
|
floating_precision
|
int
|
Use 32 or 64-bit floats, by default 64. |
64
|
altitude
|
float
|
Conjugation altitude of the DM in meters. |
None
|
flip
|
bool
|
Flip the influence functions vertically. |
False
|
flip_lr
|
bool
|
Flip the influence functions left-right. |
False
|
sign
|
int
|
Sign of actuation. |
1
|
valid_act_thresh_outer
|
float
|
Threshold for validating actuators outside pupil. |
None
|
logger
|
Logger
|
Logger instance. |
None
|
**kwargs
|
dict
|
Additional keyword arguments. validActThreshpercentage : float, optional Parameter to select a percentage of the actuator pitch to consider it valid o not. maxStrokePtV : float, optional Maximum mechanical stroke peak-to-valley in [m]. By default 100e-6 [m]. dynamicModel : str, optional Path to the h5 file containing the state-space model of the Deformable Mirror. |
{}
|
generate_cartesian_dm ¶
Generates a distribution of cartesian points and a logic mask filtering the points that are within the limits of the external pupil diameter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
nActs
|
int
|
Number of actuators in the square side |
required |
Returns:
| Name | Type | Description |
|---|---|---|
coordinates |
ndarray
|
X and Y coordinates aranged as [nActs**2,2] |
validAct |
ndarray
|
Logic mask of valid actuators |
nValidAct |
int
|
Number of valid actuators |
generate_radial_dm ¶
Generate a distribution of radial actuator points approximated by a hexagonal grid, with a logic mask filtering the points within the external pupil diameter.
Returns:
| Name | Type | Description |
|---|---|---|
coordinates |
ndarray
|
X and Y coordinates arranged as [nActs, 2]. |
validAct |
ndarray
|
Boolean mask of valid actuators. |
nValidAct |
int
|
Number of valid actuators. |
precomputeGaussianRBFInterpolant ¶
Generates a distribution of radial points approximated by hexagons, and a logic mask filtering the points that are within the limits of the external pupil diameter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_points
|
ndarray
|
Coordinates of the mirror actuators |
required |
output_points
|
ndarray
|
Coordinates of the high resolution output grid |
required |
epsilon
|
float
|
Radial scaling factor for the Gaussian fitting |
required |
Returns:
| Name | Type | Description |
|---|---|---|
L |
Tensor
|
Triangular Cholesky descomposition matrix |
phi_eval |
Tensor
|
Inteprolator based on output - input Euclidean distance |
buildLayer ¶
Construct and configure the DM layer at a given conjugation altitude.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
telescope
|
Telescope
|
Telescope providing aperture and resolution information. |
required |
altitude
|
float
|
Altitude in meters to conjugate the DM layer. |
required |
Returns:
| Type | Description |
|---|---|
dmLayerClass
|
Configured DM layer with geometric and aperture metadata. |
get_dm_pupil ¶
Compute pupil mask seen by a source at the DM altitude.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
src
|
Source
|
Source object with angular position. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Binary square mask (1s where the source is affected). |
get_dm_opd ¶
Compute the Optical Path Difference (OPD) and phase from the DM for a given source.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Source
|
Source object defining wavelength and position. |
required |
Returns:
| Type | Description |
|---|---|
tuple of np.ndarray
|
OPD in meters and phase in radians. |
saturateShape ¶
Saturate the command of the mirror.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cmd
|
ndarray
|
Command required from the mirror. |
required |
Returns:
| Type | Description |
|---|---|
cmd_saturated
|
Command executed by the mirror. |
load_dynamic_model ¶
Load the state-space model of the deformable mirror from an HDF5 file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
Path to the H5 file containing the discrete state-space matrices. |
required |
samplingTime
|
float
|
Sampling time used to discretize the model [s]. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
A |
Tensor
|
Discrete state-transition matrix. |
B |
Tensor
|
Discrete input-state matrix. |
C |
Tensor
|
Discrete state-output matrix. |
D |
Tensor
|
Discrete feedthrough matrix. |
applyDynamics ¶
Apply a state-space to the command of the mirror to obtain the temporal response of the mirror
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cmd
|
Tensor
|
Command required from the mirror. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dyn_cmd |
Tensor
|
Temporal command executed by the mirror. |
updateDMShape ¶
Update the OPD map from the current coefficients or 2D grid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
val
|
ndarray
|
Either a coefficient vector or a 2D shape map. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if update was successful. |
updateMisreg ¶
Update the mis-registration params by the temporal factor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
elapsedTime
|
float
|
Time elapsed in seconds. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if updated successfully. |
print_properties ¶
Print a summary of the DM configuration.
Returns:
| Type | Description |
|---|---|
None
|
|