controllers

Module Contents

Classes

IntController

LifetimeController

GroupingController

SpectraController

myPlotROI

MyCrosshairOverlay

RasterScanController

AntibunchingController

PlotFeature

FilteringController

Functions

export_plot_item(plot_item, path[, text])

Attributes

__docformat__

EXPORT_WIDTH

EXPORT_MPL_WIDTH

EXPORT_MPL_HEIGHT

EXPORT_MPL_DPI

SIG_ROI_CHANGE_THRESHOLD

logger

controllers.__docformat__ = "'NumPy'"[source]
controllers.EXPORT_WIDTH = '1500'[source]
controllers.EXPORT_MPL_WIDTH = '10'[source]
controllers.EXPORT_MPL_HEIGHT = '4.5'[source]
controllers.EXPORT_MPL_DPI = '300'[source]
controllers.SIG_ROI_CHANGE_THRESHOLD = '0.1'[source]
controllers.logger = "'controllers'"[source]
controllers.export_plot_item(plot_item: pyqtgraph.PlotItem, path: str, text: str = None)[source]
class controllers.IntController(main_window: main.MainWindow)[source]

Bases: PyQt5.QtCore.QObject

main_window[source]
resolve_mode = 'None'[source]
results_gathered = 'False'[source]
int_widget[source]
int_plot[source]
int_hist_container[source]
show_int_hist[source]
int_hist_line[source]
int_hist_widget[source]
int_hist_plot[source]
lifetime_widget[source]
lifetime_plot[source]
group_int_widget[source]
groups_int_plot[source]
groups_hist_widget[source]
groups_hist_plot[source]
int_level_info_container[source]
level_info_text[source]
int_level_line[source]
show_level_info[source]
show_exp_trace[source]
temp_fig = 'None'[source]
temp_ax = 'None'[source]
temp_bins = 'None'[source]
int_ROI[source]
confidence_index[source]
setup_plot(plot_item: pyqtgraph.PlotItem, is_int_hist: bool = False, is_group_hist: bool = False, is_lifetime: bool = False)[source]
static setup_widget(plot_widget: pyqtgraph.PlotWidget)[source]
hide_show_chb(chb_obj: PyQt5.QtWidgets.QCheckBox, show: bool)[source]
roi_chb_changed()[source]
roi_region_changed()[source]
hist_chb_changed()[source]
level_info_chb_changed()[source]
exp_trace_chb_changed()[source]
gui_apply_bin()[source]

Changes the bin size of the data of the current particle and then displays the new trace.

gui_chb_show_groups()[source]
gui_chb_show_global_groups()[source]
get_bin() int[source]

Returns current GUI value for bin size in ms.

Returns:

The value of the bin size on the GUI in spbBinSize.

Return type:

int

set_bin(new_bin: int)[source]

Sets the GUI value for the bin size in ms

Parameters:

new_bin (int) – Value to set bin size to, in ms.

gui_apply_bin_all()[source]

Changes the bin size of the data of all the particles and then displays the new trace of the current particle.

start_binall_thread(bin_size) None[source]
Parameters:

bin_size

binall_thread_complete()[source]
gui_resolve()[source]

Resolves the levels of the current particle and displays it.

gui_resolve_selected()[source]

Resolves the levels of the selected particles and displays the levels of the current particle.

gui_resolve_all()[source]

Resolves the levels of the all the particles and then displays the levels of the current particle.

plot_trace(particle: smsh5.Particle = None, for_export: bool = False, export_path: str = None, lock: bool = False) None[source]

Used to display the trace from the absolute arrival time data of the current particle.

plot_levels(particle: smsh5.Particle = None, for_export: bool = False, export_path: str = None, lock: bool = False)[source]

Used to plot the resolved intensity levels of the current particle.

plot_hist(particle: smsh5.Particle = None, for_export: bool = False, export_path: str = None, for_levels: bool = False, for_groups: bool = False)[source]
update_level_info(particle: smsh5.Particle = None)[source]
plot_group_bounds(particle: smsh5.Particle = None, for_export: bool = False, export_path: str = None, lock: bool = False)[source]
plot_all()[source]
start_resolve_thread(mode: str = 'current', thread_finished=None, end_time_s=None) None[source]

