pyccapt.control.gui package

Submodules

pyccapt.control.gui.gui_baking module

class pyccapt.control.gui.gui_baking.BakingWindow(*args: Any, **kwargs: Any)[source]

Bases: QWidget

Initialize the BakingWindow class.

Parameters:
  • gui_baking – An instance of the GUI baking class.

  • *args – Variable length argument list.

  • **kwargs – Arbitrary keyword arguments.

closeEvent(event)[source]

Override the close event to stop the background thread and perform additional cleanup if needed.

Parameters:

event – The close event.

setWindowStyleFusion()[source]
class pyccapt.control.gui.gui_baking.Ui_Baking(variables, conf, SignalEmitter_Pumps_Vacuum, parent=None)[source]

Bases: object

Initialize the UiBaking class.

Parameters:
  • variables – Instance of variables class.

  • conf – Configuration settings.

  • parent – Parent widget (default is None).

plot()[source]

Plot function.

Parameters:

None

Returns:

None

read()[source]

Read function.

Parameters:

None

Returns:

None

retranslateUi(Baking)[source]

retranslateUi function. :param Baking: Parent widget.

Returns:

None

save_data_csv()[source]

Prompt the user for a target file and save the baking log CSV.

Pops up the OS Save-As dialog pre-filled with a sensible default filename (manual_save_<timestamp>.csv) under the existing baking-log folder. Cancel leaves nothing on disk.

setupUi(Baking)[source]

setupUi function. :param Baking: Parent widget.

Returns:

None

stop()[source]

Stop function.

Parameters:

None

Returns:

None

update_vacuum_buffer(value)[source]

Update the vacuum value in the GUI :param value: the temperature value

Returns:

None

update_vacuum_cryo_load_lock(value)[source]

Update the vacuum value in the GUI :param value: the temperature value

Returns:

None

update_vacuum_load(value)[source]

Update the vacuum value in the GUI :param value: the temperature value

Returns:

None

update_vacuum_main(value)[source]

Update the vacuum value in the GUI :param value: the temperature value

Returns:

None

pyccapt.control.gui.gui_cameras module

class pyccapt.control.gui.gui_cameras.CamerasAlignmentWindow(*args: Any, **kwargs: Any)[source]

Bases: QWidget

Initialize the CamerasAlignmentWindow class.

Parameters:
  • gui_cameras_alignment – GUI cameras alignment instance.

  • close_event – multiprocessing.Event signalled by this window when it is closed by the user.

  • command_queue – multiprocessing.Queue of typed string commands sent from the main GUI (“show”, “show_front”, “hide”).

check_if_should()[source]

Drain the command queue and dispatch each message in order.

closeEvent(event)[source]

Don’t actually close - hide the window so the subprocess stays alive and the next “open” from the main GUI is instant. Using hide() (not showMinimized) avoids leaving a leftover minimised stub in the taskbar / desktop.

setWindowStyleFusion()[source]
class pyccapt.control.gui.gui_cameras.SignalEmitter(*args: Any, **kwargs: Any)[source]

Bases: QObject

auto_exposure_time

alias of bool

cam_1_exposure_time

alias of int

cam_2_exposure_time

alias of int

cam_3_exposure_time

alias of int

cams_exposure_time_default

alias of list

default_exposure_time

alias of bool

img0_orig

alias of ndarray

img1_orig

alias of ndarray

img2_orig

alias of ndarray

class pyccapt.control.gui.gui_cameras.Ui_Cameras_Alignment(variables, conf, SignalEmitter)[source]

Bases: object

Initialize the UiCamerasAlignment class.

Parameters:
  • variables – Global experiment variables.

  • conf – Configuration data.

  • SignalEmitter – Signal emitter for communication.

auto_exposure_time_switch()[source]

Auto exposure time switch function

Args: None

Return: None

cameras_screenshot()[source]
default_exposure_time_switch()[source]

Default exposure time switch function

Args: None

Return: None

initialize_camera_thread()[source]

Initialize camera thread

Args: None

Return: None

light_switch()[source]

