fitspy.app.callbacks module
Callback functions encapsulated in a class to interact with the GUI
- class fitspy.app.callbacks.Callbacks
Bases:
object
Callback functions to interact with the GUI of the spectra fitting appli
- spectra
List that contains all Spectrum objects
- Type:
Spectra object
- current_spectrum
The current selected spectrum to work with
- Type:
Spectrum object
- cids
connection ids that can be used with FigureCanvasBase.mpl_disconnect
- Type:
list of ints
- show_plot
Activation key for (re)plotting
- Type:
bool
- lines
Lines related to all the spectra displaying
- Type:
list of Matplotlib.Lines2D
- nearest_lines
The nearest profiles of the mouse position when clicking (limited to 10)
- Type:
list Matplotlib.Lines2D
- tmp
Annotation to display fit parameters in the plot
- Type:
matplotlib.text.Annotation
- selected_frame
Frame to enable between ‘Baseline’ and ‘Peaks’
- Type:
str
- model
Dictionary issued from a .json model reloading
- Type:
dict
- ncpus
Number of CPUs to work with in fitting. If ncpus = “auto”, determine automatically this number according to the number of spectra to handle and the number of available CPUs. if ncpus is None (default value), consider the value passed through fit_settings.params[‘ncpus’]
- Type:
int or str
- update_figure_settings()
Update figure settings
- rescale()
Rescale the figure
- outliers_calculation()
Calculate the outliers (limit)
- set_outliers_coef()
Set the outliers coefficient
- show_all()
Show all spectra and highlight spectrum on mouse over
- show_hide_results(view)
Show/Hide the ‘paramsview’ or the ‘statsview’
- save_results(dirname_res=None)
Save all results (peaks parameters) in .csv files
- load_model(fname_json=None)
Load a model from a .json file
- get_ncpus(nfiles)
Return the number of CPUs to work with
- apply_model(model_dict=None, fnames=None, fit_params=None)
Apply model to the selected spectra
- apply_model_to_all()
Apply model to the all the spectra
- messagebox_continue(fnames)
Open a messagebox if no models are found and return True/False concerning process continuation
- save(fnames, fname_json=None)
Save spectra in a .json file
- save_selection(fname_json=None)
Save selected spectra models in a .json file
- save_all(fname_json=None)
Save all spectra models in a .json file
- reload(fname_json=None)
Reload spectra models from a .json file
- plot()
Plot baseline and peak models after ‘ax’ clearing
- on_press_baseline_peaks(event)
Callback function associated to the mouse press event in the ‘Baseline’ and ‘Peaks’ LabelFrames for enabling/disabling
- baseline_is_subtracted_message()
Show an error message associated with the baseline
- add_baseline_point(x, y)
Add baseline point from the (x,y)-coordinate
- del_baseline_point(x, _)
Delete the closest baseline ‘x’-point
- apply_baseline_settings(fnames=None)
Apply baseline settings
- apply_baseline_settings_to_all()
Apply baseline settings to all the spectra
- set_baseline_settings()
Set baseline settings from the baseline to the appli
- load_baseline(fname=None)
Load a baseline from a row-column .txt file
- load_user_model(model)
Load users model from file to be added to PEAK_MODELS or BKG_MODEL
- add_peaks_point(x, y)
Add peak from the (x,y)-coordinates
- del_peaks_point(x, _)
Delete the closest peak ‘x’-point
- auto_peaks(model_name=None)
Define peaks from automatic detection
- set_bkg_model()
Set bkg_model
- update_fit_settings()
Update fit settings
- colorize_from_fit_status(fnames)
Colorize the fileselector items from the fit success status
- fit(fnames=None)
Fit the peaks
- fit_all()
Fit the peaks for all the spectra
- set_range()
Set range from the spectrum to the appli
- apply_range(fnames=None)
Set an apply range to the spectrum/spectra
- apply_range_to_all()
Set and apply range to all the spectra
- update_normalize()
Update ‘normalize’ to all the spectra
- get_value(name)
Return the float value related to the ‘name’ attribute
- update_normalize_range()
Update the normalization ranges to all the spectra
- set_normalize_settings()
Set normalize settings from the spectrum to the appli
- reinit(fnames=None)
Reinitialize the spectrum
- reinit_all()
Reinitialize all the spectra
- reassign_current_spectrum(fname)
Reassign the current spectrum from ‘fname’
- remove(delete_tabview=True)
Remove all the features (spectrum attributes, baseline, tabview)
- auto_eval(model_name=None, fnames=None)
Fit spectrum after evaluating baseline and peaks automatically
- auto_eval_all(model_name=None)
Apply automatic fitting on all spectra
- delete_all(_)
Delete all spectra
- delete(fnames=None)
Delete items from spectra selected in the ‘fileselector’ or passed as argument
- add_items_from_dir(dirname)
Add new items related to a ‘dirname’
- add_items(fnames=None)
Add new items from a ‘fnames’ list
- update_markers(fname)
Markers management in 2D-maps
- update(fname=None)
Update the appli with the spectrum selected in the ‘fileselector’ or passed as argument
- create_map(fname)
Create the 2D-map that consists in replacing the current spectra by the ones issued from the 2D-map extrusion