m4.utils package¶
m4.utils.geometrical_transforms module¶
m4.utils.img_redux module¶
m4.utils.influence_functions_maker module¶
- Authors
- Selmi: written in 2019
-
class
m4.utils.influence_functions_maker.IFFunctionsMaker(deformable_mirror, interf)¶ Bases:
objectThis class is responsible for the application of zonal or global commands to the deformable mirror in order to collect the functions of influence. Data are saving in the folder corresponding to the tracking number generated
HOW TO USE IT:
creazione oggetto dm e interf from m4.influence_functions_maker import IFFunctionsMaker IFF = IFFunctionsMaker(dm, interf) tt = IFF.acq_IFFunctions(modesVectorFitsFileName, nPushPull, amplitudeFitsFileName, cmdMatrixFitsFileName, shuffle=None, template=None)
-
acq_IFFunctions(n_push_pull, amplitude_fits_file_name, cmd_matrix_fits_file_name, shuffle=None, template=None)¶ Performs the process of acquiring interferograms
Parameters: - n_push_pull (int) – number of push pull on the actuator
- amplitude_fits_file_name (string) – fits file name (Example = amp.fits)
- cmd_matrix_fits_file_name (int) – fits file name (Example = modalBase.fits)
Other Parameters: - shuffle (optional) – if not indicated, the function create the tidy command history matrix
- template (numpy array, optional) – vector composed by 1 and -1 if not indicated, the function create the vector [1, -1, 1]
Returns: tt – tracking number of measurements made
Return type: string
-
static
loadInfo(tt, fits_or_h5=0)¶ Reload information contained in fits Info file
Parameters: fits_file_name (string) – info file path Returns: - who (string) – which segment
- tt_cmdH (string) – CommandHistory tracking number
- acts_vector (numpy array) – vector of actuators
- cmd_matrix (matrix) – modal base
- cmd_ampl (numpy array) – amplitude vector
- n_push_pull (int) – number of push pull
- indexingList (list) – list of index order using in command history
-
m4.utils.optical_alignment module¶
- Authors
- Selmi: written in 2019
- modified in 2021
-
class
m4.utils.optical_alignment.OpticalAlignment(tt_cal, ott, interf)¶ Bases:
objectClass for the optical alignment
HOW TO USE IT:
from m4.utils.optical_alignment import OpticalAlignment al = OpticalAlignment(tt, ott, interf) par_command, rm_command, dove = al.opt_aligner(n_images, delay, zernike_to_be_corrected, dof_command_id)
-
getReorganizatedCommandForParAndRm(cmd, commandId=None)¶ Function that returns the command reorganized according to the selected degrees of freedom
-
getZernikeWhitAlignerObjectOptions(image)¶ Returns: - all_final_coef (numpy array) – zernike five coefficients on the image (zernike modes 2,3,4,7,8)
- final_coef_selected (numpy array) – zernike selected using intMatModesVector (zernike2control)
-
static
loadAlignmentObjectFromFits(tt)¶ Creates the object using information contained in alignment fits file
Parameters: tt (string) – tracking number Returns: theObject – opt_alignment class object Return type: ibjecct
-
opt_aligner(n_images, delay, zernike_to_be_corrected=None, dof_command_id=None)¶ Parameters: - n_images (int) – number of interferometers frames
- delay (int [s]) – delay between images
Other Parameters: - zernike_to_be_corrected (numpy array) – None is equal to np.array([0,1,2,3,4]) for tip, tilt, fuoco, coma, coma
- commandId (numpy array) – array containing the number of degrees of freedom to be commanded
- nota: gli zernike possono essere [0,1], [0,1,3,4], [0,1,2,3,4]
- e vanno in coppia con i dof [3,4], [1,2,3,4], [0,1,2,3,4]
Returns: - cmd (numpy array) – final delta command for the optical alignment
- dove (string) – file path containing measurements
-
selectModesInIntMatAndRecConstruction(zernike2control=None, commandId=None)¶ Other Parameters: - zernike2control (numpy array) – None is equal to np.array([0,1,2,3,4]) for tip, tilt, fuoco, coma, coma
- commandId (numpy array) – array containing the number of degrees of freedom to be commanded
- nota (gli zernike possono essere [0,1], [0,1,3,4], [0,1,2,3,4]) – e vanno in coppia con i dof [3,4], [1,2,3,4], [0,1,2,3,4]
-
m4.utils.optical_calibration module¶
- Authors
- Selmi: written in 2019
- modified in 2021
-
class
m4.utils.optical_calibration.OpticalCalibration(ott, interf)¶ Bases:
objectClass for the optical calibration and interaction matrix creation
HOW TO USE IT:
from m4.utils.optical_calibration import OpticalCalibration cal = OpticalCalibration(ott, interf) cal.measureAndAnalysisCalibrationMatrix(who, command_amp_vector, n_push_pull, n_frames, delay)
-
createCmatAndCmdList(command_amp_vector, dofIndex_vector)¶ Function to allow the creation of the matrix of commands and the decomposition of them in a list of commands to assign to devices
Parameters: - command_amp_vector (numpy array [mm]) – vector containing the amplitude of the commands to give degrees of freedom to calibrate
- dofIndex_vector (numpy array) – vector containing position of Dof to move in standard vector of six position for command devices
Returns: - command_matrix (numpy array) – matrix 5x5 composed using command_amp_vector values and relationship between them
- command_list (list) – decomposition of command matrix in list of command
-
getCommandMatrix()¶ Returns: commandMatrix – command matrix used for calibration Return type: numpy array
-
getCube()¶ Returns: cube – analyzed measurements Return type: numpy masked array
-
getInteractionMatrix()¶ Returns: intMat – interaction matrix Return type: numpy array
-
getMask()¶ Returns: mask – mask used for interaction matrix calculation Return type: numpy array
-
getWho()¶
-
static
loadCalibrationObjectFromFits(tt)¶ Creates the object using information contained in calibration fits file
Parameters: tt (string) – tracking number Returns: theObject – opt_calibration class object Return type: object
-
measureAndAnalysisCalibrationMatrix(who, command_amp_vector, n_push_pull, n_frames, delay)¶ Parameters: - who (string) – string indicating the optical element on which to perform the calibration cal.WHO_PAR_AND_RM for parabola and reference mirror cal.WHO_PARABLE for parabola (non implemented) cal.WHO_RM for reference mirror (not implemented) cal.WHO_M4 for deformable mirror
- command_amp_vector (numpy array [mm]) – vector containing the amplitude of the commands to give degrees of freedom to calibrate
- n_push_pull (int) – number of push pull
- n_frames (int) – number of frame for 4D measurement
Returns: tt – tracking number containing measurements and IntMat from analysis
Return type: string
-
m4.utils.parabola_identification module¶
m4.utils.roi module¶
- Authors
- Selmi: written in 2019
- rewritten in 2022
-
class
m4.utils.roi.ROI¶ Bases:
objectClass to be used for extracting regions of interest from the image.
HOW TO USE IT:
from m4.utils.roi import ROI roi = ROI()
-
automatical_roi_selection(image, segment_view, ref_mirror_in)¶ Parameters: - image (numpy masked array) – image to be analyzed
- = boolean (RM_in) – in the ott is in segment view configuration it is True, else False
- = boolean – if reference mirror is inside the image it is True, else False
-
roiGenerator(ima)¶ Parameters: ima (numpy masked array) – image Returns: roiList – list of the first 12 roi found in the image Return type: list Note
roiList[3] = RM roi for alignement, roiList[3] = central roi for segment
-