light switch function

Args: None

Return: None

retranslateUi(Cameras_Alignment)[source]

Args: Cameras_alignment:

Returns: None

set_default_exposure_time(exposure_time_default)[source]

Set the default exposure time

Args: exposure_time_default: Default exposure time

Return: None

setupUi(Cameras_Alignment)[source]

Set up the GUI for the Cameras Alignment window.

Args: Cameras_Alignment:

Returns: None

stop()[source]

Stop the timer and any other background processes, timers, or threads here

Args: None

Return: None

update_cam_angle_o(img)[source]
update_cam_b_o(img)[source]
update_cam_s_o(img)[source]
update_exposure_time()[source]

Update the exposure time of the cameras

Args: None

Return: None

pyccapt.control.gui.gui_cameras.run_camera_window(variables, conf, camera_closed_event, camera_command_queue)[source]

Run the Cameras window in a separate process.

Parameters:

camera_command_queue – multiprocessing.Queue of typed string commands from the main GUI (“show”, “show_front”, “hide”).

pyccapt.control.gui.gui_gates module

class pyccapt.control.gui.gui_gates.GatesWindow(*args: Any, **kwargs: Any)[source]

Bases: QWidget

Initialize the GatesWindow class.

Parameters:
  • gui_gates – GUI for gates.

  • *args – Additional arguments for QWidget initialization.

  • **kwargs

    Additional arguments for QWidget initialization.

closeEvent(event)[source]

Handle the close event of the GatesWindow.

Parameters:

event – Close event.

setWindowStyleFusion()[source]
class pyccapt.control.gui.gui_gates.Ui_Gates(variables, conf, parent=None)[source]

Bases: object

Load the GUI based on the configuration file.

Parameters:

None

Returns:

None

Load the GUI based on the configuration file.

Parameters:
  • variables (object) – Global variables

  • conf (dict) – Configuration file

  • parent (object) – Parent object

Returns:

None

error_message(message)[source]

The function for showing the error message in the GUI

Parameters:

message – The message to be shown in the GUI

Returns:

None

gates(gate_num)[source]

The function for applying the command of closing or opening gate

Parameters:

gate_num – The number of the gate to be opened or closed

Returns:

None

hideMessage()[source]

The function for hiding the error message in the GUI

Parameters:

None

Returns:

None

retranslateUi(Gates)[source]
Parameters:

Gates – The main window

Returns:

None

setupUi(Gates)[source]

Load the GUI based on the configuration file.

Parameters:

Gates (object) – Parent object

Returns:

None

stop()[source]

The function for stopping the background activity

Parameters:

None

Returns:

None

super_user_access()[source]

The function for super user access

Parameters:

None

Returns:

None

pyccapt.control.gui.gui_laser_control module

class pyccapt.control.gui.gui_laser_control.LaserControlWindow(*args: Any, **kwargs: Any)[source]

Bases: QWidget

Initialize the LaserControlWindow class.

Parameters:
  • gui_laser_control – GUI for laser control.

  • *args – Additional arguments for QWidget initialization.

  • **kwargs

    Additional arguments for QWidget initialization.

closeEvent(event)[source]

Handle the close event of the LaserControlWindow.

Parameters:

event – Close event.

setWindowStyleFusion()[source]
class pyccapt.control.gui.gui_laser_control.Ui_Laser_Control(variables, conf)[source]

Bases: object

Initialize the Ui_Laser_Control class.

Parameters:
  • variables – Global experiment variables.

  • conf – Configuration settings.

check_laser_status()[source]
error_message(message)[source]

Display an error message and start a timer to hide it after 8 seconds

Parameters:

message (str) – Error message to display

Returns:

None

get_frequency(index)[source]

Handle the close event of the changing of laser rate.

Parameters:

None

Returns:

None

hideMessage()[source]

Hide the message and stop the timer :param None:

Returns:

None

laser_divition_factor_changed()[source]

Handle the close event of the GatesWindow.

Parameters:

None

Returns:

None

laser_enable_clicked()[source]

Handle the close event of the GatesWindow.

