m4 package

m4.caliball_average module

Authors
    1. Pariani, R.Briguglio: written in 2016
    1. Selmi: ported to Python in 2020
class m4.caliball_average.Caliball(folder_name)

Bases: object

Class for data analysis.

HOW TO USE IT:

from m4.caliball_average import Caliball
folder_name = 'tt_rotBall_num'
cal = Caliball(folder_name)
cal.createDataForAnalysis()
r_image, std_image = cal.dataSelectionAndAnalysis()
createDataForAnalysis()

Create file fits for data analysis

Returns:self._folderName – folder name for data
Return type:string
dataSelectionAndAnalysis()

Create the plot of pixel stdev and mean after rejecting the frames whit bad mask

Returns:
  • std_image (masked array) – stdev along the sequence
  • mean_image (masked array) – mean along the sequence
pixel_std()

Create the plot of single pixel stdev and mean along the sequence

Returns:
  • std_image (masked array) – single pixel stdev along the sequence
  • mean_image (masked array) – mean along the sequence
validFrames()

Create the plot of individual RMS of each frames (without tip/tilt) together with RMS of the average frame

validMaskPoint()

Create the cumulative plot of mask valid points (valid points within each frames)

Returns:
  • bad_dataset (numpy array) – worst measurement data
  • bad_mask (numpy array) – worst mask

m4.flattening module

@author: cs

class m4.flattening.Flattenig(analyzerIFFunctions, deformableMirror)

Bases: object

Class dealing with the determination and application of the wave front flattening command.

flatCommand(wf)

Returns the command to give to the actuators to level the wf considered

flattening(command, seg)

Function for flat command application

static load(tracking_number)

Function for reload

readVMatrix()

Function that returns V matrix (892, 811) for the segment

save()

Function to save the info file

syntheticWfCreator(wf_mask, command)

Returns the synthetic wavefront using the input command and the same masked wavefront used to determine the command itself.

m4.main module

m4.main_ottProcedure module

Authors
    1. Selmi: written in 2020

List of contents:

OTT procedures
m4.main_ottProcedure.LAI_verification()
m4.main_ottProcedure.PAR_verification()
m4.main_ottProcedure.RS_verification()
m4.main_ottProcedure.SAI_verification()
m4.main_ottProcedure.SPL_verification()
m4.main_ottProcedure.acquire_IFFunction()

m4.noise module

m4.ott_calibrator_and_aligner module

Authors
    1. Selmi: written in 2019
      modified in 2021
class m4.ott_calibrator_and_aligner.OttCalibAndAlign(ott, interf)

Bases: object

Class to be used for alignment of the optical tower and the deformable mirror

HOW TO USE IT:

from m4.ott_calibrator_and_aligner import OttCalibAndAlign
from m4.configuration import start
ott, interf = start.create_ott(conf='.../youConf.yaml')
ac = OttCalibAndAlign(ott, interf)
#for PAR+RM
tt_calib = a.par_and_rm_calibrator(commandAmpVector, nPushPull, maskIndex)
par_cmd, rm_cmd = a.par_and_rm_aligner(tt_calib)
m4_aligner()

to be implemented

m4_calibrator()

to be implemented

par_and_rm_aligner(move, tt_cal, n_images, delay, zernike_to_be_corrected=None, dof_command_id=None)
Parameters:
  • move (boolean) – True to move the tower other to show commands
  • tt (string, None) – tracking number of measurement of which you want to use the interaction matrix and reconstructor
  • 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
  • dof_command_id (numpy array) – array containing the number of degrees of freedom to be commanded
Returns:

  • par_cmd (numpy array) – vector of command to apply to PAR dof
  • rm_cmd (numpy array) – vector of command to apply to RM dof

par_and_rm_calibrator(command_amp_vector, n_push_pull, n_frames, delay)

Calibration of the optical tower

Parameters:
  • command_amp_vector (numpy array) – vector containing the movement values of the 5 degrees of freedom
  • n_push_pull (int) – number of push pull for each degree of freedom
  • n_frames (int) – number of frame for 4D measurement
  • delay (int [s]) – delay between images
Returns:

tt – tracking number of measurements made

Return type:

string

m4.requirements_checker module

Authors
    1. Selmi: written in 2021

HOW TO USE IT:

from m4.main import requirements_checker as rc
rc.analysis_req(data_file_path, zernike_vector_to_subtract, step=None, offset=None)
m4.requirements_checker.analysis_req(data_file_path, zernike_vector_to_subtract, step=None, offset=None)

