Configuration Guide#
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.
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: AConfigParserobject 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 likeresort-limit,cores-used.path: Contains path settings like directories forrun,results.cluster: Contains clustering parameters likemax-clusters,max-iterations.breach: Contains breach analysis parameters likedisconnect-voltage,max-breach-rate.filter: Contains filter parameters likelow-cutoff,high-cutoff.spike: Contains spike-extraction settings likepre-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#
cfg = SpkConfig()
run = cfg.run
print(type(run), run)
cfg.set('run', 'resort-limit', 5)
print(cfg.run['resort-limit'])