Parameters:

None

Returns:

None

laser_listen_clicked()[source]

Handle the close event of the GatesWindow.

Parameters:

None

Returns:

None

laser_on_clicked()[source]

Handle the close event of the GatesWindow.

Parameters:

None

Returns:

None

laser_power_changed()[source]

Handle the close event of the GatesWindow.

Parameters:

None

Returns:

None

laser_rate_changed()[source]

Handle the close event of the GatesWindow.

Parameters:

None

Returns:

None

laser_standby_clicked()[source]

Handle the close event of the GatesWindow.

Parameters:

None

Returns:

None

laser_wavelegnth_changed()[source]

Handle the close event of the GatesWindow.

Parameters:

None

Returns:

None

retranslateUi(Laser_Control)[source]
setupUi(Laser_Control)[source]

Setup the GUI for the laser control. :param Laser_Control: The GUI window

Returns:

None

stop()[source]

Stop background workers and release device handles.

Called from gui_main.cleanup() when the user closes the main GUI; without this the laser status Worker QThread (while True loop) keeps running and prevents the Python process from exiting.

switch_to_cli_clicked()[source]

Operator-initiated NKTPBus -> CLI switch.

Wired to the “Switch to CLI” button (gated behind Override Access). After writing register 0x39 := 1 we try to re-open the CLI session up to CLI_SWITCH_NUM_ATTEMPTS times with CLI_SWITCH_RETRY_DELAY_S between attempts. The first attempt fairly often fails because the host-side serial driver hasn’t cleanly flipped from 115 200 baud (Interbus) to 38 400 baud (CLI); the second attempt usually succeeds.

switch_to_nktpbus_mode()[source]

Switch the laser from CLI -> NKTPBus mode.

After this returns, the CLI session is gone. The operator can either drive the laser from NKT Photonics CONTROL software (the usual reason for switching) or click the “Switch to CLI” button in this window to return to CLI mode.

CLI_SWITCH_INITIAL_DELAY_S = 1.5
CLI_SWITCH_NUM_ATTEMPTS = 3
CLI_SWITCH_RETRY_DELAY_S = 1.0
class pyccapt.control.gui.gui_laser_control.Worker(*args: Any, **kwargs: Any)[source]

Bases: QThread

Background poller for the laser status loop.

The original implementation used while True: which made it unstoppable - the parent QApplication couldn’t exit because the QThread never finished. Now an internal _stop_flag is honoured at every iteration so the main GUI’s cleanup() can shut us down.

run()[source]
stop()[source]

Request that run() exits at the next loop iteration.

pyccapt.control.gui.gui_main module

class pyccapt.control.gui.gui_main.MyPyCCAPT(*args: Any, **kwargs: Any)[source]

Bases: QMainWindow

closeEvent(event)[source]
class pyccapt.control.gui.gui_main.SignalEmitter(*args: Any, **kwargs: Any)[source]

Bases: QObject

detection_rate

alias of float

elapsed_time

alias of float

pulse_voltage

alias of float

speciemen_voltage

alias of float

total_ions

alias of int

class pyccapt.control.gui.gui_main.Ui_PyCCAPT(variables, conf, x_plot, y_plot, t_plot, main_v_dc_plot)[source]

Bases: object

Constructor for the PyCCAPT UI class.

Parameters:
  • variables (object) – Global experiment variables.

  • conf (dict) – Configuration settings.

  • parent – Parent widget (optional).

Returns:

None

about()[source]

Show the about window

Parameters:

None

Returns:

None

check_closed_events()[source]

Check if the camera window is closed

Parameters:

None

Returns:

None

cleanup()[source]

Tear down every long-lived resource so the Python process can exit.

The order matters:
  1. Stop QThreads / QTimers / device handles inside each Ui_* instance. Without this the laser Worker QThread keeps looping forever (msleep(1000)) and the SmarAct poll timers keep firing on already-closed windows.

  2. Force-close the sub-windows so their accept-paths run.

  3. Terminate worker subprocesses and wait briefly for them to die - terminate() is async, and unjoined zombie subprocesses keep the multiprocessing Manager alive, which is what makes “close” appear to do nothing.

  4. Quit the Qt event loop so app.exec() returns and __main__ can release the shared context + os._exit.

