Iguape package
Subpackages
Submodules
Iguape.Monitor module
This is Monitor Class. It was built to track and read a given Folder for new XRD Data. It’s dependent on the iguape_fileslist.txt text file. It was built to work only for Paineira XRD Data, but it can easily be adjusted for other situations.
- class Iguape.Monitor.FolderMonitor(folder_path, fit_interval=None)
Bases:
QThread
The Folder Monitor operates by tracking new or exiting data in a specified folder.
- This class inherits the QThread class from PyQt. By reading the ‘iguape_filelist.txt’ file, it can track new or existing data files in the specified folder.
Later, it reads the data and stores it in a pandas DataFrame. If a fitting interval is specified, it fits the data to a desired model and stores the fitting parameters in another DataFrame.
- Parameters
folder_path (str): Path to the data folder. fit_interval (list): 2theta interval selected to perform the peak fit.
- new_data_signal
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- run()
The run method is the main method of the FolderMonitor class. It reads the ‘iguape_filelist.txt’ file tracking all the XRD data in the folder. Then it reads the data and stores it as DataFrames. I also performs the peak fit, if a fit interval is specified.
- set_distance(distance)
Method for defining the minimum distance between the two peak centers. Only used when the model is Split PseduoVoigt.
Parameters
distance (float): The minimum distance between the two peak centers.
- set_fit_interval(interval)
Method for defining the fit interval.
Parameters
interval (list): The 2theta interval to be used for the peak fitting.
- Iguape.Monitor.counter()
Counter function. It counts the number of XRD data and returns its index.
Returns
int: Index of the XRD data.
- Iguape.Monitor.data_read(path)
Data reading function.
It reads the data from a given path and returns the 2theta and Intensity arrays, Temperature and Kelvin Signal tag.
Parameters
path (str): Path to the data file.
Returns
x (np.array): 2theta array. y (np.array): Intensity array. temp (float): Temperature. kelvin_signal (bool): Kelvin Signal tag.
- Iguape.Monitor.peak_fit(theta, intensity, interval, bkg='Linear')
Peak fitting function for the PseudoVoigt model. Given a set of 2theta and Intensity arrays, it fits the data to the PseudoVoigt model and 2theta interval selected. It returns the fitting parameters.
Parameters
theta (np.array): 2theta array. intensity (np.array): Intensity array. interval (list): 2theta interval for the peak fitting. bkg (str, optional): Background model. Default is ‘Linear’.
Returns
dois_theta_0 (float): Peak center. fwhm (float): Full Width at Half Maximum. area (float): Area under the peak. r_squared (float): R-squared value of the fit. out (lmfit.ModelResult): ModelResult. Inherited from the lmfit package. comps (dict): Fitting components such as the backgroud and model function. Inherited from the lmfit package. theta_fit (np.array): 2theta array for the fitting interval.
- Iguape.Monitor.peak_fit_split_gaussian(theta, intensity, interval, bkg='Linear', height=1000000000.0, distance=35)
Peak fitting function for the Split PseudoVoigt model. Given a set of 2theta and Intensity arrays, it fits the data to the Split PseudoVoigt model and 2theta interval selected. It returns the fitting parameters.
Parameters
theta (np.array): 2theta array. intensity (np.array): Intensity array. interval (list): 2theta interval for the peak fitting. bkg (str, optional): Background model. Default is ‘Linear’. height (float, optional): Minimum height for the peaks. Default is 1e+09. distance (float, optional): Minimum distance between the peaks. Default is 35.
Returns
dois_theta_0 (list): Peak centers. fwhm (list): Full Width at Half Maximum. area (list): Area under the peaks. r_squared (float): R-squared value of the fit. out (lmfit.ModelResult): ModelResult. Inherited from the lmfit package. comps (dict): Fitting components such as the backgroud and model function. Inherited from the lmfit package. theta_fit (np.array): 2theta array for the fitting interval.
- Iguape.Monitor.pseudo_voigt(x, amplitude, center, sigma, eta)
PseudoVoigt function, a linear combination of a Gaussian and a Lorentzian function.
x (np.array): 2theta array. amplitude (float): Peak amplitude. center (float): Peak center. sigma (float): Sigma value or standard deviation. eta (float): Eta value (mixing parameter).
np.array: PseudoVoigt function.
The PseudoVoigt function is defined as: .. math:
PV(x; A, \mu, \sigma, \eta) = \eta L(x; A, \mu, \sigma) + (1 - \eta) G(x; A, \mu, \sigma) where: - L(x; A, \mu, \sigma) is the Lorentzian function - G(x; A, \mu, \sigma) is the Gaussian function
- Iguape.Monitor.split_pseudo_voigt(x, amp1, cen1, sigma1, eta1, amp2, cen2, sigma2, eta2)
Split PseudoVoigt function, a linear combination of two PseudoVoigt functions.
x (np.array): 2theta array. amp1 (float): Peak amplitude for the first peak. cen1 (float): Peak center for the first peak. sigma1 (float): Sigma value or standard deviation for the first peak. eta1 (float): Eta value for the first peak (mixing parameter). amp2 (float): Peak amplitude for the second peak. cen2 (float): Peak center for the second peak. sigma2 (float): Sigma value or standard deviation for the second peak. eta2 (float): Eta value for the second peak (mixing parameter).
np.array: Split PseudoVoigt function.
- The Split PseudoVoigt function is defined as:
- \[SPV(x; A1, \mu1, \sigma1, \eta1, A2, \mu2, \sigma2, \eta2) = PV1(x; A1, \mu1, \sigma1, \eta1) + PV2(x; A2, \mu2, \sigma2, \eta2)\]
Iguape.iguape module
Iguape.launcher module
Execution script. It goes to the directory where Iguape is installed and it executes the program (iguape.py)
- Iguape.launcher.main()
Module contents
This is the main script for the excution of the Paineira Graphical User Interface, a GUI for visualization and data processing during in situ experiments at Paineira. In this script, both GUIs used by the program are called and all of the backend functions and processes are defined.