src.utils package¶
Subpackages¶
Submodules¶
src.utils.bit_operations module¶
- src.utils.bit_operations.bit_read(value: int, bit: int) int¶
- src.utils.bit_operations.bit_write(value: int, bit: int, bitvalue: int) int¶
- src.utils.bit_operations.flip_bits(value: int, num_bits: int = 0) int¶
src.utils.check_warning_and_interlock_trigger module¶
- src.utils.check_warning_and_interlock_trigger.check_warning_and_interlock_trigger(name: str, value: float | int, above_below_value: float | int, warning_limit: float | int, interlock_limit: float | int, enable: bool = False) int¶
src.utils.communication_helpers module¶
src.utils.get_all_routines module¶
- src.utils.get_all_routines.get_all_routines()¶
src.utils.get_local_ip module¶
- src.utils.get_local_ip.get_local_ip(use_hostname=True)¶
Get either the local mDNS hostname (hostname.local) or IP address.
- Parameters:
use_hostname (bool) – If True, returns hostname.local format. If False, returns IP address.
- Returns:
The hostname.local or IP address, or None if it couldn’t be determined.
- Return type:
str
src.utils.is_rpi module¶
- src.utils.is_rpi.is_raspberry_pi()¶
src.utils.load_config module¶
- src.utils.load_config.compare_configs(default_config: dict, override_config: dict, default_file: str, override_file: str) None¶
- src.utils.load_config.deep_update(source: dict, overrides: dict) dict¶
- src.utils.load_config.load_config(default_file='/home/runner/work/FLC/FLC/src/configs/config.default.yaml', override_file='/home/runner/work/FLC/FLC/src/configs/config.yaml')¶
src.utils.logger module¶
- class src.utils.logger.GUILogHandler(log_viewer, error_callback)¶
Bases:
HandlerLogging handler that emits log messages to the GUI. Tight coupling with LogViewer.
Parameters: - log_viewer (LogViewer): The LogViewer instance to emit logs to. - error_callback (Callable): Callback to notify of errors.
- emit(record)¶
Called when a log event is emitted.
- src.utils.logger.get_logger(name: str = 'FLC') Logger¶
Get a logger instance by name.
Parameters: - name (str): Name of the logger.
Returns: - logging.Logger: Logger instance.
- src.utils.logger.get_logger_level(logger_level_str: str) int¶
Get the logging level from a string.
Parameters: - logger_level_str (str): String representation of the logging level.
Returns: - int: Logging level.
- src.utils.logger.setup_logger(name: str = 'FLC', log_file: str = 'logs.log', level: int = 20) Logger¶
Set up and configure a logger for the project.
Parameters: - name (str): Name of the logger. - log_file (str): File where the logs will be saved. - level (int): Logging level. Defaults to INFO.
Returns: - logging.Logger: Configured logger instance.
src.utils.make_pretty_schema module¶
- src.utils.make_pretty_schema.make_pretty_schema(structured_data) str¶
src.utils.read_excel module¶
- src.utils.read_excel.get_channel(row) ChannelData¶
- src.utils.read_excel.read_excel_and_process(path_to_excel) InterfaceSchema¶
Reads the Excel file and processes the data into a structured list of ChannelData instances.
- Parameters:
path_to_excel (str) – Path to the Excel file.
- Returns:
A dictionary containing structured data for each chip type as lists of ChannelData instances.
- Return type:
dict
- src.utils.read_excel.return_all_channels(path_to_excel: str) list[ChannelData]¶
Reads the Excel file and returns a flat list of all ChannelData instances.
- Parameters:
path_to_excel (str) – Path to the Excel file.
- Returns:
A flat list of ChannelData instances.
- Return type:
list
- src.utils.read_excel.return_important_channels(path_to_excel: str) list[ChannelData]¶
Reads the Excel file and returns a flat list of important ChannelData instances.
- Parameters:
path_to_excel (str) – Path to the Excel file.
- Returns:
A flat list of important ChannelData instances.
- Return type:
list
- src.utils.read_excel.stm_read_excel_and_process(path_to_excel) STMInterfaceSchema¶
Reads the Excel file and processes the data into a structured list of ChannelData instances.
- Parameters:
path_to_excel (str) – Path to the Excel file.
- Returns:
A dictionary containing structured data for each chip type as lists of ChannelData instances.
- Return type:
dict