closeEvent(event)[source]
dc_hold_clicked()[source]

Hold the DC voltage

Parameters:

None

Returns:

None

error_message(message)[source]

Display an error message and start a timer to hide it after 8 seconds

Parameters:

message (str) – Error message to display

Returns:

None

hideMessage()[source]

Hide the message and stop the timer :param None:

Returns:

None

load_electrode_items(file_path)[source]
on_stop_experiment_worker()[source]

Enable the start and stop buttons after experiment is finished

Parameters:

None

Returns:

None

open_baking_win()[source]

Open baking window

Parameters:

None

Returns:

None

open_cameras_win()[source]

Open the Cameras window

Parameters:

None

Returns:

None

open_config_in_editor()[source]

Open config.toml in the system default editor.

open_data_folder()[source]

Open the experiment data folder (where HDF5 / metadata is written).

open_gates_win()[source]

Open the Gates window

Parameters:

None

Returns:

None

open_laser_control_win()[source]

Open laser control window

Parameters:

None

Returns:

None

open_project_folder()[source]

Open the pyccapt project root folder.

open_pumps_vacuum_win()[source]

Open the Pumps and Vacuum window

Parameters:

None

Returns:

None

open_stage_control_win()[source]

Open stage control window

Parameters:

None

Returns:

None

open_visualization_win()[source]

Open visualization window

Parameters:

None

Returns:

None

read_text_lines()[source]

Read the text lines and convert them to a dictionary

Parameters:

None

Returns:

None

reset_button_color(button)[source]

Reset the button color to the original color

Parameters:

button (QPushButton) – The button to reset the color

Returns:

None

reset_heatmap_clicked()[source]

Reset the heatmap :param None:

Returns:

None

retranslateUi(PyCCAPT)[source]

Retranslate the UI with the selected language

Args: PyCCAPT: Main window

Return: None

set_min_voltage_clicked()[source]

Set the minimum voltage

Parameters:

None

Returns:

None

setupUi(PyCCAPT)[source]
setup_parameters_changes()[source]

Function to set up parameters changes

Parameters:

None

Returns:

None

show_config_path()[source]
show_device_status()[source]

Pop up a quick view of which configured devices are reachable now.

show_keyboard_shortcuts()[source]
show_serial_ports()[source]
start_experiment_clicked()[source]

Start the experiment worker thread

Parameters:

None

Returns:

None

start_experiment_worker()[source]

Start the experiment worker thread

Parameters:

None

Returns:

None

statistics_update()[source]

Update the statistics

Parameters:

None

Returns:

None

stop_experiment_clicked()[source]

Stop the experiment worker thread

Parameters:

None

Returns:

None

super_user_access()[source]

The function for override access

Args: None

Returns: None

take_screenshot()[source]

Take a screenshot of the GUI

Parameters:

None

Returns:

None

update_detection_rate(value)[source]

Update the detection rate

Parameters:

value (float) – The detection rate

Returns:

None

update_elapsed_time(value)[source]

Update the speciemen voltage

Parameters:

value (float) – The speciemen voltage

Returns:

None

update_pulse_voltage(value)[source]

Update the pulse voltage

Parameters:

value (float) – The pulse voltage

Returns:

None

update_speciemen_voltage(value)[source]

Update the speciemen voltage

Parameters:

value (float) – The speciemen voltage

Returns:

None

update_total_ions(value)[source]

Update the speciemen voltage

Parameters:

value (float) – The speciemen voltage

Returns:

None

wins_init()[source]
pyccapt.control.gui.gui_main.get_package_version(package_name)[source]

pyccapt.control.gui.gui_pumps_vacuum module

class pyccapt.control.gui.gui_pumps_vacuum.PumpsVacuumWindow(*args: Any, **kwargs: Any)[source]

Bases: QWidget

