Imagings code
Architecture
The Imagings folder is defined as a module loaded in CAtImaPy main code.
The code used to acquire, analyze, plot and save series of measurements is included in the class ImagingClass described below.
This class defines the Imaging object, attribute of mainWin.
The Imaging object contains the information over a measurement and is saved in string and pickle formats
in ‘.txt’ and ‘.imo’ files respectively.
Fitting of functions performed in ImagingClass methods uses the sub-module fittool.
In this module, the FitUtility performs the fit of a function (instance of FitFunction) on the data.
The defined functions available for fitting are listed in fitFunctionsList variable.
ImagingsClass
- class Imagings.ImagingClass(dirAndFileName='', mplwidgetImage=None, mplwidgetAnalysisGraph=None)[source]
Bases:
objectClass of Imaging object : the center object for aquisition, analysis and saving
- __init__(dirAndFileName='', mplwidgetImage=None, mplwidgetAnalysisGraph=None)[source]
Initialize the Imaging object
- Keyword Arguments:
dirAndFileName='' (str) – Absolute path file name with appended number but without extension
mplwidgetImage=None (None or UImatplotlibWidget) – to plot images or atomic density on UI left graph
mplwidgetAnalysisGraph=None (None or UImatplotlibWidget) – to plot analysis on UI right graph
- Returns:
ImagingClass object
- atom_imaging(Camera, averages=1)[source]
Do one point measurements and analysis
- Parameters:
Camera (CameraClass) – Camera object
- Keyword Arguments:
averages=1 (int) – number of averages
- Returns:
If scan performed normally (bool)
- fit_Atomic_Cloud_1D(atomicDensityIntZperum2, ROIi, plotFit1D=False)[source]
- Make fits for estimation of cloud radii, positions with Gaussian functions.
Fits are done on data integrated along one axis. Fits are done a second time with adjusted position and integration width dependin on other axis results.
- Parameters:
atomicDensityIntZperum2 (2D numpy array float) – measured atomic density data
ROIi (int) – analysis ROI index (relative to ROI Tabs)
- Keyword Arguments:
False (plotFit1D =) – If True, open window to show the 1D fits
- Returns:
4-Tuple of 2-list with fit results where the axes are [Y, X]
- Return type:
cloudRadiipx, cloudPositionspx, cloudRadiium, cloudPositionsum
- fit_LT_measurement(ui)[source]
Fit exponential atom number decay for lifetime measurement
- Parameters:
ui (UI.Ui_MainWindow) – GUI object to collect and pass variables and graphs
- fit_T_measurement(ui)[source]
Fit results of time of flight scan for temperature measurement
- Parameters:
ui (UI.Ui_MainWindow) – GUI object to collect and pass variables and graphs
- imaging_scan(Camera, ui)[source]
Do a standard scan of acquistion and analysis (Imaging tab)
- Parameters:
Camera (CameraClass) – Camera object
ui (UI.Ui_MainWindow) – GUI object to collect and pass variables and graphs
- Returns:
If scan performed normally (bool)
- imaging_scan_measurement(Camera, ui, averages=1, scans=1)[source]
Do a one-axis scan of measurements and analysis
- Parameters:
Camera (CameraClass) – Camera object
ui (UI.Ui_MainWindow) – GUI object to collect and pass variables and graphs
- Keyword Arguments:
- Returns:
If scan performed normally (bool)
- lifetime_measurement_scan(Camera, ui)[source]
Do a scan of lifetime measurements and analysis (Lifetime tab)
- Parameters:
Camera (CameraClass) – Camera object
ui (UI.Ui_MainWindow) – GUI object to collect and pass variables and graphs
- Returns:
If scan performed normally (bool)
- load_imaging_vars_from_dict(dirAndFileName)[source]
Load Imaging object variable from dictionary saved in file
- Parameters:
dirAndFileName (str) – Absolute path file name with appended number but without extension
- plot_2Ddata_on_mplwidgetImage(data2D, title='Atomic density [atoms/micron^2]')[source]
Show 2Ddata on the left graph in jet colorscale.
- Parameters:
data2D (2D numpy array) – 2D data to plot
- Keyword Arguments:
[atoms/micron^2]' (title = 'Atomic density) – Title for the left graph
- plot_Image_on_mplwidgetImage(imageToPlot, title='Camera image')[source]
Show a camera image on the left graph in grey colorscale.
- Parameters:
imageToPlot (2D numpy array) – image to plot
- Keyword Arguments:
image' (title = 'Camera) – Title for the left graph
- print_dict_full(d, indentation=0)[source]
Returns a string representation of the content of a dictionary for saving.
No line limits, arrays limited to 10000 elements
- save_images(dirAndFileNameImages, saveImagesFormat=None)[source]
Save images taken during last atom_imaging.
- save_images_during_atom_imaging(averages=1)[source]
Save images automatically (called in atom imaging).
- save_imaging_vars_as_dict(dirAndFileName=None, SaveAtomicDensity=True)[source]
Save Imaging object as a dictionnary
Save two files : one ‘.txt’ without 2D data and one ‘.imo’ (binary pickle format) 2D data is not saved except atomic density if asked
- set_Imaging_variables_from_cam(Camera)[source]
Initialize some Imaging object variables from the Camera object variables
- Parameters:
Camera (CameraClass) – Camera object
- set_ROIs_from_ROIarray(ROIarray)[source]
Refresh analysis ROI defintions from ROIarray loaded from UI
- Parameters:
ROIarray (numpy array 6*n dtype = str) – analysis ROI defintions
- temperature_measurement_scan(Camera, ui)[source]
Do a scan of temperature measurements and analysis (Temperature tab)
- Parameters:
Camera (CameraClass) – Camera object
ui (UI.Ui_MainWindow) – GUI object to collect and pass variables and graphs
- Returns:
If scan performed normally (bool)
Fitting
- class Imagings.fittool.FitUtility(x, y, fitFunction, yerr=None, p_in=None, p_fix=None, NumberOfSteps=None, printbool=False)[source]
Bases:
objectClass to fit function to data.
- __init__(x, y, fitFunction, yerr=None, p_in=None, p_fix=None, NumberOfSteps=None, printbool=False)[source]
Initialize class instance and fit function to data
- Parameters:
x (list or np.array or None) – x vector of data to fit. If None, then x=np.arange(len(y)).
y (list or np.array) – y vector of data to fit.
fitFunction (FitFunction) – the function to fit to data.
- Keyword Arguments:
yerr (list or np.array or None) – the error in the y vector.
p_in (list or None) – initial fit parameters.
p_fix (list or None) – array of strings or values.
NumberOfSteps (int or None) – number how many y-fitted points will generated for plotting arrays xfit and yfit. If None, NumberOfSteps = len(y).
printbool (bool) – if the parameters info of the fit should be printed.