TwiceAsNice  2019-02-18
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
laospy.interaction.InteractionMatrix Class Reference
Collaboration diagram for laospy.interaction.InteractionMatrix:
Collaboration graph

Public Member Functions

def __init__ (self, config)
 
def read_fits (self, filename, datatype='< f8', headerKeywords=[])
 
def read_fits_abspath (self, filename, datatype='< f8', headerKeywords=[])
 
def read_fits_with_path (self, filename, pathname, datatype='< f8', headerKeywords=[])
 
def read_m2c_file (self, m2cFileName)
 
def read_amp_envelope_file (self, modAmpEnvelopeFileName)
 
def read_disturbance_slopes_file (self, extractedSlopesFileName)
 
def read_actuator_map_file (self, actuatorMapFileName)
 
def read_calibration_recMat_file (self, calRecMatFileName)
 
def read_calibration_gain_file (self, calGainFileName)
 
def get_disturbance_ice (self)
 
def get_m2c_ice (self)
 
def get_calRecMat_ice (self)
 
def get_calGain_ice (self)
 
def set_modal_amplitude (self, modAmpVec=None, scalefactor=0.0)
 
def create_pushpull_disturbance (self)
 
def extract_disturbance_slopes (self, ringbuffer, frameCountVec)
 
def analyze_disturbance_slopes (self, distSlopesOffset=1)
 
def find_disturbance_slopes_offset (self, pushpullBlockSize=None, filename=None, overwrite=False)
 
def build_interaction_matrix (self, doublepass, skip=1)
 
def invert_interaction_matrix (self, index=None, rcond=1e-15)
 
def save_matrix (self, matrix, filename, overwrite, headerKeywords=[])
 
def save_disturbance (self, filename, overwrite=False)
 
def save_disturbance_slopes (self, filename, overwrite=False)
 
def save_reconstruction_matrix (self, filename, overwrite=False)
 
def save_interaction_matrix (self, filename, overwrite=False)
 
def display_dm_shape (self, commandVec, note='')
 
def init_slopes_display (self, mask, slopesDisplayTable)
 
def display_disturbance_slopes (self, index)
 
def display_slopes_frame (self, slopesFrame, note="")
 
def display_disturbance (self, decimation=1)
 
def get_mask_pixels (self, full_mask=None, binning=None)
 
def reduceIM (self, full_MPmask=None, full_Pmask=None, IMpath=None, NM4R=None)
 
def __init__ (self, config)
 
def read_fits (self, filename, datatype='< f8', headerKeywords=[])
 
def read_fits_abspath (self, filename, datatype='< f8', headerKeywords=[])
 
def read_fits_with_path (self, filename, pathname, datatype='< f8', headerKeywords=[])
 
def read_m2c_file (self, m2cFileName)
 
def read_amp_envelope_file (self, modAmpEnvelopeFileName)
 
def read_disturbance_slopes_file (self, extractedSlopesFileName)
 
def read_actuator_map_file (self, actuatorMapFileName)
 
def read_calibration_recMat_file (self, calRecMatFileName)
 
def read_calibration_gain_file (self, calGainFileName)
 
def get_disturbance_ice (self)
 
def get_m2c_ice (self)
 
def get_calRecMat_ice (self)
 
def get_calGain_ice (self)
 
def set_modal_amplitude (self, modAmpVec=None, scalefactor=0.0)
 
def create_pushpull_disturbance (self)
 
def extract_disturbance_slopes (self, ringbuffer, frameCountVec)
 
def analyze_disturbance_slopes (self, distSlopesOffset=1)
 
def find_disturbance_slopes_offset (self, pushpullBlockSize=None, filename=None, overwrite=False)
 
def build_interaction_matrix (self, doublepass, skip=1)
 
def invert_interaction_matrix (self, index=None, rcond=1e-15)
 
def save_matrix (self, matrix, filename, overwrite, headerKeywords=[])
 
def save_disturbance (self, filename, overwrite=False)
 
def save_disturbance_slopes (self, filename, overwrite=False)
 
def save_reconstruction_matrix (self, filename, overwrite=False)
 
def save_interaction_matrix (self, filename, overwrite=False)
 
def display_dm_shape (self, commandVec, note='')
 
def init_slopes_display (self, mask, slopesDisplayTable)
 
def display_disturbance_slopes (self, index)
 
def display_slopes_frame (self, slopesFrame, note="")
 
def display_disturbance (self, decimation=1)
 
def get_mask_pixels (self, full_mask=None, binning=None)
 
def reduceIM (self, full_MPmask=None, full_Pmask=None, IMpath=None, NM4R=None)
 

Public Attributes

 config
 
 wfs
 
 dataPath
 
 distNumberOfModes
 
 pushpullBlockSize
 
 repetition
 
 numberOfDistBlocks
 
 distSlopesOffset
 
 modAmpScaleFactor
 
 numberOfSlopes
 
 m2cNumberOfModes
 
 dmFigure
 
 triang
 
 adsecPlot
 
 adsecNote
 
 slopesXPlot
 
 slopesYPlot
 
 slopesNote
 

Static Public Attributes

string dataPath = ''
 
int ringbufferSize = 20000
 
int disturbanceSize = 4000
 
int slopeFrameSize = 1600
 
 nActuators = None
 
 maxNumberOfModes = None
 
 m2c = None
 
 modAmpEnvelopeVec = None
 
 actCoords = None
 
 calRecMat = None
 
 calGainVec = None
 
 modAmpVec = None
 
 disturbance = None
 
 disturbanceSlopes = None
 
 intMat = None
 
 recMat = None
 
 slopesArr = None
 
 slopesDisplayTable = None
 
