mcetl.main_gui

Provides GUIs to import data depending on the data source used, process and/or fit the data, and save everything to Excel.

@author: Donald Erb Created on May 5, 2020

Notes

The imports for the fitting and plotting guis are within their respective functions to reduce the time it takes for this module to be imported. Likewise, openpyxl is imported within _write_to_excel.

mcetl.main_gui.SAVE_FOLDER

The file path to the folder in which all 'previous_files_{DataSource.name}.json' files are saved. Depends on operating system.

Type

pathlib.Path

Module Contents

Functions

launch_main_gui

Goes through all steps to find files, process/fit/plot the imported data, and save to Excel.

mcetl.main_gui.launch_main_gui(data_sources, fitting_mpl_params=None)

Goes through all steps to find files, process/fit/plot the imported data, and save to Excel.

Parameters
  • data_sources (list(DataSource) or tuple(DataSource) or DataSource) -- A list or tuple of mcetl.DataSource objects, or a single DataSource.

  • fitting_mpl_params (dict, optional) -- A dictionary of changes for Matplotlib's rcParams to use during fitting. If None, will use the selected DataSource's figure_rcparams attribute.

Returns

output --

A dictionary containing the following keys and values:

'dataframes': list or None

A list of lists of dataframes, with each dataframe containing the data imported from a raw data file; will be None if the function fails before importing data, or if the only processing step taken was moving files.

'fit_results': list or None

A nested list of lists of lmfit.ModelResult objects, with each ModelResult pertaining to the fitting of a data entry, each list of ModelResults containing all of the fits for a single sample, and east list of lists pertaining to the data within one dataset. Will be None if fitting is not done, or only partially filled if the fitting process ends early.

'plot_results': list or None

A list of lists, with one entry per dataset. Each interior list is composed of a matplotlib.Figure object and a dictionary of matplotlib.Axes objects. Will be None if plotting is not done, or only partially filled if the plotting process ends early.

'writer': pd.ExcelWriter or None

The pandas ExcelWriter used to create the output Excel file; will be None if the output results were not saved to Excel.

Return type

dict

Notes

The entire function is wrapped in a try-except block. If the user exits the program early by exiting out of a GUI, a custom WindowCloseError exception is thrown, which is just passed, allowing the program is close without error. If other exceptions occur, their traceback is printed.