Analysis of noise requirements for a tn that create and use 3 different robust images. Function also crate a plot for results.

Parameters:
  • data_file_path (string) – total path for data analysis
  • zernike_vector_to_subtract (numpy array) – vector of zernike to be subtracted from robust image
Other Parameters:
 
  • step (int) – distance between patches
  • offset (if it is None data analysis is made by split n_images in two) – else re-reads the offset image saved in the tt folder and subtracts it to each image during cube creation
m4.requirements_checker.fromImagesToReq(image_list, pscale=None, step=None, n_patches=None)

Function that, given a list of images, calculates the outputs of all the required requirements

Parameters:

image_list (list) – list of image to be analyzed

Other Parameters:
 
  • pscale (int) – value of image’s pixel scale [px/m]
  • step (int) – distance between patches
  • n_patches (int) – number of patches for the second cut (if it is None sw creates a single crop in the center of the image)
Returns:

  • slop_list (list of floats) – rms slope in arcsec
  • diff_piston_list (list of numpy masked array) – differential piston on image
  • roc_list (list of floats) – roc at threshold 0.05
  • rms31 (list of floats) – rms at threshold 0.95
  • rms500 (list of floats) – rms at threshold 0.95

m4.requirements_checker.plotAndSaveForReqAnalysis(x, y, xlabel, ylabel, dove, image_name)

Function for plotting and saving results

Parameters:
  • x (numpy array) – vector for x axis
  • y (numpy array) – vector for y axis
  • xlabel (string) – label for x axis
  • ylabel (string) – label for y axis
  • dove (string) – path for saving data
  • image_name (string) – name for image to save

m4.SPL_controller module

m4.zernikeCommandTest module

Authors
    1. Selmi: written in 2020
class m4.zernikeCommandTest.ZernikeCommand(segment_roi, tt_list_for_an)

Bases: object

Class created to control Zernike modes at all m4
(6 segments at the same time)

HOW TO USE IT:

from m4.zernike_command_test import ZernikeCommand
zc = ZernikeCommand(roi[3], tt_list_for_an)
tt, surf_cube, image_cube = zc.zernikeCommandTest(zernike_modes_vector_amplitude)
analyzerResults(tt)

Compare the images obtained from the Zernike generator with those created on the segments through the function itself.

Parameters:tt (string) – tracking number of measurement
Returns:
  • diff_list = list of images obtained by subtracting zernike modes – from m4 images
  • rms = vector of rms value calculated on the difference images
readCubes(tt=None)

Reads all the cubes present in the last generated tracking number and puts them in a list.

Other Parameters:
 tt (string) – tracking number of measurement
Returns:cubeList – list of cubes
Return type:list [n_mode][pixels, pixels, segment]
readSurfM4ImageCubes(tt)
Parameters:tt (string) – tracking number of measurement
Returns:
  • zernikeSurfaceCube (numpy array [_bigDiameter, _bigDiameter, n_modes])
  • m4ImagesCube (numpy array [_bigDiameter, _bigDiameter, n_modes])
singleZernikeCommandTest(zernike_coeff_array, an_list, number_of_zernike_mode)

Chosen only one mode of Zernike I apply it to all segments and I return the total mode command from the measurement.

Parameters:
  • zernike_coeff_array (numpy array) – vector containing the amplitude of the mode to create located in the its corresponding position exemple: np.array([z2, z3, z4….])
  • an_list (list) – list of the 6 object an
  • number_of_zernike_mode (int) – zernike mode to measure
Returns:

  • surface_map (numpy array) – zernike mode surface map
  • totalModeCommand (numpy array) – vector of 5253 elements

zernikeCommandForSegment(surface_map, segment_number, an)

Calculate the command of the chosen mode to give to the segment.

Parameters:
  • surface_map (numpy array) – zernike mode surface map on big image
  • segment_number (int) – number of the chosen segment
  • an (object) – object analyzer
Returns:

command_for_segment – vector of 892 element containing the segment’s command

Return type:

numpy array

zernikeCommandTest(zernike_modes_vector_amplitude)
Parameters:zernike_modes_vector_amplitude (numpy array) – vector of amplitude of zernike modes to be test, starting from z=2
Returns:
  • tt (string) – tracking number for the measurement
  • zernikeSurfaceCube (numpy array [512, 512, n_modes]) – all zernike surface generated on M4
  • m4ImagesCube (numpy array [512, 512, n_modes]) – cube consisting of the 6 images of the segments

Subpackages

Module contents

Auhtors
    1. Selmi: