oasislmf.pytools.pla.structure¶
Attributes¶
Functions¶
|
Get Post Loss Amplification (PLA) factors mapped to event ID-item ID pair. |
|
Load the correlations from the lossfactors file. |
Module Contents¶
- oasislmf.pytools.pla.structure.get_post_loss_amplification_factors(storage: oasis_data_manager.filestore.backends.base.BaseStorage, secondary_factor, ignore_file_type=set())[source]¶
Get Post Loss Amplification (PLA) factors mapped to event ID-item ID pair. Returns empty dictionary if uniform factor to apply across all losses has been given.
- lossfactors.bin is binary file with layout:
reserved header (4-byte int), event ID 1 (4-byte int), number of amplification IDs for event ID 1 (4-byte int), amplification ID 1 (4-byte int), loss factor for amplification ID 1 (4-byte float), … amplification ID n (4-byte int), loss factor for amplification ID n (4-byte float), event ID 2 (4-byte int), number of amplification IDs for event ID 2 (4-byte int), … event ID N (4-byte int), number of amplification IDs for event ID N (4-byte int), amplification ID 1 (4-byte int), loss factor for amplification ID 1 (4-byte float), … amplification ID n (4-byte int), loss factor for amplification ID n (4-byte float)
- Parameters:
storage – (BaseStorage) the storage connector for fetching the model data
secondary_factor (float) – secondary factor to apply to post loss amplification
ignore_file_type – set(str) file extension to ignore when loading
- Returns:
event ID-item ID pairs mapped to amplification IDs
- Return type:
plafactors (dict)
- oasislmf.pytools.pla.structure.read_lossfactors(run_dir='', ignore_file_type=set(), filename=PLAFACTORS_FILE, use_stdin=False)[source]¶
Load the correlations from the lossfactors file.
- Parameters:
run_dir (str) – path to lossfactors.bin file
ignore_file_type (Set[str]) – file extension to ignore when loading.
filename (str | os.PathLike) – lossfactors file name
use_stdin (bool) – Use standard input for file data, ignores run_dir/filename. Defaults to False.
- Returns:
event ID-item ID pairs mapped to amplification IDs
- Return type:
plafactors (dict)