int m2cNumberOfModes = 0
 
int distNumberOfModes = 0
 
int repetition = 0
 
int pushpullBlockSize = 0
 
 disturbanceModeList = None
 
int numberOfDistBlocks = 0
 
int numberOfSlopes = 0
 
int distSlopesOffset = 0
 
int modAmpScaleFactor = 0
 
float ASF = 0.0
 

Detailed Description

Interaction Matrix class for the LBT Adaptive Secondary (Adsec) and 
Xinetics deformable mirror (on the LN bench) and methods to calibrate them.

 - It generates a push-pull disturbance 
 - It extracts the calibration slope data from the ringbuffer
 - It builds the interaction matrix 
 - It inverts the interaction matrix 
 - It provides functions to produce an IM for a partially illuminated metapupil
 - It provides methods to provide Adsec configuration data in a form that is 
   compliant with the ICE interface

Constructor & Destructor Documentation

◆ __init__() [1/2]

def laospy.interaction.InteractionMatrix.__init__ (   self,
  config 
)
Initializes AdsecInteractionMatrix with all important data
   
Parameters:
----------
config : App.config object
    the config property tree

Property Tree Parameters:
------------------------
IM.WFS : string
    Type of the Wafefront sensor. Either 'GWS' or 'HWS'
IM.M2C_FILE : string
    Name of mode-to-command matrix FITS file
IM.MOD_AMP_ENVELOPE_FILE : string
    Name of the maximum modal amplitude vector FITS file
IM.DATAPATH : string, optional
     The directory which contains all input files and to which the 
     calibration data is saved    

◆ __init__() [2/2]

def laospy.interaction.InteractionMatrix.__init__ (   self,
  config 
)
Initializes AdsecInteractionMatrix with all important data
   
Parameters:
----------
config : App.config object
    the config property tree

Property Tree Parameters:
------------------------
IM.WFS : string
    Type of the Wafefront sensor. Either 'GWS' or 'HWS'
IM.M2C_FILE : string
    Name of mode-to-command matrix FITS file
IM.MOD_AMP_ENVELOPE_FILE : string
    Name of the maximum modal amplitude vector FITS file
IM.DATAPATH : string, optional
     The directory which contains all input files and to which the 
     calibration data is saved    

Member Function Documentation

◆ analyze_disturbance_slopes() [1/2]

def laospy.interaction.InteractionMatrix.analyze_disturbance_slopes (   self,
  distSlopesOffset = 1 
)
Determines the number of disturbance slope blocks, the start offset and 
the number of slopes in each frame.

The slope frames are are deterministic - each successfully sent slopes 
frame advances the disturbance by one frame. There is, however, an 
offset between the first successfully sent slopes frame and the first    
slopes frame that is affected by the disturbance. This offset is constant (=1)

The disturbance is executed in a continuous loop as long as new slopes 
are being sent by the slope BCU. Up to 4 blocks of 4000 disturbance 
frames each fit into the ringbuffer, leaving some space to identify the 
beginning of the block and some continguency to stop the AO loop.         

Parameters
----------
distSlopesOffset : integer (optional)
    The offset at the beginning of the slope frames until the disturbance
    starts. Defaults to 1

Configuration Parameters
------------------------
IM.DISTSLOPESOFFSET : integer (optional)
    The offset at the beginning of the slope frames until the disturbance
    starts. Defaults to 1

◆ analyze_disturbance_slopes() [2/2]

def laospy.interaction.InteractionMatrix.analyze_disturbance_slopes (   self,
  distSlopesOffset = 1 
)
Determines the number of disturbance slope blocks, the start offset and 
the number of slopes in each frame.

The slope frames are are deterministic - each successfully sent slopes 
frame advances the disturbance by one frame. There is, however, an 
offset between the first successfully sent slopes frame and the first    
slopes frame that is affected by the disturbance. This offset is constant (=1)

The disturbance is executed in a continuous loop as long as new slopes 
are being sent by the slope BCU. Up to 4 blocks of 4000 disturbance 
frames each fit into the ringbuffer, leaving some space to identify the 
beginning of the block and some continguency to stop the AO loop.         

Parameters
----------
distSlopesOffset : integer (optional)
    The offset at the beginning of the slope frames until the disturbance
    starts. Defaults to 1

Configuration Parameters
------------------------
IM.DISTSLOPESOFFSET : integer (optional)
    The offset at the beginning of the slope frames until the disturbance
    starts. Defaults to 1

◆ build_interaction_matrix() [1/2]

def laospy.interaction.InteractionMatrix.build_interaction_matrix (   self,
  doublepass,
  skip = 1 
)
Combines the slope frames for each mode, normalizes and fills the 
interaction matrix for each disturbance block separately.

The interaction matrix has the size maxNumberOfModes x slopeFrameSize 
(= nActuatorsx1600) and is sparsely filled (slopes for unused modes are zero).

Parameters
----------
doublepass : boolean
    consider double pass nature of calibration setup in normalization
skip : integer (optional), default = 1 
    number of frames to skip at the beginning of a new push or pull 
    block. The first frames may be influenced by the settling of 
    the Adsec. 

◆ build_interaction_matrix() [2/2]

def laospy.interaction.InteractionMatrix.build_interaction_matrix (   self,
  doublepass,
  skip = 1 
)
Combines the slope frames for each mode, normalizes and fills the 
interaction matrix for each disturbance block separately.