Creates a worker to resolve levels.

Depending on the current_selected_all parameter the worker will be given the necessary parameter to fit the current, selected or all particles.

Parameters:
  • end_time_s (float)

  • thread_finished

  • mode ({'current', 'selected', 'all'}) – Possible values are ‘current’ (default), ‘selected’, and ‘all’.

gather_replace_results(results: List[threads.ProcessTaskResult] | threads.ProcessTaskResult)[source]
resolve_thread_complete(thread: threads.ProcessThread)[source]
get_gui_confidence()[source]

Return current GUI value for confidence percentage.

gui_quick_roi(mode: str)[source]
any_int_plot_double_click(event: pyqtgraph.GraphicsScene.mouseEvents.MouseClickEvent)[source]
error(e)[source]
class controllers.LifetimeController(main_window: main.MainWindow)[source]

Bases: PyQt5.QtCore.QObject

all_should_apply = 'None'[source]
main_window[source]
lifetime_hist_widget[source]
life_hist_plot[source]
residual_widget[source]
residual_plot[source]
fitparamdialog[source]
fitparam[source]
irf_loaded = 'False'[source]
first = '0'[source]
startpoint = 'None'[source]
tmin = '0'[source]
temp_fig = 'None'[source]
temp_ax = 'None'[source]
setup_plot(plot: pyqtgraph.PlotItem, is_residuals: bool = False)[source]
static setup_widget(plot_widget: pyqtgraph.PlotWidget)[source]
gui_prev_lev()[source]

Moves to the previous resolves level and displays its decay curve.

gui_next_lev()[source]

Moves to the next resolves level and displays its decay curve.

gui_whole_trace()[source]

Unselects selected level and shows whole trace’s decay curve

gui_jump_to_groups()[source]
gui_show_hide_residuals()[source]
gui_load_irf()[source]

Allow the user to load a IRF instead of the IRF that has already been loaded.

add_irf(decay, t)[source]
gui_fit_param()[source]

Opens a dialog to choose the setting with which the decay curve will be fitted.

gui_fit_current()[source]

Fits the currently selected level’s decay curve using the provided settings.

gui_fit_selected()[source]

Fits the all the levels decay curves in the all the selected particles using the provided settings.

gui_fit_all()[source]

Fits the all the levels decay curves in the all the particles using the provided settings.

gui_fit_levels()[source]

Fits the all the levels decay curves for the current particle.

gui_use_roi_changed()[source]
test_need_roi_apply(particle: smsh5.Particle = None, update_buttons: bool = True)[source]
update_apply_roi_button_colors()[source]
apply_roi(particles: list)[source]
gui_apply_roi_current()[source]
gui_apply_roi_selected()[source]
gui_apply_roi_all()[source]
plot_all()[source]
update_plot_log()[source]
update_results(use_selected: bool = False, selected_level_or_group: change_point.Level | grouping.GlobalLevel | grouping.Group = None, particle: smsh5.Particle = None, for_export: bool = False, str_return: bool = False) str | None[source]
plot_decay_and_convd(particle: smsh5.Particle, export_path: str, has_groups: bool, only_groups: bool = False, lock: bool = False)[source]
plot_decay_convd_and_hist(particle: smsh5.Particle, export_path: str, has_groups: bool, only_groups: bool = False, lock: bool = False)[source]
plot_decay(selected_level_or_group: None | change_point.Level | grouping.GlobalLevel | grouping.Group = None, use_selected: bool = False, particle: smsh5.Particle = None, remove_empty: bool = False, for_export: bool = False, export_path: str = None, lock: bool = False) None[source]

Used to display the histogram of the decay data of the current particle.

plot_convd(selected_level_or_group: change_point.Level | grouping.GlobalLevel | grouping.Group = None, use_selected: bool = False, particle: smsh5.Particle = None, remove_empty: bool = False, for_export: bool = False, export_path: str = None, lock: bool = False) None[source]

Used to display the histogram of the decay data of the current particle.

plot_residuals(selected_level_or_group: change_point.Level | grouping.GlobalLevel | grouping.Group = None, use_selected: bool = False, particle: smsh5.Particle = None, for_export: bool = False, export_path: str = None, lock: bool = False) None[source]

Used to display the histogram of the decay data of the current particle.

