pixie16.config module

Configuration management for PIXIE-16 system settings.

This module handles loading and managing configuration files that specify system paths, firmware locations, and hardware parameters. It provides platform-specific configuration directory handling and automatic migration from legacy configuration locations.

Key Features

  • Cross-platform configuration directory management

  • Automatic config file migration (appdirs -> platformdirs)

  • Hardware firmware path validation

  • SDK library path configuration

  • Default settings management

Configuration Structure

The config.ini file should contain:

[Libraries] sdk = <path to Pixie16Api.dll/library>

[Data] datadir = <data output directory>

[Firmware.default] ComFPGAConfigFile = <communication FPGA firmware> SPFPGAConfigFile = <signal processing FPGA firmware> DSPCodeFile = <DSP code file> DSPVarFile = <DSP variable file> SettingFile = <default module settings>

class pixie16.config.LocalSettings(trace_time: float = 5, mca_time: float = 30, runtime: float = 60, skip_mca: bool = False, traces: bool = False, modules: list[int] = <factory>, channels: list = <factory>)

Bases: object

Keep track of local mode and settings i.e. diagnostic MCA and traces, runtime

channels: list
mca_time: float = 30
modules: list[int]
runtime: float = 60
skip_mca: bool = False
trace_time: float = 5
traces: bool = False
pixie16.config.config_get_parameters(section: str, name: str, verbose: bool = True) None | Path

Retrieve a configuration parameter from the config file.

Extracts and validates a configuration parameter from the specified section. Provides detailed error messages with examples if the parameter is not found.

Parameters:
  • section (str) – Configuration file section name (e.g., ‘Libraries’, ‘Data’).

  • name (str) – Parameter name within the section.

  • verbose (bool, default=True) – If True, print detailed error messages and examples.

Returns:

Path object if parameter found and valid, None if missing.

Return type:

Path or None

Notes

Automatically strips quotes from path strings and converts to Path objects.

pixie16.config.get_sdk()
pixie16.config.list_firmware() None

List all firmwars defined in the config file.

pixie16.config.load_config(section_name: str) list[Path]

Load firmware, etc setting that are defined in a section of the config file.

Sections are defined with ‘Firmware.<sectionname>’.