=================== Configuration Guide =================== .. currentmodule:: spk2py.autosort.spk_config Overview -------- This class manages configurations for the AutoSort pipeline. It reads from an INI-style configuration file and provides methods to access configurations for various sections. .. moduleauthor:: Flynn O'Connell Initialize a new ``SpkConfig`` object by specifying the ``cfg_path`` parameter. If no path is provided, it defaults to a predefined location. Attributes ---------- - ``cfg_path``: Path to the configuration file, either provided by the user or a default path. - ``config``: A ``ConfigParser`` object containing the loaded configurations. - ``params``: A dictionary containing all the configuration parameters. Methods ------- get_section(section: str) Returns a dictionary containing key-value pairs for the given section. set(section: str, key: str, value: Any) Sets a value for a configuration parameter within a specified section. get_all() Returns a dictionary containing all key-value pairs from all sections. Property Methods ---------------- run Returns a dictionary containing key-value pairs for the 'run' section. path Returns a dictionary containing key-value pairs for the 'path' section. cluster Returns a dictionary containing key-value pairs for the 'cluster' section. breach Returns a dictionary containing key-value pairs for the 'breach' section. filter Returns a dictionary containing key-value pairs for the 'filter' section. spike Returns a dictionary containing key-value pairs for the 'spike' section. detection Returns a dictionary containing key-value pairs for the 'detection' section. pca Returns a dictionary containing key-value pairs for the 'pca' section. postprocess Returns a dictionary containing key-value pairs for the 'postprocess' section. INI Configuration File ---------------------- This file is the easiest entrypoint to change parameters. You can specify where this file is created with the ``cfg_path`` attribute. - ``run``: Contains runtime settings like ``resort-limit``, ``cores-used``. - ``path``: Contains path settings like directories for ``run``, ``results``. - ``cluster``: Contains clustering parameters like ``max-clusters``, ``max-iterations``. - ``breach``: Contains breach analysis parameters like ``disconnect-voltage``, ``max-breach-rate``. - ``filter``: Contains filter parameters like ``low-cutoff``, ``high-cutoff``. - ``spike``: Contains spike-extraction settings like ``pre-time``, ``post-time``. Note: All values are stored as strings due to the nature of INI files. It's up to the user to convert these to appropriate types. Example ------- .. code-block:: python cfg = SpkConfig() run = cfg.run print(type(run), run) cfg.set('run', 'resort-limit', 5) print(cfg.run['resort-limit']) See Also -------- - `configparser from python std library `_