The interaction matrix has the size maxNumberOfModes x slopeFrameSize 
(= nActuatorsx1600) and is sparsely filled (slopes for unused modes are zero).

Parameters
----------
doublepass : boolean
    consider double pass nature of calibration setup in normalization
skip : integer (optional), default = 1 
    number of frames to skip at the beginning of a new push or pull 
    block. The first frames may be influenced by the settling of 
    the Adsec. 

◆ create_pushpull_disturbance() [1/2]

def laospy.interaction.InteractionMatrix.create_pushpull_disturbance (   self)
Creates a push-pull disturbance sequence

The disturbance consists of  a chain of segments, each corresponding 
to a KL/ZK mode and each of equal length. The length of the segments is 
optimized to make best use of the disturbance buffer. 

Each mode segment consists of a several alternating push- and pull 
blocks, each of which has pushpullBlockSize. 

Example
-------
pushpullBlockSize = 3, p = push, P = pull

sequence: mode0(pppPPPpppPPP...), mode1(pppPPPpppPPP...),... 

Property Tree Parameters
------------------------
IM.NUM_MODES : int
    number of modes to be included in the push-pull sequence.
IM.PUSH_PULL_BLOCK_SIZE : integer
    number of consecutive disturbance frames with identical push or 
    pull signature (will be used to average accross)
    
Returns
-------
out : ndarray
    push-pull sequence. 4000x768 elements

◆ create_pushpull_disturbance() [2/2]

def laospy.interaction.InteractionMatrix.create_pushpull_disturbance (   self)
Creates a push-pull disturbance sequence

The disturbance consists of  a chain of segments, each corresponding 
to a KL/ZK mode and each of equal length. The length of the segments is 
optimized to make best use of the disturbance buffer. 

Each mode segment consists of a several alternating push- and pull 
blocks, each of which has pushpullBlockSize. 

Example
-------
pushpullBlockSize = 3, p = push, P = pull

sequence: mode0(pppPPPpppPPP...), mode1(pppPPPpppPPP...),... 

Property Tree Parameters
------------------------
IM.NUM_MODES : int
    number of modes to be included in the push-pull sequence.
IM.PUSH_PULL_BLOCK_SIZE : integer
    number of consecutive disturbance frames with identical push or 
    pull signature (will be used to average accross)
    
Returns
-------
out : ndarray
    push-pull sequence. 4000x768 elements

◆ display_disturbance() [1/2]

def laospy.interaction.InteractionMatrix.display_disturbance (   self,
  decimation = 1 
)
Displays the disturbance

Parameters
----------
decimation : int
    show only every nth record, n being the decimation value

◆ display_disturbance() [2/2]

def laospy.interaction.InteractionMatrix.display_disturbance (   self,
  decimation = 1 
)
Displays the disturbance

Parameters
----------
decimation : int
    show only every nth record, n being the decimation value

◆ display_disturbance_slopes() [1/2]

def laospy.interaction.InteractionMatrix.display_disturbance_slopes (   self,
  index 
)
Displays disturbance frame and slope frame in parallel

This display can be used to check the offset parameter in 
extract_disturbance_slopes()

Parameters
----------
index : integer
the index of the slopes frame and disturbance frame

◆ display_disturbance_slopes() [2/2]

def laospy.interaction.InteractionMatrix.display_disturbance_slopes (   self,
  index 
)
Displays disturbance frame and slope frame in parallel

This display can be used to check the offset parameter in 
extract_disturbance_slopes()

Parameters
----------
index : integer
the index of the slopes frame and disturbance frame

◆ display_dm_shape() [1/2]

def laospy.interaction.InteractionMatrix.display_dm_shape (   self,
  commandVec,
  note = '' 
)
Displays the the commanded shape of the adaptive secondary

Parameters
----------
commandVec    : ndarray
      the command vector
      
Property Tree Parameters:
-------------------------
IM.ACT_MAP_FILE : string
    Name of the FITS file with the actuator coordinates

◆ display_dm_shape() [2/2]

def laospy.interaction.InteractionMatrix.display_dm_shape (   self,
  commandVec,
  note = '' 
)
Displays the the commanded shape of the adaptive secondary

Parameters
----------
commandVec    : ndarray
      the command vector
      
Property Tree Parameters:
-------------------------
IM.ACT_MAP_FILE : string
    Name of the FITS file with the actuator coordinates

◆ display_slopes_frame() [1/2]

def laospy.interaction.InteractionMatrix.display_slopes_frame (   self,
  slopesFrame,
  note = "" 
)
Displays a slopes frame

Note: It is assumed that the slopes frame is of the order 
s0_x, s0_y, s1_x, s1_y, s2_x, s2_y,...

Parameters
----------
slopesFrame : ndarray
The slopes frame to be displayed

◆ display_slopes_frame() [2/2]

def laospy.interaction.InteractionMatrix.display_slopes_frame (   self,
  slopesFrame,
  note = "" 
)
Displays a slopes frame

Note: It is assumed that the slopes frame is of the order 
s0_x, s0_y, s1_x, s1_y, s2_x, s2_y,...

Parameters
----------
slopesFrame : ndarray
The slopes frame to be displayed

◆ extract_disturbance_slopes() [1/2]

def laospy.interaction.InteractionMatrix.extract_disturbance_slopes (   self,
  ringbuffer,
  frameCountVec 
)
Extracts all disturbance slope frames from the ringbuffer

To identify the disturbance slope frames the ringbuffer of the Adsec/Xinetics 
first has to be flushed. This is done by activating the AO (runAO) but 
not sending slopes for a period normally needed to acquire 20000 slope 
frames. (oversampling must be below the frame rate). This fills the 
ringbuffer with identical slopes frames. The frameCountVec will 
be filled with a constant value. Once slopes are sent again, the 
frame counter value will be incremented.

The block of disturbance slope frames is identified in the 
frameCountVec. NAN frames will be discarded. If the block of slope 
frames extends beyond the last element in the ringbuffer into the first 
elements, they will be rolled such the disturbance frames form a 
continuous block in the ringbuffer.

Parameters
----------
ringbuffer : ndarray
    a dump of the adsec ringbuffer, 20000x1600 elements
frameCountVec : ndarray
    the frame counter vector that was retrieved from the Adsec/Xinetics

◆ extract_disturbance_slopes() [2/2]

def laospy.interaction.InteractionMatrix.extract_disturbance_slopes (   self,
  ringbuffer,
  frameCountVec 
)
Extracts all disturbance slope frames from the ringbuffer

To identify the disturbance slope frames the ringbuffer of the Adsec/Xinetics 
first has to be flushed. This is done by activating the AO (runAO) but 
not sending slopes for a period normally needed to acquire 20000 slope 
frames. (oversampling must be below the frame rate). This fills the 
ringbuffer with identical slopes frames. The frameCountVec will 
be filled with a constant value. Once slopes are sent again, the 
frame counter value will be incremented.

The block of disturbance slope frames is identified in the 
frameCountVec. NAN frames will be discarded. If the block of slope 
frames extends beyond the last element in the ringbuffer into the first 
elements, they will be rolled such the disturbance frames form a 
continuous block in the ringbuffer.

Parameters
----------
ringbuffer : ndarray
    a dump of the adsec ringbuffer, 20000x1600 elements
frameCountVec : ndarray
    the frame counter vector that was retrieved from the Adsec/Xinetics

◆ find_disturbance_slopes_offset() [1/2]

def laospy.interaction.InteractionMatrix.find_disturbance_slopes_offset (   self,
  pushpullBlockSize = None,
  filename = None,
  overwrite = False 
)
 The slope frames are are deterministic - each successfully sent slopes 
frame advances the disturbance by one frame. There is, however, an 
offset between the first successfully sent slopes frame and the first    
slopes frame that is affected by the disturbance. This offset has to be  
known properly build the interaction matrix. The offset can be one or   
two frames. 

It seems that the offset is now constant (=1) for the LBT AdSec. This method 
will not be used by default anymore, as it adds uncertainty to the offset 
resulting in sign flips in the interaction and reconstruction matrix.

This method analyzes a fingerprint of the slopes: the sign changes of 
the baseline subtracted, boxcar-normalized slopes and tests the 
frequency of occurence of sign flips every pushpullBlockSize for 
different offsets. 

Parameters
----------
pushpullBlockSize : integer (optional)
    number of consecutive disturbance frames with identical push or 
    pull signature. It has to be the same number that was used to 
    create the disturbance. Not needed, if the disturbance was created 
    with this object
filename : string (optional)
    If set, the "fingerprint" = baseline subtracted, boxcar-normalized 
    slopes will be written to a FITS file 
overwrite : bool (optional)
    If true, an exisiting file with this filename with be overwrittten

◆ find_disturbance_slopes_offset() [2/2]

def laospy.interaction.InteractionMatrix.find_disturbance_slopes_offset (   self,
  pushpullBlockSize = None,
  filename = None,
  overwrite = False 
)
 The slope frames are are deterministic - each successfully sent slopes 
frame advances the disturbance by one frame. There is, however, an 
offset between the first successfully sent slopes frame and the first    
slopes frame that is affected by the disturbance. This offset has to be  
known properly build the interaction matrix. The offset can be one or   
two frames. 

It seems that the offset is now constant (=1) for the LBT AdSec. This method 
will not be used by default anymore, as it adds uncertainty to the offset 
resulting in sign flips in the interaction and reconstruction matrix.

This method analyzes a fingerprint of the slopes: the sign changes of 
the baseline subtracted, boxcar-normalized slopes and tests the 
frequency of occurence of sign flips every pushpullBlockSize for 
different offsets. 

Parameters
----------
pushpullBlockSize : integer (optional)
    number of consecutive disturbance frames with identical push or 
    pull signature. It has to be the same number that was used to 
    create the disturbance. Not needed, if the disturbance was created 
    with this object
filename : string (optional)
    If set, the "fingerprint" = baseline subtracted, boxcar-normalized 
    slopes will be written to a FITS file 
overwrite : bool (optional)
    If true, an exisiting file with this filename with be overwrittten

◆ get_calGain_ice() [1/2]

def laospy.interaction.InteractionMatrix.get_calGain_ice (   self)
Returns the gain vector that is used during the calibration
compatible to the adsec ICE interface 


property Tree Parameters
------------------------
IM.CAL_GAIN_FILE : string
    Name of the FITS file with the gain vector tha is used during the 
    calibration


Returns
-------
out : lists (nActuators elements)

◆ get_calGain_ice() [2/2]

def laospy.interaction.InteractionMatrix.get_calGain_ice (   self)
Returns the gain vector that is used during the calibration
compatible to the adsec ICE interface 


property Tree Parameters
------------------------
IM.CAL_GAIN_FILE : string
    Name of the FITS file with the gain vector tha is used during the 
    calibration


