pyatoa.core.config
Configuration of User-set parameters within the package. Contains external functions to set Config objects of Pyflex and Pyadjoint.
Module Contents
Classes
The Config class is the main interaction object between the User and |
- class pyatoa.core.config.Config(yaml_fid=None, ds=None, path=None, iteration=None, step_count=None, event_id=None, min_period=10, max_period=100, rotate_to_rtz=False, unit_output='DISP', component_list=None, adj_src_type='cc_traveltime', observed_tag='observed', synthetic_tag=None, st_obs_type='obs', st_syn_type='syn', win_amp_ratio=0.0, pyflex_parameters=None, pyadjoint_parameters=None)[source]
The Config class is the main interaction object between the User and workflow. It is used by
Manager
for workflow management, and also for information sharing between Pyatoa objects and functions. The Config can be read to and written from external files and ASDFDataSets.- __str__()[source]
String representation of the class for print statements. It separates information into similar bins for readability.
- _check()[source]
A series of sanity checks to make sure that the configuration parameters are set properly to avoid any problems throughout the workflow. Should normally be run after any parameters are changed to make sure that they are acceptable.
- _get_aux_path(default='default', separator='/')[source]
Pre-formatted path to be used for tagging and identification in ASDF dataset auxiliary data. Internal function to be called by property aux_path.
- static _check_io_format(fid, fmt=None)[source]
A simple check before reading or writing the config to determine what file format to use. Currently accepted file formats are yaml, asdf and ascii.
- write(write_to, fmt=None)[source]
Wrapper for underlying low-level write functions
- Parameters:
fmt (str) –
format to save parameters to. Available:
yaml: Write all parameters to a .yaml file which can be read later
ascii: Write parameters to a simple ascii file, not very smart and yaml is prefereable in most cases
asdf: Save the Config into an ASDFDataSet under the auxiliary data attribute
write_to (str or pyasdf.ASDFDataSet) – filename to save config to, or dataset to save to
- read(read_from, path=None, fmt=None)[source]
Wrapper for underlying low-level read functions
- Parameters:
- _write_yaml(filename)[source]
Write config parameters to a yaml file, retain order
- Parameters:
filename (str) – filename to save yaml file
- _write_asdf(ds)[source]
Save the Config values as a parameter dictionary in the ASDF Data set Converts types to play nice with ASDF Auxiliary Data. Flattens dictionaries and external Config objects for easy storage.
- Parameters:
ds (pyasdf.asdf_data_set.ASDFDataSet) – dataset to save the config file to
- _write_ascii(filename)[source]
Write the config parameters to an ascii file
- Parameters:
filename (str) – filename to write the ascii file to
- _read_yaml(filename)[source]
Read config parameters from a yaml file, parse to attributes.
- Parameters:
filename (str) – filename to save yaml file
- Return type:
- Returns:
key word arguments that do not belong to Pyatoa are passed back as a dictionary object, these are expected to be arguments that are to be used in Pyflex and Pyadjoint configs
- Raises:
ValueError – if unrecognized kwargs are found in the yaml file
- _read_asdf(ds, path)[source]
Read and set config parameters from an ASDF Dataset, assumes that all necessary parameters are located in the auxiliary data subgroup of the dataset, which will be the case if the write_to_asdf() function was used Assumes some things about the structure of the auxiliary data.
- Parameters:
ds (pyasdf.asdf_data_set.ASDFDataSet) – dataset with config parameter to read
path (str) – model number e.g. ‘m00’ or ‘default’, or ‘m00/s00’