m4.analyzers package¶
m4.analyzers.accelerometers_data_analyzer module¶
- Authors
- Selmi: written in 2021
-
class
m4.analyzers.accelerometers_data_analyzer.AccelerometersDataAnalyzer(tt)¶ Bases:
objectClass used to analyze accelerometer data
HOW TO USE IT:
from m4.analyzers.accelerometers_data_analyzer import AccelerometersDataAnalyzer tt = 'tracking_numeber' acc = AccelerometersDataAnalyzer(tt)
-
getData()¶ Function for getting data in tracking number folder
-
getSpecAndFreq()¶ Function that returns data spectrum and frequency
-
plot_power_spectrum()¶ Function for displaying power spectrum
-
readAndShow()¶ Function for calculation and displaying power spectrum from accelerometers data
-
m4.analyzers.analyzer_iffunctions module¶
- Authors
- Selmi: written in 2019
-
class
m4.analyzers.analyzer_iffunctions.AnalyzerIFF¶ Bases:
objectThis class analyzes the measurements made through the IFF class by generating the cube of measurements and calculating interaction matrix and reconstructor.
HOW TO USE IT:
from m4.analyzers.analyzer_iffunctions import AnalyzerIFF fileName = os.path.join(".../IFFunctions", tt) an = AnalyzerIFF.loadInfoFromTtFolder(fileName) cube = an.createCube(tiptiltDetrend = None, phaseAmbiguity = None) an.saveCubeAsFits(cubeName)
-
createCubeFromImageFolder(data_file_path=None, tiptilt_detrend=None, phase_ambiguity=None)¶ Parameters: data_file_path (string) – measurement data file path
Other Parameters: - ttDetrend (optional) – in the creation of the cube the images are reduced removing tip tilt on the central segment
- phaseSolve (optional)
Returns: cube from analysis
Return type: cube = masked array [pixels, pixels, number of images]
-
getAnalysisMask()¶ Returns: analysis_mask Return type: numpy array [pixels, pixels]
-
getCube()¶ Returns: cube – cube from analysis Return type: masked array [pixels, pixels, number of images]
-
getInteractionMatrix()¶ Returns: intMat – interaction matrix from cube Return type: numpy array
-
getMasterMask()¶ Returns: master_mask – product of the masks of the cube Return type: [pixels, pixels]
-
getReconstructor()¶ Returns: reconstructor calculated as pseudo inverse of the interaction matrix Return type: rec = numpy array
-
static
loadAnalyzer(file_name, fits_or_h5=0)¶ Creates the object using information contained in Cube
Parameters: fits_file_name (string) – cube file name path Returns: theObject – analyzerIFF class object Return type: object
-
static
loadInfoFromIFFsTtFolder(tt)¶ Creates the object using information about path measurements
Parameters: tt (string) – measurement tracking number Returns: theObject – analyzerIFF class object Return type: object
-
saveCube(cube_name, fits_or_h5=0)¶ Parameters: cube_name (string) – name to save the cube example ‘Cube.fits’
-
setAnalysisMask(analysis_mask)¶ Set the analysis mask chosen
Parameters: analysis_mask (numpy array [pixels, pixels]) –
-
setAnalysisMaskFromMasterMask()¶ Set the analysis mask using the master mask of analysis cube
-
setDetectorMask(mask_from_ima)¶ Set the detector mask chosen
Parameters: detector_mask (numpy array [pixels, pixels]) –
-
m4.analyzers.noise_data_analyzer module¶
m4.analyzers.requirement_analyzer module¶
- Authors
- Selmi: written in October 2020
-
m4.analyzers.requirement_analyzer.curv_fit_v2(image, platescale_px_mm)¶ Parameters: - image (masked array) – image for the analysis
- platescale_px_mm (double) – platescale in pixel / mm
Returns: - alpha (float) – analytical coefficient of scalloping
- beta (float) – analytical coefficient of scalloping
-
m4.analyzers.requirement_analyzer.diffPiston(image)¶ Parameters: image (masked array) – image for the analysis Returns: diff_piston Return type: numpy masked array
-
m4.analyzers.requirement_analyzer.imageOpticOffset(data_file_path, start, stop)¶ Parameters: - data_file_path (string) – data file path for measurement to analyze
- start (int) – number of first image to use for the data analysis
- stop (int) – last number of measurement to use
Returns: image – mean image of the selected data
Return type: numpy masked array
-
m4.analyzers.requirement_analyzer.patches_analysis(image, radius_m, pixelscale=None, step=None, n_patches=None)¶ Parameters: - image (masked array) – image for the analysis
- radius_m (int) – radius of circular patch in meters
Other Parameters: - pixelscale (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: - req (float) – roc at threshold 0.05 or rms at threshold 0.95
- list_ima (list) – list of images used for the analysis
- result_vect (numpy array) – vector containing the test analysis results
-
m4.analyzers.requirement_analyzer.robustImageFromDataSet(n_images, data_file_path, zernike_vector_to_subtract, offset=None)¶ From fits files and whit offset subtraction
Parameters: - n_images (int) – number of images to analyze
- path (string) – total path for data analysis
Other Parameters: 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
Returns: robust_image – robust image from data set
Return type: numpy masked array
-
m4.analyzers.requirement_analyzer.roc(alpha, beta)¶ Parameters: - test_diameter (int) – diameter for xy coordinates
- alpha (float) – analytical coefficient of scalloping
- beta (float) – analytical coefficient of scalloping
Returns: raggio – radius of curvature
Return type: float
-
m4.analyzers.requirement_analyzer.slope(image, pscale)¶ Parameters: - image (masked array) – image for the analysis
- pscale (float) – pixel scale of image [px/m]
Returns: slope
Return type: numpy masked array
-
m4.analyzers.requirement_analyzer.test242(image, pscale=None)¶ Parameters: image (masked array) – robust image for the analysis Returns: rms – rms slope in arcsec Return type: float
-
m4.analyzers.requirement_analyzer.test243(image, radius_m, pscale=None, step=None, n_patches=None)¶ Return rms at the interactuator scale 31 mm or 150 mm (thresh = 0.95)
Parameters: - image (masked array) – robust image for the analysis
- radius_m (int) – radius of circular patch in meters
Other Parameters: - 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: rms – rms at threshold 0.95
Return type: float
-
m4.analyzers.requirement_analyzer.test283(image, pscale=None, step=None)¶ Return roc on 80 mm spatial scale (thresh = 0.05)
Parameters: image (masked array) – robust image for the analysis Other Parameters: step (int) – distance between patches Returns: roc – roc at threshold 0.05 Return type: float
-
m4.analyzers.requirement_analyzer.tiptilt_fit(ima)¶ Parameters: image (masked array) – Returns: ima_ttr – image without tip and tilt Return type: numpy masked array