pyccapt.control.core package

Submodules

pyccapt.control.core.baking_loging module

pyccapt.control.core.baking_loging.animate(i)[source]

Animation function for plotting.

pyccapt.control.core.baking_loging.daq_tc()[source]

This function performs DAQ operations related to temperature measurement and control.

pyccapt.control.core.baking_loging.plot_baking(df, window=0)[source]

Plot baking data.

pyccapt.control.core.baking_loging.read()[source]

This function reads data from sensors and logs it.

pyccapt.control.core.com_ports module

pyccapt.control.core.com_ports.list_com_ports()[source]

List all available COM ports on the system.

Parameters:

None

Returns:

A list of available COM ports.

Return type:

list

pyccapt.control.core.control_data_tool module

pyccapt.control.core.control_data_tool.concatenate_datasets(hdf5_file_path_1, hdf_file_path_2, index_2)[source]

Concatenate datasets in nested HDF5 groups.

pyccapt.control.core.control_data_tool.copy_npy_to_hdf_surface_concept(path, hdf5_file_name)[source]

copy npy data to hdf5 file for surface concept TDC

Parameters:
  • path – path to the npy files

  • hdf5_file_name – name of the hdf5 file

Returns:

None

pyccapt.control.core.control_data_tool.correct_surface_concept_old_data(hdf5_file_path)[source]

correct surface concept old data

Parameters:

hdf5_file_path – path to the hdf5 file

Returns:

None

pyccapt.control.core.control_data_tool.crop_dataset_to_new_file(original_path, new_path, num_of_samples)[source]

Crop dataset and save to a new file.

Parameters:
  • original_path – Path to the original dataset.

  • new_path – Path to save the cropped dataset.

  • num_of_samples – Number of samples to keep.

Returns:

None

pyccapt.control.core.control_data_tool.load_and_copy_chunks_to_hdf(path, hdf5_file_path, chunk_id)[source]
pyccapt.control.core.control_data_tool.rename_subcategory(hdf5_file_path, old_name, new_name)[source]

rename subcategory

Parameters:
  • hdf5_file_path – path to the hdf5 file

  • old_name – old name of the subcategory

  • new_name – new name of the subcategory

Returns:

None

pyccapt.control.core.experiment_statistics module

pyccapt.control.core.experiment_statistics.save_statistics_apt(variables, conf)[source]

Save setup parameters and run statistics in a text file.

Parameters:
  • variables (object) – An object containing experiment variables.

  • conf (dict) – A dictionary containing the configuration file parameters.

Returns:

None

pyccapt.control.core.hdf5_creator module

pyccapt.control.core.hdf5_creator.hdf_creator(variables, conf, time_counter, time_ex)[source]

Save experiment data to an HDF5 file.

Parameters:
  • variables (object) – An object containing experiment variables.

  • conf (dict) – A dictionary containing configuration settings.

  • time_counter (list) – A list of time counter data.

  • time_ex (list) – A list of timestamp of iteration.

Returns:

None

pyccapt.control.core.loggi module

pyccapt.control.core.loggi.logger_creator(script_name, variables, log_name, path)[source]

Create and configure a logger object for logging.

This function uses the native Python logging library to create a logger object that can be used to log statements of different levels.

Parameters:
  • script_name (str) – The name of the script using the logger.

  • variables (object) – An object containing relevant variables.

  • log_name (str) – The name of the log file.

  • path (str) – The path to the log directory.

Returns:

The configured logger object.

Return type:

logging.Logger

pyccapt.control.core.read_files module

File-loading helpers for the control package.

pyccapt.control.core.read_files.load_config_file(config_file_path: str | Path) dict[str, Any][source]

Load a control configuration file from .toml.

Parameters:

config_file_path – Absolute or relative path to the config file.

Returns:

Parsed config dictionary.

Raises:

ValueError – If file extension is unsupported.

pyccapt.control.core.read_files.normalize_control_config(config: dict[str, Any]) dict[str, Any][source]

Normalize supported control config toggle aliases to legacy values.

pyccapt.control.core.read_files.read_json_file(json_file_path: str | Path) dict[str, Any][source]

Read a JSON file and return its content as a dictionary.

Parameters:

json_file_path – Absolute or relative path to the JSON file.

Returns:

Parsed JSON content.

Raises:
pyccapt.control.core.read_files.read_toml_file(toml_file_path: str | Path) dict[str, Any][source]

Read a TOML file and return its content as a dictionary.

Parameters:

toml_file_path – Absolute or relative path to the TOML file.

Returns:

Parsed TOML content.

Raises:

pyccapt.control.core.share_variables module

Shared process-safe variables used by the control module.

class pyccapt.control.core.share_variables.Variables(conf: Mapping[str, Any], namespace: Any)[source]

Bases: object

Expose shared experiment state through a manager-backed namespace.

The class keeps backward compatibility with existing variables.<name> access while removing thousands of lines of repetitive property code.

clear_to(variable_name: str) None[source]

Clear a shared list attribute by replacing it with an empty list.

extend_to(variable_name: str, value: Iterable[Any]) None[source]

Extend a shared list attribute with iterable values.

snapshot() dict[str, Any][source]

Return a shallow snapshot of all currently known shared fields.

pyccapt.control.core.tof2mc_simple module

pyccapt.control.core.tof2mc_simple.tof_2_mc(t, t0, V, xDet, yDet, flightPathLength)[source]

Calculate the m/c for

Parameters:
  • t (float) – Time in ns.

  • t0 (float) – T0 correction in ns.

  • V (float) – Voltage.

  • xDet (float) – X-coordinate of the detector in cm.

  • yDet (float) – Y-coordinate of the detector in cm.

  • flightPathLength (float) – Flight path length in mm.

Returns:

Calculated m/c value.

Return type:

float

Module contents