start_fitting_thread(mode: str = 'current') None[source]

For now, doesn’t actually use threads. This is due to high memory consumption.

Depending on the current_selected_all parameter the worker will be given the necessary parameter to fit the current, selected or all particles.

Parameters:

mode ({'current', 'selected', 'all'}) – Possible values are ‘current’ (default), ‘selected’, and ‘all’.

gather_replace_results(results: List[threads.ProcessTaskResult] | threads.ProcessTaskResult)[source]
fitting_thread_complete(mode: str = None)[source]
change_irf_start(start, irf_data)[source]
set_tmin(tmin=0)[source]
show_residuals_widget(show: bool = True, lock: bool = None)[source]
error(e)[source]
class controllers.GroupingController(main_widow: main.MainWindow)[source]

Bases: PyQt5.QtCore.QObject

main_window[source]
bic_plot_widget[source]
bic_scatter_plot[source]
all_bic_plots = 'None'[source]
all_last_solutions = 'None'[source]
temp_dir = 'None'[source]
temp_fig = 'None'[source]
temp_ax = 'None'[source]
clear_bic()[source]
solution_clicked(plot, points)[source]
plot_group_bic(particle: smsh5.Particle = None, for_export: bool = False, export_path: str = None, lock: bool = False, is_global_group=False)[source]
gui_group_current()[source]
gui_group_selected()[source]
gui_group_all()[source]
gui_apply_groups_current()[source]
gui_apply_groups_selected()[source]
gui_apply_groups_all()[source]
start_grouping_thread(mode: str = 'current') None[source]

Creates a worker to resolve levels.

Depending on the current_selected_all parameter the worker will be given the necessary parameter to fit the current, selected or all particles.

Parameters:
  • thread_finished

  • mode ({'current', 'selected', 'all'}) – Possible values are ‘current’ (default), ‘selected’, and ‘all’.

gather_replace_results(results: List[threads.ProcessTaskResult] | threads.ProcessTaskResult)[source]
grouping_thread_complete(mode)[source]
check_rois_and_set_label()[source]
apply_groups(mode: str = 'current', particles=None)[source]
build_global()[source]
global_gather_replace_results(result: threads.ProcessTaskResult)[source]
global_grouping_thread_complete()[source]
start_global_grouping_thread()[source]
gui_group_global()[source]
error(e: Exception)[source]
class controllers.SpectraController(main_window: main.MainWindow)[source]

Bases: PyQt5.QtCore.QObject

main_window[source]
spectra_image_view[source]
temp_fig = 'None'[source]
temp_ax = 'None'[source]
roi_rotated = 'False'[source]
gui_sub_bkg()[source]

Used to subtract the background

slot_plot_spectra(event)[source]
gui_rot_roi()[source]

Used to rotate the ROI

set_roi_plot_ticks(wl, times)[source]
plot_spectra(particle: smsh5.Particle = None, for_export: bool = False, export_path: str = None, lock: bool = False)[source]
class controllers.myPlotROI(size)[source]

Bases: pyqtgraph.ROI

rotateSnapAngle = '90'[source]
class controllers.MyCrosshairOverlay(pos=None, size=None, **kargs)[source]

Bases: pyqtgraph.CrosshairROI

_shape = 'None'[source]
aspectLocked = 'True'[source]
class controllers.RasterScanController(main_window: main.MainWindow)[source]

Bases: PyQt5.QtCore.QObject

main_window[source]
raster_scan_image_view[source]
list_text[source]
_crosshair_item = 'None'[source]
_text_item = 'None'[source]
temp_fig = 'None'[source]
temp_ax = 'None'[source]
static create_crosshair_item(pos: Tuple[int, int], pixelsize) MyCrosshairOverlay[source]
static create_text_item(text: str, pos: Tuple[int, int]) pyqtgraph.TextItem[source]
plot_raster_scan(particle: smsh5.Particle = None, raster_scan: smsh5.RasterScan = None, for_export: bool = False, export_path: str = None, lock: bool = False)[source]
class controllers.AntibunchingController(mainwindow: main.MainWindow, corr_widget: pyqtgraph.PlotWidget, corr_sum_widget: pyqtgraph.PlotWidget)[source]