Returns
-------
out : lists (nActuators elements)

◆ get_calRecMat_ice() [1/2]

def laospy.interaction.InteractionMatrix.get_calRecMat_ice (   self)
Returns the reconstruction matrix that is used during the calibration
as a nested list, compatible to the adsec ICE interface 

Property Tree Parameters
------------------------
IM.CAL_REC_MAT_FILE : string
    Name of the FITS file with the reconstruction matrix that is used 
    during the calibration
 

Returns
-------
out : list of lists (nActuatorsx1600 elements)

◆ get_calRecMat_ice() [2/2]

def laospy.interaction.InteractionMatrix.get_calRecMat_ice (   self)
Returns the reconstruction matrix that is used during the calibration
as a nested list, compatible to the adsec ICE interface 

Property Tree Parameters
------------------------
IM.CAL_REC_MAT_FILE : string
    Name of the FITS file with the reconstruction matrix that is used 
    during the calibration
 

Returns
-------
out : list of lists (nActuatorsx1600 elements)

◆ get_disturbance_ice() [1/2]

def laospy.interaction.InteractionMatrix.get_disturbance_ice (   self)
Returns the disturbance as a nested list, compatible to the adsec ICE 
interface

Returns
-------
out : list of lists (4000xnActuators elements)

◆ get_disturbance_ice() [2/2]

def laospy.interaction.InteractionMatrix.get_disturbance_ice (   self)
Returns the disturbance as a nested list, compatible to the adsec ICE 
interface

Returns
-------
out : list of lists (4000xnActuators elements)

◆ get_m2c_ice() [1/2]

def laospy.interaction.InteractionMatrix.get_m2c_ice (   self)
Returns the m2c matrix as a nested list, compatible to the adsec ICE 
interface 

Returns
-------
out : list of lists (nActuatorsxnActuators elements)

◆ get_m2c_ice() [2/2]

def laospy.interaction.InteractionMatrix.get_m2c_ice (   self)
Returns the m2c matrix as a nested list, compatible to the adsec ICE 
interface 

Returns
-------
out : list of lists (nActuatorsxnActuators elements)

◆ get_mask_pixels() [1/2]

def laospy.interaction.InteractionMatrix.get_mask_pixels (   self,
  full_mask = None,
  binning = None 
)
Returns flat array of illuminated pixels from the mask provided. The mask can be full frame or a qudrant one.
It only considers the first Quadrant elements.
The pixel position can be from 0 to total number of pixels in the quadrant 

◆ get_mask_pixels() [2/2]

def laospy.interaction.InteractionMatrix.get_mask_pixels (   self,
  full_mask = None,
  binning = None 
)
Returns flat array of illuminated pixels from the mask provided. The mask can be full frame or a qudrant one.
It only considers the first Quadrant elements.
The pixel position can be from 0 to total number of pixels in the quadrant 

◆ init_slopes_display() [1/2]

def laospy.interaction.InteractionMatrix.init_slopes_display (   self,
  mask,
  slopesDisplayTable 
)
Initializes the slopes display

Parameters
----------
mask : ndarray (2D boolean)
    A mask representing the subapertures. 
slopesDisplayTable : ndarray (Integer, size: number of slopes)
    The order, in which the slopes have to appear in to match  the 
    subapertures. The subapertures in the mask are numbered 
    consecutively.

◆ init_slopes_display() [2/2]

def laospy.interaction.InteractionMatrix.init_slopes_display (   self,
  mask,
  slopesDisplayTable 
)
Initializes the slopes display

Parameters
----------
mask : ndarray (2D boolean)
    A mask representing the subapertures. 
slopesDisplayTable : ndarray (Integer, size: number of slopes)
    The order, in which the slopes have to appear in to match  the 
    subapertures. The subapertures in the mask are numbered 
    consecutively.

◆ invert_interaction_matrix() [1/2]

def laospy.interaction.InteractionMatrix.invert_interaction_matrix (   self,
  index = None,
  rcond = 1e-15 
)
Computes the (Moore-Penrose) pseudo-inverse of the interaction matrix.

The default is to invert the mean of all interaction matrices. The 
result is kept as recMat.

Parameters
----------
rcond : float
    Cutoff for small singular values. Singular values smaller (in 
    modulus) than rcond * largest_singular_value (again, in modulus) are 
    set to zero.
index : integer (optional)
    if defined, only the Interaction Matrix with this index will be 
    inverted. 

◆ invert_interaction_matrix() [2/2]

def laospy.interaction.InteractionMatrix.invert_interaction_matrix (   self,
  index = None,
  rcond = 1e-15 
)
Computes the (Moore-Penrose) pseudo-inverse of the interaction matrix.

The default is to invert the mean of all interaction matrices. The 
result is kept as recMat.

Parameters
----------
rcond : float
    Cutoff for small singular values. Singular values smaller (in 
    modulus) than rcond * largest_singular_value (again, in modulus) are 
    set to zero.
index : integer (optional)
    if defined, only the Interaction Matrix with this index will be 
    inverted. 

◆ read_actuator_map_file() [1/2]

def laospy.interaction.InteractionMatrix.read_actuator_map_file (   self,
  actuatorMapFileName 
)
Reads the FITS file with the actuator coordinates

It is a 2xnActuators array with X and Y coordinates for each actuators, in 
millimeters

Parameters
----------
actuatorMapFileName : string
    Name of the FITS file with the actuator coordinates

