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

save_figures(dirname_fig=None)

Save all spectra figures in .png 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, selection=False, fit_only=False)

Apply model to the selected 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

add_baseline_point(x, y)

Add baseline point from the (x,y)-coordinate

del_baseline_point(x, _)

Delete the closest baseline ‘x’-point

update_baseline(key)

Update a baseline attribute

set_baseline()

Set baseline properties from the baseline to the appli

load_baseline(fname=None)

Load a baseline from a row-column .txt file

auto_baseline()

Define baseline from automatic points selection

subtract_baseline(fnames=None)

Subtract the current baseline

subtract_baseline_to_all()

Subtract baseline to all the spectra

delete_baseline()

Delete the current baseline

update_attractors_settings()

Update attractors settings

load_user_model(model)

Load users model from file to be added to PEAK_MODELS or BKG_MODEL

update_attractors()

Update attractors

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=None)

Colorize the fileselector items from the fit success status

fit(fnames=None, selection=True)

Fit the peaks

fit_all()

Fit the peaks for all the spectra

set_spectrum_range(delete_tabview=True)

Set range to the current spectrum

set_range()

Set range from the spectrum to the appli

apply_range_to_all()

Apply the appli range to all the spectra

normalize()

Normalize all spectra from maximum or attractor position

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