TwiceAsNice
2019-02-18
|
Static Public Attributes | |
pushArray = ma.zeros((1020,1020)) | |
pullArray = ma.zeros((1020,1020)) | |
responseArray = ma.zeros((1020,1020)) | |
flatArray = ma.zeros((1020,1020)) | |
zeroArray = ma.zeros((1020,1020)) | |
influenceFunction = ma.zeros((1020,1020)) | |
int | actuatorIndex = -1 |
Private Member Functions | |
def | _init_measurement_display (self) |
def | _set_fisba_filesize (self) |
def | _newest_fisba_filename (self) |
def | _init_actgrid_display (self, array, transform=True) |
def | _pushpull (self, direction) |
def | _create_actuator_slopes (self) |
def | _init_measurement_display (self) |
def | _set_fisba_filesize (self) |
def | _newest_fisba_filename (self) |
def | _init_actgrid_display (self, array, transform=True) |
def | _pushpull (self, direction) |
def | _create_actuator_slopes (self) |
Static Private Attributes | |
int | _numAct = 349 |
_actCoords = np.zeros((_numAct, 2)) | |
int | _maskValue = -0x80000000 |
int | _fisbaFileSize = 0 |
Methods to measure the spatial influence of the DM actuators with the FISBA or the WFS. Creation of - Influence Matrices - relationship between Actuator position and illuminated metapupil
def laospy.influence.ActuatorInfluence.__init__ | ( | self, | |
config | |||
) |
Parameters ---------- config : node the config property tree node Property Tree Parameters: ------------------------ INF.DATAPATH The path of the measurements, influence matrix etc. INF.SOURCE Either "WFS" or "FISBA"
def laospy.influence.ActuatorInfluence.__init__ | ( | self, | |
config | |||
) |
Parameters ---------- config : node the config property tree node Property Tree Parameters: ------------------------ INF.DATAPATH The path of the measurements, influence matrix etc. INF.SOURCE Either "WFS" or "FISBA"
|
private |
Calculates the slopes response for the WFS measurement Returns -------- cslopes : ndarray complex slopes (x + j*y).
|
private |
Calculates the slopes response for the WFS measurement Returns -------- cslopes : ndarray complex slopes (x + j*y).
|
private |
Initializes the actuator grid display Parameters ---------- array : ndarray array to be displayed transform : boolean true if array should be transformed into the actuator grid
|
private |
Initializes the actuator grid display Parameters ---------- array : ndarray array to be displayed transform : boolean true if array should be transformed into the actuator grid
|
private |
Initializes the measurement display
|
private |
Initializes the measurement display
|
private |
returns the filename of the most recent µShape dataset
|
private |
returns the filename of the most recent µShape dataset
|
private |
pushes or pulls the current actuator and returns the measurement Parameters ---------- direction : int direction should be 1 or -1
|
private |
pushes or pulls the current actuator and returns the measurement Parameters ---------- direction : int direction should be 1 or -1
|
private |
Determines the size of the µ-Shape datafiles
|
private |
Determines the size of the µ-Shape datafiles
def laospy.influence.ActuatorInfluence.build_influence_matrix | ( | self, | |
useMetapupil = True , |
|||
display = False |
|||
) |
Extracts the influence function for all actuators from FISBA measurements. Inverts the influence matrix and saves the result Parameters: ----------- useMetapupil : boolean if True, only the subapertures inside the (brimmed) metapupil will be considered display : boolean Displays the response of each actuator
def laospy.influence.ActuatorInfluence.build_influence_matrix | ( | self, | |
useMetapupil = True , |
|||
display = False |
|||
) |
Extracts the influence function for all actuators from FISBA measurements. Inverts the influence matrix and saves the result Parameters: ----------- useMetapupil : boolean if True, only the subapertures inside the (brimmed) metapupil will be considered display : boolean Displays the response of each actuator
def laospy.influence.ActuatorInfluence.create_metapupil_zernike_array | ( | self, | |
j, | |||
brim = True , |
|||
display = False |
|||
) |
Creates a zernike mode defined on the metapupil. The unmasked area corresponds to the metapupil. Optionally, a "brim" can be added, in which the unit circle is extended outwards and mirrored radially. In addition the brim transits radially from the Zernike unit circle to zero at the edge of the actuator pattern. This should define reasonable positions for actuators that are not inside the metapupil. Parameters ---------- j : integer zernike mode to fill the metapupil brim : boolean True if a brim should be added to the zernike mode in the metapupil display : boolean displays the result on the actuator grid
def laospy.influence.ActuatorInfluence.create_metapupil_zernike_array | ( | self, | |
j, | |||
brim = True , |
|||
display = False |
|||
) |
Creates a zernike mode defined on the metapupil. The unmasked area corresponds to the metapupil. Optionally, a "brim" can be added, in which the unit circle is extended outwards and mirrored radially. In addition the brim transits radially from the Zernike unit circle to zero at the edge of the actuator pattern. This should define reasonable positions for actuators that are not inside the metapupil. Parameters ---------- j : integer zernike mode to fill the metapupil brim : boolean True if a brim should be added to the zernike mode in the metapupil display : boolean displays the result on the actuator grid
def laospy.influence.ActuatorInfluence.display_actgrid | ( | self, | |
array, | |||
transform = True |
|||
) |
Transforms the array and displays it behind the actuator grid Parameters ---------- array : ndarray array to be displayed transform : boolean true if array should be transformed into the actuator grid
def laospy.influence.ActuatorInfluence.display_actgrid | ( | self, | |
array, | |||
transform = True |
|||
) |
Transforms the array and displays it behind the actuator grid Parameters ---------- array : ndarray array to be displayed transform : boolean true if array should be transformed into the actuator grid
def laospy.influence.ActuatorInfluence.display_array | ( | self, | |
array, | |||
act = None |
|||
) |
def laospy.influence.ActuatorInfluence.display_array | ( | self, | |
array, | |||
act = None |
|||
) |
def laospy.influence.ActuatorInfluence.display_flat | ( | self | ) |
def laospy.influence.ActuatorInfluence.display_flat | ( | self | ) |
def laospy.influence.ActuatorInfluence.display_measurement | ( | self, | |
type = 'response' |
|||
) |
Displays the measurement
def laospy.influence.ActuatorInfluence.display_measurement | ( | self, | |
type = 'response' |
|||
) |
Displays the measurement
def laospy.influence.ActuatorInfluence.extract_influence_function | ( | self, | |
actuatorIndex, | |||
display = False |
|||
) |
Extracts the influence of an actuator from FISBA measurements Parameters ---------- actuatorIndex : int The actuator for which the influence function is isolated display : boolean displays the extracted responses Returns ------- response : ndarray (flat) the actuator response
def laospy.influence.ActuatorInfluence.extract_influence_function | ( | self, | |
actuatorIndex, | |||
display = False |
|||
) |
Extracts the influence of an actuator from FISBA measurements Parameters ---------- actuatorIndex : int The actuator for which the influence function is isolated display : boolean displays the extracted responses Returns ------- response : ndarray (flat) the actuator response
def laospy.influence.ActuatorInfluence.find_actgrid_transform | ( | self, | |
display = False |
|||
) |
identifies the location of actuators and determines a transformation from measurement coordinates into actuator space coordinates. The transformation is determined by a least square fit of the position of a number of actuators Parameters ---------- display : boolean (optional) shows the actuator responses and the position of the maxima that are used to find the transformation Property Tree Parameters: ------------------------ INF.ACTLIST : list of int the actuators that are probed to determine the transformation INF.ACTSAMPLING : int number of pixels per actuator spacing INF.INFRAD : float The radius of the region around each actuator, in which the actuator response is considered. In actuator grid spacing
def laospy.influence.ActuatorInfluence.find_actgrid_transform | ( | self, | |
display = False |
|||
) |
identifies the location of actuators and determines a transformation from measurement coordinates into actuator space coordinates. The transformation is determined by a least square fit of the position of a number of actuators Parameters ---------- display : boolean (optional) shows the actuator responses and the position of the maxima that are used to find the transformation Property Tree Parameters: ------------------------ INF.ACTLIST : list of int the actuators that are probed to determine the transformation INF.ACTSAMPLING : int number of pixels per actuator spacing INF.INFRAD : float The radius of the region around each actuator, in which the actuator response is considered. In actuator grid spacing
def laospy.influence.ActuatorInfluence.find_metapupil_parameters | ( | self, | |
display = False |
|||
) |
Determines the position and the diameter of the metapupil in the actuator grid Property Tree Parameters: ------------------------ INF.METAPUPIL_CENTER : NicePoint The center of the metapupil in CCD quadrant coordinates INF.METAPUPIL_DIAM : Float THe diameter of the metapupil in CCD pixels
def laospy.influence.ActuatorInfluence.find_metapupil_parameters | ( | self, | |
display = False |
|||
) |
Determines the position and the diameter of the metapupil in the actuator grid Property Tree Parameters: ------------------------ INF.METAPUPIL_CENTER : NicePoint The center of the metapupil in CCD quadrant coordinates INF.METAPUPIL_DIAM : Float THe diameter of the metapupil in CCD pixels
def laospy.influence.ActuatorInfluence.flatten_dm | ( | self, | |
threshold | |||
) |
Flattens the Xinetics mirror Parameters ---------- threshold : int the maximum value the absolute actuator command is allowed to be
def laospy.influence.ActuatorInfluence.flatten_dm | ( | self, | |
threshold | |||
) |
Flattens the Xinetics mirror Parameters ---------- threshold : int the maximum value the absolute actuator command is allowed to be
def laospy.influence.ActuatorInfluence.get_actgrid_position | ( | self, | |
pos | |||
) |
returns the actuator grid coordinates of a position Parameters ---------- pos : ndarray(2) position in metapupil or FISBA coordinates Returns ------- actgridPos : ndarray(2) position in actuator grid coordinates, rounded to next full integer
def laospy.influence.ActuatorInfluence.get_actgrid_position | ( | self, | |
pos | |||
) |
returns the actuator grid coordinates of a position Parameters ---------- pos : ndarray(2) position in metapupil or FISBA coordinates Returns ------- actgridPos : ndarray(2) position in actuator grid coordinates, rounded to next full integer
def laospy.influence.ActuatorInfluence.get_actgrid_scale | ( | self | ) |
returns the scale between metapupil/FISBA measurement and actuator grid
def laospy.influence.ActuatorInfluence.get_actgrid_scale | ( | self | ) |
returns the scale between metapupil/FISBA measurement and actuator grid
def laospy.influence.ActuatorInfluence.init_dm | ( | self | ) |
Initializes connection to the Xinetics Service object and the pushPullVal. Property Tree Parameters: ------------------------ INF.DM.ENDPOINT : string The endpoint of the DM Service INF.PUSHPULLVAL : int The Actuator Command Amplitude for each push or pull motion
def laospy.influence.ActuatorInfluence.init_dm | ( | self | ) |
Initializes connection to the Xinetics Service object and the pushPullVal. Property Tree Parameters: ------------------------ INF.DM.ENDPOINT : string The endpoint of the DM Service INF.PUSHPULLVAL : int The Actuator Command Amplitude for each push or pull motion
def laospy.influence.ActuatorInfluence.init_influence_function | ( | self | ) |
Initializes parameters related to the influence functions Property Tree Parameters: ------------------------ INF.ACTSAMPLING : int number of pixels per actuator spacing INF.INFRAD : float The radius of the region around each actuator, in which the actuator response is considered. In actuator grid spacing INF.FISBA_CENTER : NicePoint Center of the region covered by the FISBA. In actuator grid coordinates INF.FISBA_RAD : float Radius of the region covered by the FISBA. In actuator grid spacing INF.BRIM :
def laospy.influence.ActuatorInfluence.init_influence_function | ( | self | ) |
Initializes parameters related to the influence functions Property Tree Parameters: ------------------------ INF.ACTSAMPLING : int number of pixels per actuator spacing INF.INFRAD : float The radius of the region around each actuator, in which the actuator response is considered. In actuator grid spacing INF.FISBA_CENTER : NicePoint Center of the region covered by the FISBA. In actuator grid coordinates INF.FISBA_RAD : float Radius of the region covered by the FISBA. In actuator grid spacing INF.BRIM :
def laospy.influence.ActuatorInfluence.init_source | ( | self | ) |
Initializes the source for the measurement. If the source is WFC, a camera object is created. If the source is FISBA, the fisbapath is set and the size of the µShape files determined. In the latter case the FISBA should be running, measuring in continuous mode and saving the data in numbered files of µShape binary format
def laospy.influence.ActuatorInfluence.init_source | ( | self | ) |
Initializes the source for the measurement. If the source is WFC, a camera object is created. If the source is FISBA, the fisbapath is set and the size of the µShape files determined. In the latter case the FISBA should be running, measuring in continuous mode and saving the data in numbered files of µShape binary format
def laospy.influence.ActuatorInfluence.invert_influence_matrix | ( | self, | |
rcond = 1e-15 |
|||
) |
Computes the (Moore-Penrose) pseudo-inverse of the influence matrix. 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.
def laospy.influence.ActuatorInfluence.invert_influence_matrix | ( | self, | |
rcond = 1e-15 |
|||
) |
Computes the (Moore-Penrose) pseudo-inverse of the influence matrix. 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.
def laospy.influence.ActuatorInfluence.load | ( | self, | |
actuatorIndex | |||
) |
Loads the calibration data of the specified actuator
def laospy.influence.ActuatorInfluence.load | ( | self, | |
actuatorIndex | |||
) |
Loads the calibration data of the specified actuator
def laospy.influence.ActuatorInfluence.load_influence_matrix | ( | self | ) |
Loads the (inverted) influence matrix
def laospy.influence.ActuatorInfluence.load_influence_matrix | ( | self | ) |
Loads the (inverted) influence matrix
def laospy.influence.ActuatorInfluence.load_inverse_influence_matrix | ( | self | ) |
Loads the inverted influence matrix
def laospy.influence.ActuatorInfluence.load_inverse_influence_matrix | ( | self | ) |
Loads the inverted influence matrix
def laospy.influence.ActuatorInfluence.load_metapupil_parameters | ( | self | ) |
Loads the center position and diameter of the metapupil in actuator grid units
def laospy.influence.ActuatorInfluence.load_metapupil_parameters | ( | self | ) |
Loads the center position and diameter of the metapupil in actuator grid units
def laospy.influence.ActuatorInfluence.load_zero | ( | self | ) |
Loads the zero-response
def laospy.influence.ActuatorInfluence.load_zero | ( | self | ) |
Loads the zero-response
def laospy.influence.ActuatorInfluence.locate_actuator | ( | self, | |
display = False |
|||
) |
Locates an actuator in the responseArray If the source is FISBA, the maximum pixel in the responseArray is chosen. If the source is WFS a Gaussian is fitted to the slopes response of the actuator in the metapupil Returns ------- coordinates, array : ndarray, ndarray coordinates of the actuator and image of response
def laospy.influence.ActuatorInfluence.locate_actuator | ( | self, | |
display = False |
|||
) |
Locates an actuator in the responseArray If the source is FISBA, the maximum pixel in the responseArray is chosen. If the source is WFS a Gaussian is fitted to the slopes response of the actuator in the metapupil Returns ------- coordinates, array : ndarray, ndarray coordinates of the actuator and image of response
def laospy.influence.ActuatorInfluence.measure_all_actuators | ( | self | ) |
Measures the response of all actuators and measures zero
def laospy.influence.ActuatorInfluence.measure_all_actuators | ( | self | ) |
Measures the response of all actuators and measures zero
def laospy.influence.ActuatorInfluence.measure_response | ( | self, | |
actuatorIndex | |||
) |
Sets the current actuator and measures its response The result will be saved in the datapath
def laospy.influence.ActuatorInfluence.measure_response | ( | self, | |
actuatorIndex | |||
) |
Sets the current actuator and measures its response The result will be saved in the datapath
def laospy.influence.ActuatorInfluence.measure_zero | ( | self | ) |
@brief measures the zero-response The zero-response is the surface deviation of the DM without an actuator being pushed or pulled
def laospy.influence.ActuatorInfluence.measure_zero | ( | self | ) |
@brief measures the zero-response The zero-response is the surface deviation of the DM without an actuator being pushed or pulled
def laospy.influence.ActuatorInfluence.pull | ( | self | ) |
Pulls the current actuator.
def laospy.influence.ActuatorInfluence.pull | ( | self | ) |
Pulls the current actuator.
def laospy.influence.ActuatorInfluence.push | ( | self | ) |
Pushes the current actuator
def laospy.influence.ActuatorInfluence.push | ( | self | ) |
Pushes the current actuator
def laospy.influence.ActuatorInfluence.read_fisba_data | ( | self, | |
path | |||
) |
reads µShape binary data (.dat) into a numpy masked array The header of the file contains a counter, the number of columns and rows, the value for masked pixels, the length of the comment followed by the comment itself. The rest of the file is the array.
def laospy.influence.ActuatorInfluence.read_fisba_data | ( | self, | |
path | |||
) |
reads µShape binary data (.dat) into a numpy masked array The header of the file contains a counter, the number of columns and rows, the value for masked pixels, the length of the comment followed by the comment itself. The rest of the file is the array.
def laospy.influence.ActuatorInfluence.read_next | ( | self | ) |
Reads the next valid measurement from the source If the source is WFS, the average over INF.NUMIMAGES CCD images is returned If the source is FISBA, the next valif µShape file is returned, that for sure is contains the response to a previous DM Actuator Command. The latest existing and the next file are skipped, since the the DM actuation may have happened during the measurement.
def laospy.influence.ActuatorInfluence.read_next | ( | self | ) |
Reads the next valid measurement from the source If the source is WFS, the average over INF.NUMIMAGES CCD images is returned If the source is FISBA, the next valif µShape file is returned, that for sure is contains the response to a previous DM Actuator Command. The latest existing and the next file are skipped, since the the DM actuation may have happened during the measurement.
def laospy.influence.ActuatorInfluence.response | ( | self | ) |
Calculates the actuator's response.
def laospy.influence.ActuatorInfluence.response | ( | self | ) |
Calculates the actuator's response.
def laospy.influence.ActuatorInfluence.save | ( | self | ) |
Saves push pull and response to file.
def laospy.influence.ActuatorInfluence.save | ( | self | ) |
Saves push pull and response to file.
def laospy.influence.ActuatorInfluence.save_flat_pattern | ( | self | ) |
Saves the determined flat pattern into a FITS file, which can be imported by the Xinetics device
def laospy.influence.ActuatorInfluence.save_flat_pattern | ( | self | ) |
Saves the determined flat pattern into a FITS file, which can be imported by the Xinetics device
def laospy.influence.ActuatorInfluence.save_influence_matrix | ( | self | ) |
Saves the influence matrix
def laospy.influence.ActuatorInfluence.save_influence_matrix | ( | self | ) |
Saves the influence matrix
def laospy.influence.ActuatorInfluence.save_inverse_influence_matrix | ( | self | ) |
Saves the inverse influence matrix
def laospy.influence.ActuatorInfluence.save_inverse_influence_matrix | ( | self | ) |
Saves the inverse influence matrix
def laospy.influence.ActuatorInfluence.save_metapupil_parameters | ( | self | ) |
Saves center position and diameter of the metapupil in actuator grid units
def laospy.influence.ActuatorInfluence.save_metapupil_parameters | ( | self | ) |
Saves center position and diameter of the metapupil in actuator grid units
def laospy.influence.ActuatorInfluence.save_zero | ( | self | ) |
Saves the zero-response The zero-response is the surface deviation of the DM without an actuator being pushed or pulled
def laospy.influence.ActuatorInfluence.save_zero | ( | self | ) |
Saves the zero-response The zero-response is the surface deviation of the DM without an actuator being pushed or pulled
def laospy.influence.ActuatorInfluence.transform_into_actgrid | ( | self, | |
array | |||
) |
Transforms an array (µShape or metapupil) into the actuator grid array The FISBA measurements are stretched along one axis (setup not perpendicular to Xinetics surface). The rotation depends on the orientation of the FISBA. The measurements will be transformed into an array, that reflects the actuator grid, but oversampled by a specified factor. Parameters ---------- array : masked ndarry µShape measurement array or metapupil transform : ndarray (2x2) Result of find_actuator_space_transform() offset : ndarray (2) Result of find_actuator_space_transform()
def laospy.influence.ActuatorInfluence.transform_into_actgrid | ( | self, | |
array | |||
) |
Transforms an array (µShape or metapupil) into the actuator grid array The FISBA measurements are stretched along one axis (setup not perpendicular to Xinetics surface). The rotation depends on the orientation of the FISBA. The measurements will be transformed into an array, that reflects the actuator grid, but oversampled by a specified factor. Parameters ---------- array : masked ndarry µShape measurement array or metapupil transform : ndarray (2x2) Result of find_actuator_space_transform() offset : ndarray (2) Result of find_actuator_space_transform()
|
staticprivate |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
staticprivate |
|
private |
|
staticprivate |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
staticprivate |
laospy.influence.ActuatorInfluence.actSampling |
|
static |
laospy.influence.ActuatorInfluence.actuatorIndex |
laospy.influence.ActuatorInfluence.actuators |
laospy.influence.ActuatorInfluence.ccd |
laospy.influence.ActuatorInfluence.config |
laospy.influence.ActuatorInfluence.datapath |
laospy.influence.ActuatorInfluence.dm |
laospy.influence.ActuatorInfluence.fisbaCenter |
laospy.influence.ActuatorInfluence.fisbapath |
laospy.influence.ActuatorInfluence.fisbaRad |
|
static |
|
static |
laospy.influence.ActuatorInfluence.influenceMatrix |
laospy.influence.ActuatorInfluence.infRad |
laospy.influence.ActuatorInfluence.insideActuators |
laospy.influence.ActuatorInfluence.invInfluenceMatrix |
laospy.influence.ActuatorInfluence.numImages |
laospy.influence.ActuatorInfluence.offset |
laospy.influence.ActuatorInfluence.outsideActuators |
|
static |
laospy.influence.ActuatorInfluence.pupilCenter |
laospy.influence.ActuatorInfluence.pupilDiam |
|
static |
laospy.influence.ActuatorInfluence.pushPullVal |
|
static |
laospy.influence.ActuatorInfluence.sizexy |
laospy.influence.ActuatorInfluence.sourceIsWFS |
laospy.influence.ActuatorInfluence.transform |
laospy.influence.ActuatorInfluence.useBrim |
laospy.influence.ActuatorInfluence.wfcFileSuffix |
|
static |