Widget for Pumps and Vacuum control window.

Constructor for the PumpsVacuumWindow class.

Parameters:
  • gui_pumps_vacuum – Instance of the PumpsVacuum control.

  • signal_emitter – SignalEmitter object for communication.

  • *args – Additional positional arguments.

  • **kwargs – Additional keyword arguments.

closeEvent(event)[source]

Close event for the window.

Parameters:

event – Close event.

setWindowStyleFusion()[source]
class pyccapt.control.gui.gui_pumps_vacuum.SignalEmitter(*args: Any, **kwargs: Any)[source]

Bases: QObject

Signal emitter class for emitting signals related to vacuum and pumps control.

bool_flag_while_loop

alias of bool

temp_cryo_head

alias of float

temp_cryo_head_inside

alias of float

temp_ll

alias of float

temp_stage

alias of float

vacuum_buffer

alias of float

vacuum_buffer_back

alias of float

vacuum_cryo_load_lock

alias of float

vacuum_cryo_load_lock_back

alias of float

vacuum_load_lock

alias of float

vacuum_load_lock_back

alias of float

vacuum_main

alias of float

class pyccapt.control.gui.gui_pumps_vacuum.Ui_Pumps_Vacuum(variables, conf, SignalEmitter, parent=None)[source]

Bases: object

Constructor for the Pumps and Vacuum UI class.

Parameters:
  • variables (object) – Global experiment variables.

  • conf (dict) – Configuration settings.

  • SignalEmitter (object) – Emitter for signals.

  • parent – Parent widget (optional).

Returns:

None

error_message(message)[source]

Show the warning message :param message: the message to be shown

Returns:

None

hideMessage()[source]

Hide the warning message :param None:

Returns:

None

pump_switch_cryo_ll()[source]

Switch the pump on or off

Parameters:

None

Returns:

None

pump_switch_ll()[source]

Switch the pump on or off :param None:

Returns:

None

retranslateUi(Pumps_Vacuum)[source]

Set the text and title of the widgets :param Pumps_Vacuum: the main window

Returns:

None

setupUi(Pumps_Vacuum)[source]

Sets up the UI for the Pumps and Vacuum tab. :param Pumps_Vacuum: Pumps and Vacuum tab widget. :type Pumps_Vacuum: object

Returns:

None

stop()[source]

Stop the timer :param None:

Returns:

None

super_user_access()[source]

The function for override access

Parameters:

None

Returns:

None

update_target_temperature_cryo()[source]

Update the temperature value of the cryo head :param None:

Returns:

None

update_target_temperature_ll()[source]

Update the temperature value of the load lock :param None:

Returns:

None

update_temperature_cryo(value)[source]

Update the temperature value in the GUI :param value: the temperature value of cryo head

Returns:

None

update_temperature_cryo_inside(value)[source]

Update the temperature value of cryo head inside sensor in the GUI. :param value: the temperature value of cryo head inside

Returns:

None

update_temperature_ll(value)[source]

Update the temperature value in the GUI :param value: the temperature value of load lock

Returns:

None

update_temperature_stage(value)[source]

Update the temperature value in the GUI :param value: the temperature value of stage

Returns:

None

update_vacuum_buffer(value)[source]
update_vacuum_buffer_back(value)[source]
update_vacuum_cryo_load_lock(value)[source]
update_vacuum_cryo_load_lock_back(value)[source]
update_vacuum_load(value)[source]
update_vacuum_load_back(value)[source]
update_vacuum_main(value)[source]

pyccapt.control.gui.gui_stage_control module

class pyccapt.control.gui.gui_stage_control.StageControlWindow(*args: Any, **kwargs: Any)[source]

Bases: QWidget

closeEvent(event)[source]
setWindowStyleFusion()[source]
class pyccapt.control.gui.gui_stage_control.Ui_Stage_Control(variables, conf)[source]

Bases: object

retranslateUi(Stage_Control)[source]
setupUi(Stage_Control)[source]
stop()[source]

pyccapt.control.gui.gui_visualization module