◆ read_actuator_map_file() [2/2]

def laospy.interaction.InteractionMatrix.read_actuator_map_file (   self,
  actuatorMapFileName 
)
Reads the FITS file with the actuator coordinates

It is a 2xnActuators array with X and Y coordinates for each actuators, in 
millimeters

Parameters
----------
actuatorMapFileName : string
    Name of the FITS file with the actuator coordinates

◆ read_amp_envelope_file() [1/2]

def laospy.interaction.InteractionMatrix.read_amp_envelope_file (   self,
  modAmpEnvelopeFileName 
)
Reads the maximum modal amplitude vector FITS file.

The maximum amplitude vector and the m2c file belong together!

Each element of this vector is the maximum amplitude that the mirror 
can apply for the corresponding mode (element #0 for mode #0 of 
the KL/ZK basis, and so on). The first 150 values have been capped at 
1.5e-7, while after that the amplitude goes down.

Parameters
----------
modAmpEnvelopeFileName : string
    Name of the maximum modal amplitude vector FITS file

◆ read_amp_envelope_file() [2/2]

def laospy.interaction.InteractionMatrix.read_amp_envelope_file (   self,
  modAmpEnvelopeFileName 
)
Reads the maximum modal amplitude vector FITS file.

The maximum amplitude vector and the m2c file belong together!

Each element of this vector is the maximum amplitude that the mirror 
can apply for the corresponding mode (element #0 for mode #0 of 
the KL/ZK basis, and so on). The first 150 values have been capped at 
1.5e-7, while after that the amplitude goes down.

Parameters
----------
modAmpEnvelopeFileName : string
    Name of the maximum modal amplitude vector FITS file

◆ read_calibration_gain_file() [1/2]

def laospy.interaction.InteractionMatrix.read_calibration_gain_file (   self,
  calGainFileName 
)
Reads the FITS file with the gain vector that is used during the 
calibration

Parameters
----------
calGainFileName : string
    Name of the FITS file

◆ read_calibration_gain_file() [2/2]

def laospy.interaction.InteractionMatrix.read_calibration_gain_file (   self,
  calGainFileName 
)
Reads the FITS file with the gain vector that is used during the 
calibration

Parameters
----------
calGainFileName : string
    Name of the FITS file

◆ read_calibration_recMat_file() [1/2]

def laospy.interaction.InteractionMatrix.read_calibration_recMat_file (   self,
  calRecMatFileName 
)
Reads the FITS file with the reconstruction matrix that is used during 
the calibration

Parameters
----------
calRecMatFileName : string
    Name of the FITS file

◆ read_calibration_recMat_file() [2/2]

def laospy.interaction.InteractionMatrix.read_calibration_recMat_file (   self,
  calRecMatFileName 
)
Reads the FITS file with the reconstruction matrix that is used during 
the calibration

Parameters
----------
calRecMatFileName : string
    Name of the FITS file

◆ read_disturbance_slopes_file() [1/2]

def laospy.interaction.InteractionMatrix.read_disturbance_slopes_file (   self,
  extractedSlopesFileName 
)
Reads previously extracted disturbance slopes from a FITS file

Parameters
---------
extractedSlopesFileName : string
    Name of the FITS file with the extracted slopes

◆ read_disturbance_slopes_file() [2/2]

def laospy.interaction.InteractionMatrix.read_disturbance_slopes_file (   self,
  extractedSlopesFileName 
)
Reads previously extracted disturbance slopes from a FITS file

Parameters
---------
extractedSlopesFileName : string
    Name of the FITS file with the extracted slopes

◆ read_fits() [1/2]

def laospy.interaction.InteractionMatrix.read_fits (   self,
  filename,
  datatype = '<f8',
  headerKeywords = [] 
)

◆ read_fits() [2/2]

def laospy.interaction.InteractionMatrix.read_fits (   self,
  filename,
  datatype = '<f8',
  headerKeywords = [] 
)

◆ read_fits_abspath() [1/2]

def laospy.interaction.InteractionMatrix.read_fits_abspath (   self,
  filename,
  datatype = '<f8',
  headerKeywords = [] 
)

◆ read_fits_abspath() [2/2]

def laospy.interaction.InteractionMatrix.read_fits_abspath (   self,
  filename,
  datatype = '<f8',
  headerKeywords = [] 
)

◆ read_fits_with_path() [1/2]

def laospy.interaction.InteractionMatrix.read_fits_with_path (   self,
  filename,
  pathname,
  datatype = '<f8',
  headerKeywords = [] 
)
Reads a FITS file located in the dataPath

Parameters
----------
filename : string
    will be appended to the data Path
datatype : string (optional)
    see numpy convention for data type interpretation
headerKeywords : list of strings (optional)
    defines the properties that are updated by the values found in the 
    header of the FITS file. 
    
Returns
-------
out : ndarray

◆ read_fits_with_path() [2/2]

def laospy.interaction.InteractionMatrix.read_fits_with_path (   self,
  filename,
  pathname,
  datatype = '<f8',
  headerKeywords = [] 
)
Reads a FITS file located in the dataPath

Parameters
----------
filename : string
    will be appended to the data Path
datatype : string (optional)
    see numpy convention for data type interpretation
headerKeywords : list of strings (optional)
    defines the properties that are updated by the values found in the 
    header of the FITS file. 
    
Returns
-------
out : ndarray

◆ read_m2c_file() [1/2]

def laospy.interaction.InteractionMatrix.read_m2c_file (   self,
  m2cFileName 
)
Reads the mode-to-command matrix FITS file

