rfwtools.config.Config
- class rfwtools.config.Config[source]
Bases:
objectA singleton class for containing application configuration. Written as a singleton to enable easy extension.
- instance
The internal configuration object.
- app_dir
A string defining the root directory of the application. Currently used in initial setup only. Defaults to the current working directory.
- data_dir
A string defining the path to waveform data. Defaults to CWD/data/waveforms/data/rf.
- debug
A boolean that controls debug output. Defaults to False (meaning no debug output).
- label_dir
A string defining the directory that holds label files. Defaults to CWD/data/labels
- output_dir
A string defining the directory to read/write saved files produced by this package. Defaults to CWD/processed-output.
- exclude_zones
A list of strings that define zones to exclude from parsing operations. Defaults to [‘0L04’]
- exclude_times
A list of 2-tuples of datetime.datetime objects. Each tuple is a range of time to exclude from analysis. Both endpoints are inclusive, and a value of None is interpreted as +/- Inf. Defaults to None.
- data_server
A string for the server hostname to contact for the web-based data API. Defaults to accweb.acc.jlab.org.
- wfb_base_url
A string that is the base URL (context root) of the waveform browser web app. Defaults to wfbrowser.
Methods
__init__()Only make an instance of the inner Config object if its missing
Write config out to a YAML formatted string.
load_yaml_string(string)Read in a YAML formatted string containing configuration information.
read_config_file([file])Parses a YAML-formatted config file and updates internal configuration.
write_config_file(file)Writes out the current configuration to the specified file.
Attributes
- static dump_yaml_string()[source]
Write config out to a YAML formatted string.
Note: the nested Class causes trouble with pickle so this is a reasonable alternative in most scenarioes.
- Return type:
str- Returns:
The YAML-formatted configuration string.
- static load_yaml_string(string)[source]
Read in a YAML formatted string containing configuration information.
This method overwrites only the values defined in the string.
- Parameters:
string (
str) – The YAML-formatted string to parse.- Return type:
None
- static read_config_file(file=None)[source]
Parses a YAML-formatted config file and updates internal configuration.
Relative files will be considered relative to the current working directory.
- Parameters:
file (
Optional[str]) – Path to the file to read. Relative paths are considered as relative to the current working directory. Default value is rfwtools.cfg- Return type:
None