class pyccapt.control.gui.gui_visualization.Ui_Visualization(variables, conf, x_plot, y_plot, t_plot, main_v_dc_plot)[source]

Bases: object

Constructor for the Visualization UI class.

Parameters:
  • variables (object) – Global experiment variables.

  • conf (dict) – Configuration settings.

  • x_plot (multiprocessing.Array) – Array for storing the x-axis values of the mass spectrum.

  • y_plot (multiprocessing.Array) – Array for storing the y-axis values of the mass spectrum.

  • t_plot (multiprocessing.Array) – Array for storing the time values of the mass spectrum.

  • main_v_dc_plot (multiprocessing.Array) – Array for storing the main voltage values of the mass spectrum.

dc_hold_clicked()[source]

Hold the DC voltage

Parameters:

None

Returns:

None

detection_rate_range()[source]

Change the time range of the detection rate

Parameters:

None

Returns:

None

error_message(message)[source]

Display an error message and start a timer to hide it after 8 seconds

Parameters:

message (str) – Error message to display

Returns:

None

heatmap_fdm_switch_change()[source]

No-op kept for backward compatibility.

Hitmap and FDM are now rendered side-by-side in their own panels (detector_heatmap + detector_fdm) every refresh - there is no longer anything to toggle. Any external code that still clicks the (now-hidden) heatmap_fdm_switch button just lands here harmlessly.

hideMessage()[source]

Hide the message and stop the timer :param None:

Returns:

None

parameters_changes()[source]

Change the parameters for the mass spectrum :param None:

Returns:

None

reset_heatmap()[source]

Reset the heatmap :param None:

Returns:

None

retranslateUi(Visualization)[source]

Set the text of the widgets Args: Visualization: The main window

Return: None

setupUi(Visualization)[source]

Setup the UI for the Visualization window.

Args: Visualization (QMainWindow): Visualization window.

Return: None

spectrum_last_events()[source]

Display the last events in the mass spectrum :param None:

Returns:

None

spectrum_switch_mc_tof()[source]

Switch between mass spectrum and time of flight spectrum :param None:

Returns:

None

stop()[source]

Stop any background activity :param None:

Returns:

None

uncalibrate_clicked()[source]

Toggle “Uncalibrate” state on the live spectrum.

Default = NOT pressed = show CALIBRATED data. Pressed (green) = bypass corrections, show raw mc/tof.

update_graphs()[source]

Update the graphs :param None:

Returns:

None

update_graphs_helper()[source]

Update the graphs

Parameters:

None

Returns:

None

class pyccapt.control.gui.gui_visualization.VisualizationWindow(*args: Any, **kwargs: Any)[source]

Bases: QWidget

Widget for the Visualization window.

Constructor for the VisualizationWindow class.

Parameters:
  • variables – Shared variables.

  • gui_visualization – Instance of the Visualization.

  • visualization_close_event – multiprocessing.Event signalled by this window when closed by the user.

  • command_queue – multiprocessing.Queue of typed string commands from the main GUI (“show”, “show_front”, “hide”).

check_if_should()[source]

Drain the command queue and dispatch each message in order.

closeEvent(event)[source]

Don’t actually close - hide the window so the subprocess stays alive and the next “open” from the main GUI is instant. Using hide() (not showMinimized) avoids leaving a leftover minimised stub in the taskbar / desktop.

setWindowStyleFusion()[source]
pyccapt.control.gui.gui_visualization.efficient_histogram(viz, bin_size)[source]
pyccapt.control.gui.gui_visualization.run_visualization_window(variables, conf, visualization_closed_event, visualization_command_queue, x_plot, y_plot, t_plot, main_v_dc_plot)[source]

Run the Cameras window in a separate process.

Parameters:
  • variables – Shared variables.

  • conf – Configuration dictionary.

  • visualization_closed_event – Event for the Visualization window closed.

  • visualization_win_front – Event for the Visualization window front.

  • x_plot – x plot

  • y_plot – y plot

  • t_plot – t plot

  • main_v_dc_plot – main v dc plot

Returns:

None

Module contents