Note: m2c is quadratic (nActuatorsxnActuators). Actuator commands are set to 0 for 
modes that are not calibrated. m2cNumberOfModes is set to the 
actual number of modes 

Parameters
----------
m2cFileName : string
    Name of mode-to-command matrix FITS file

Returns
-------
out : ndarray
    Array with nActuatorsxnActuators elements, (commands, modes)

◆ read_m2c_file() [2/2]

def laospy.interaction.InteractionMatrix.read_m2c_file (   self,
  m2cFileName 
)
Reads the mode-to-command matrix FITS file

Note: m2c is quadratic (nActuatorsxnActuators). Actuator commands are set to 0 for 
modes that are not calibrated. m2cNumberOfModes is set to the 
actual number of modes 

Parameters
----------
m2cFileName : string
    Name of mode-to-command matrix FITS file

Returns
-------
out : ndarray
    Array with nActuatorsxnActuators elements, (commands, modes)

◆ reduceIM() [1/2]

def laospy.interaction.InteractionMatrix.reduceIM (   self,
  full_MPmask = None,
  full_Pmask = None,
  IMpath = None,
  NM4R = None 
)
This function reduces a new interaction matrix from the calibrated interaction matrix and creates
new reconstruction matrix. returns this new reconstruction matrix.
Needs the full Metapupil mask and partial mask as the inputs. 
These masks should be the full CCD size and not the quadrant mask. 

◆ reduceIM() [2/2]

def laospy.interaction.InteractionMatrix.reduceIM (   self,
  full_MPmask = None,
  full_Pmask = None,
  IMpath = None,
  NM4R = None 
)
This function reduces a new interaction matrix from the calibrated interaction matrix and creates
new reconstruction matrix. returns this new reconstruction matrix.
Needs the full Metapupil mask and partial mask as the inputs. 
These masks should be the full CCD size and not the quadrant mask. 

◆ save_disturbance() [1/2]

def laospy.interaction.InteractionMatrix.save_disturbance (   self,
  filename,
  overwrite = False 
)
Saves the disturbance 

Parameters
----------
filename : string
overwrite : boolean (optional)

◆ save_disturbance() [2/2]

def laospy.interaction.InteractionMatrix.save_disturbance (   self,
  filename,
  overwrite = False 
)
Saves the disturbance 

Parameters
----------
filename : string
overwrite : boolean (optional)

◆ save_disturbance_slopes() [1/2]

def laospy.interaction.InteractionMatrix.save_disturbance_slopes (   self,
  filename,
  overwrite = False 
)
Saves the disturbance slopes

Parameters
----------
filename : string
overwrite : boolean (optional)

◆ save_disturbance_slopes() [2/2]

def laospy.interaction.InteractionMatrix.save_disturbance_slopes (   self,
  filename,
  overwrite = False 
)
Saves the disturbance slopes

Parameters
----------
filename : string
overwrite : boolean (optional)

◆ save_interaction_matrix() [1/2]

def laospy.interaction.InteractionMatrix.save_interaction_matrix (   self,
  filename,
  overwrite = False 
)
Saves a cube of interaction matrices - one for each disturbance block.

Parameters
----------
filename : string
overwrite : boolean (optional)

◆ save_interaction_matrix() [2/2]

def laospy.interaction.InteractionMatrix.save_interaction_matrix (   self,
  filename,
  overwrite = False 
)
Saves a cube of interaction matrices - one for each disturbance block.

Parameters
----------
filename : string
overwrite : boolean (optional)

◆ save_matrix() [1/2]

def laospy.interaction.InteractionMatrix.save_matrix (   self,
  matrix,
  filename,
  overwrite,
  headerKeywords = [] 
)
Saves an array to a FITS file and adds properties to the header

Parameters
----------
matrix : ndarray
    array to be stored
filename : string
overwrite : boolean
    overwrite, if there exists a file with the specified name
headerKeywords : list of strings
    the keywords of the properties that should be stored into the header

◆ save_matrix() [2/2]

def laospy.interaction.InteractionMatrix.save_matrix (   self,
  matrix,
  filename,
  overwrite,
  headerKeywords = [] 
)
Saves an array to a FITS file and adds properties to the header

Parameters
----------
matrix : ndarray
    array to be stored
filename : string
overwrite : boolean
    overwrite, if there exists a file with the specified name
headerKeywords : list of strings
    the keywords of the properties that should be stored into the header

◆ save_reconstruction_matrix() [1/2]

def laospy.interaction.InteractionMatrix.save_reconstruction_matrix (   self,
  filename,
  overwrite = False 
)
Saves the reconstruction matrix. 
      

Parameters
----------
filename : string
overwrite : boolean (optional)

◆ save_reconstruction_matrix() [2/2]

def laospy.interaction.InteractionMatrix.save_reconstruction_matrix (   self,
  filename,
  overwrite = False 
)
Saves the reconstruction matrix. 
      

Parameters
----------
filename : string
overwrite : boolean (optional)

◆ set_modal_amplitude() [1/2]

def laospy.interaction.InteractionMatrix.set_modal_amplitude (   self,
  modAmpVec = None,
  scalefactor = 0.0 
)
Sets the modal amplitude vector 

The modal amplitude vector can either be a scaled version of the modal 
amplitude envelope vector or can be set explicitely.

Modal amplitudes must not exceed the modal Amplitude Envelope

Parameters
----------
modAmpVec : ndarray, optional
    amplitude vector (nActuators elements)
    