Bases: PyQt5.QtCore.QObject

property difftime[source]
main_window[source]
resolve_mode = 'None'[source]
results_gathered = 'False'[source]
corr_widget[source]
corr_plot[source]
corr_sum_widget[source]
corr_sum_plot[source]
temp_fig = 'None'[source]
temp_ax = 'None'[source]
corr = 'None'[source]
bins = 'None'[source]
irfdiff = '0'[source]
setup_plot(plot_item: pyqtgraph.PlotItem)[source]
static setup_widget(plot_widget: pyqtgraph.PlotWidget)[source]
gui_correlate_current()[source]
gui_correlate_selected()[source]
gui_correlate_all()[source]
plot_corr(particle: smsh5.Particle = None, for_export: bool = False, export_path: str = None, lock: bool = False) None[source]
plot_corr_sum()[source]
gui_curr_chb(checked)[source]
start_corr_thread(mode: str = 'current') None[source]

Creates a worker to calculate correlations.

Depending on the current_selected_all parameter the worker will be given the necessary parameter to correlate the current, selected or all particles.

Parameters:

mode ({'current', 'selected', 'all'}) – Possible values are ‘current’ (default), ‘selected’, and ‘all’.

gather_replace_results(results: List[threads.ProcessTaskResult] | threads.ProcessTaskResult)[source]
corr_thread_complete(mode: str = None)[source]
rebin_corrs()[source]
error(e)[source]
class controllers.PlotFeature[source]
PhotonNumber = "'Photon Number'"[source]
Intensity = "'Intensity'"[source]
Lifetime = "'Lifetime'"[source]
DW = "'DW'"[source]
ChiSquared = "'Chi-Squared'"[source]
IRFShift = "'IRF Shift'"[source]
classmethod get_list() list[source]
classmethod get_dict() dict[source]
class controllers.FilteringController(main_window: main.MainWindow)[source]

Bases: PyQt5.QtCore.QObject

main_window[source]
plot_widget[source]
plot[source]
option_linker[source]
current_plot_type = '(None, None)'[source]
current_particles_to_use = 'None'[source]
current_data_points_to_use = 'None'[source]
current_particles = '[]'[source]
levels_to_use = 'None'[source]
fit_result = 'None'[source]
has_fit = 'False'[source]
is_normalized = 'False'[source]
plot_pen[source]
distribution_item[source]
two_feature_item[source]
plot_fit_pen[source]
int_lifetime_fit_item[source]
filter_settings = 'None'[source]
static _get_label(feature: PlotFeature = None) tuple[source]
setup_plot(feature_x: PlotFeature, feature_y: PlotFeature = None, clear_plot: bool = True, is_first_setup: bool = False)[source]
filter_option_changed(option: str)[source]
auto_num_bins_changed()[source]
get_two_features() tuple[source]
change_plot_type(feature_x: PlotFeature | str = None, feature_y: PlotFeature | str = None)[source]
set_levels_to_use()[source]
get_data() tuple[source]
two_features_changed(x_changed: bool = None)[source]
switch_two_features()[source]
plot_features(feature_x: PlotFeature | str = None, feature_y: PlotFeature | str = None, use_current_plot: bool = False, use_selected_two_features: bool = False)[source]
static _filter_numeric_data(feature_data: numpy.ndarray, are_used_flags: List[bool], test_min: bool = False, test_max: bool = False, min_value=None, max_value=None)[source]
get_feature_data(feature: PlotFeature | str) tuple[source]
get_all_feature_data() tuple[dict[Any, dict[str, Any]], list[bool] | Any, list[bool] | Any][source]
get_all_filter() numpy.ndarray[source]
set_limits(feature_x: PlotFeature | str = None, feature_y: PlotFeature | str = None)[source]
plot_distribution()[source]
plot_two_features()[source]
prepare_plot_for_int_lifetime_fit()[source]
plot_fit_result()[source]
fit_intensity_lifetime()[source]
get_filter_settings() dict[source]
static _block_change(obj, change_method_name, value)[source]
set_filter_settings(filter_settings: dict)[source]
apply_filters()[source]
reset_filters()[source]
reset_dataset_filter()[source]
get_all_levels_with_lifetime() list[source]
reset_normalization()[source]
apply_normalization()[source]