Property Tree Parameters
------------------------
IM.AMP_SCALE_FACTOR : double
    factor [0..1] with which the amplitude vector is scaled 

◆ set_modal_amplitude() [2/2]

def laospy.interaction.InteractionMatrix.set_modal_amplitude (   self,
  modAmpVec = None,
  scalefactor = 0.0 
)
Sets the modal amplitude vector 

The modal amplitude vector can either be a scaled version of the modal 
amplitude envelope vector or can be set explicitely.

Modal amplitudes must not exceed the modal Amplitude Envelope

Parameters
----------
modAmpVec : ndarray, optional
    amplitude vector (nActuators elements)
    
Property Tree Parameters
------------------------
IM.AMP_SCALE_FACTOR : double
    factor [0..1] with which the amplitude vector is scaled 

Member Data Documentation

◆ actCoords

laospy.interaction.InteractionMatrix.actCoords = None
static

◆ adsecNote

laospy.interaction.InteractionMatrix.adsecNote

◆ adsecPlot

laospy.interaction.InteractionMatrix.adsecPlot

◆ ASF

float laospy.interaction.InteractionMatrix.ASF = 0.0
static

◆ calGainVec

laospy.interaction.InteractionMatrix.calGainVec = None
static

◆ calRecMat

laospy.interaction.InteractionMatrix.calRecMat = None
static

◆ config

laospy.interaction.InteractionMatrix.config

◆ dataPath [1/2]

string laospy.interaction.InteractionMatrix.dataPath = ''
static

◆ dataPath [2/2]

laospy.interaction.InteractionMatrix.dataPath

◆ distNumberOfModes [1/2]

int laospy.interaction.InteractionMatrix.distNumberOfModes = 0
static

◆ distNumberOfModes [2/2]

laospy.interaction.InteractionMatrix.distNumberOfModes

◆ distSlopesOffset [1/2]

int laospy.interaction.InteractionMatrix.distSlopesOffset = 0
static

◆ distSlopesOffset [2/2]

laospy.interaction.InteractionMatrix.distSlopesOffset

◆ disturbance

laospy.interaction.InteractionMatrix.disturbance = None
static

◆ disturbanceModeList

laospy.interaction.InteractionMatrix.disturbanceModeList = None
static

◆ disturbanceSize

int laospy.interaction.InteractionMatrix.disturbanceSize = 4000
static

◆ disturbanceSlopes

laospy.interaction.InteractionMatrix.disturbanceSlopes = None
static

◆ dmFigure

laospy.interaction.InteractionMatrix.dmFigure

◆ intMat

laospy.interaction.InteractionMatrix.intMat = None
static

◆ m2c

laospy.interaction.InteractionMatrix.m2c = None
static

◆ m2cNumberOfModes [1/2]

int laospy.interaction.InteractionMatrix.m2cNumberOfModes = 0
static

◆ m2cNumberOfModes [2/2]

laospy.interaction.InteractionMatrix.m2cNumberOfModes

◆ maxNumberOfModes

laospy.interaction.InteractionMatrix.maxNumberOfModes = None
static

◆ modAmpEnvelopeVec

laospy.interaction.InteractionMatrix.modAmpEnvelopeVec = None
static

◆ modAmpScaleFactor [1/2]

int laospy.interaction.InteractionMatrix.modAmpScaleFactor = 0
static

◆ modAmpScaleFactor [2/2]

laospy.interaction.InteractionMatrix.modAmpScaleFactor

◆ modAmpVec

laospy.interaction.InteractionMatrix.modAmpVec = None
static

◆ nActuators

laospy.interaction.InteractionMatrix.nActuators = None
static

◆ numberOfDistBlocks [1/2]

int laospy.interaction.InteractionMatrix.numberOfDistBlocks = 0
static

◆ numberOfDistBlocks [2/2]

laospy.interaction.InteractionMatrix.numberOfDistBlocks

◆ numberOfSlopes [1/2]

int laospy.interaction.InteractionMatrix.numberOfSlopes = 0
static

◆ numberOfSlopes [2/2]

laospy.interaction.InteractionMatrix.numberOfSlopes

◆ pushpullBlockSize [1/2]

int laospy.interaction.InteractionMatrix.pushpullBlockSize = 0
static

◆ pushpullBlockSize [2/2]

laospy.interaction.InteractionMatrix.pushpullBlockSize

◆ recMat

laospy.interaction.InteractionMatrix.recMat = None
static

◆ repetition [1/2]

int laospy.interaction.InteractionMatrix.repetition = 0
static

◆ repetition [2/2]

laospy.interaction.InteractionMatrix.repetition

◆ ringbufferSize

int laospy.interaction.InteractionMatrix.ringbufferSize = 20000
static

◆ slopeFrameSize

int laospy.interaction.InteractionMatrix.slopeFrameSize = 1600
static

◆ slopesArr

laospy.interaction.InteractionMatrix.slopesArr = None
static

◆ slopesDisplayTable

laospy.interaction.InteractionMatrix.slopesDisplayTable = None
static

◆ slopesNote

laospy.interaction.InteractionMatrix.slopesNote

◆ slopesXPlot

laospy.interaction.InteractionMatrix.slopesXPlot

◆ slopesYPlot

laospy.interaction.InteractionMatrix.slopesYPlot

◆ triang

laospy.interaction.InteractionMatrix.triang

◆ wfs

laospy.interaction.InteractionMatrix.wfs

The documentation for this class was generated from the following file: