oasislmf.computation.data.dummy_model.generate¶
Classes¶
Generate random data for Vulnerability dummy model file. |
|
Generate random data for Events dummy model file. |
|
Generate data for Loss Factors dummy model file. |
|
Generate data for Footprint index dummy model file. |
|
Generate data for Footprint binary dummy model file. |
|
Generate data for Damage Bin Dictionary dummy model file. |
|
Generate data for Occurrence dummy model file. |
|
Generate data for Random Numbers dummy model file. |
|
Generate data for Coverages dummy model Oasis file. |
|
Generate data for Items dummy model Oasis file. |
|
Generate data for Amplifications dummy model Oasis file. |
|
Generate data for Financial Model Programme dummy model Oasis file. |
|
Generate data for Financial Model Policy dummy model Oasis file. |
|
Generate data for Financial Model Profile dummy model Oasis file. |
|
Generate data for Financial Model Cross Reference dummy model Oasis file. |
|
Generate data for Ground Up Losses Summary Cross Reference dummy model Oasis |
|
Generate data for Financial Model Summary Cross Reference dummy model Oasis |
Module Contents¶
- class oasislmf.computation.data.dummy_model.generate.VulnerabilityFile(num_vulnerabilities, num_intensity_bins, num_damage_bins, vulnerability_sparseness, random_seed, directory)[source]¶
Bases:
ModelFileGenerate random data for Vulnerability dummy model file.
This file shows the conditional distributions of damage for each intensity bin and for each vulnerability ID.
- class oasislmf.computation.data.dummy_model.generate.EventsFile(num_events, directory)[source]¶
Bases:
ModelFileGenerate random data for Events dummy model file.
This file lists event IDs to be run.
- class oasislmf.computation.data.dummy_model.generate.LossFactorsFile(num_events, num_amplifications, min_pla_factor, max_pla_factor, random_seed, directory)[source]¶
Bases:
ModelFileGenerate data for Loss Factors dummy model file.
This file maps post loss amplification/reduction loss factors to event ID-amplification ID pairs.
- class oasislmf.computation.data.dummy_model.generate.FootprintIdxFile(directory)[source]¶
Bases:
ModelFileGenerate data for Footprint index dummy model file.
The binary footprint file footprint.bin requires the index file footprint.idx.
- write_file(event_id, offset, event_size)[source]¶
Write data to output Footprint index file in binary format.
Overrides method in base class. Converts data to arguments to binary and writes to file. Called by FootprintBinFile.generate_data().
- Parameters:
event_id (int) – event ID.
offset (long long) – position of data for event ID in generated Footprint binary file relative to beginning of that file.
size (long long) – size of data corresponding to event ID in generated Footprint binary file, long long.
- class oasislmf.computation.data.dummy_model.generate.FootprintBinFile(num_events, num_areaperils, areaperils_per_event, num_intensity_bins, intensity_sparseness, no_intensity_uncertainty, random_seed, directory)[source]¶
Bases:
ModelFileGenerate data for Footprint binary dummy model file.
This file shows the intensity of a given event-areaperil combination. The binary footprint file footprint.bin requires the index file footprint.idx.
- class oasislmf.computation.data.dummy_model.generate.DamageBinDictFile(num_damage_bins, directory)[source]¶
Bases:
ModelFileGenerate data for Damage Bin Dictionary dummy model file.
This file shows the discretisation of the effective damageability cumulative distribution function.
- generate_data()[source]¶
Generate Damage Bin Dictionary dummy model file data.
First bin always runs from 0 to 0, i.e. has a midpoint (interpolation) of 0. Last bin always runs from 0 to 0, i.e. has a midpoint (interpolation) of 1.
- Yields:
bin_id (int) – damage bin ID. bin_from (float): damage bin lower limit. bin_to (float): damage bin upper limit. interpolation (float): damage bin midpoint. damage_type (int): damage_type.
- class oasislmf.computation.data.dummy_model.generate.OccurrenceFile(num_events, num_periods, random_seed, directory, mean, stddev)[source]¶
Bases:
ModelFileGenerate data for Occurrence dummy model file.
This file maps events to periods, which can represent any length of time.
- get_num_periods_from_truncated_normal_cdf[source]¶
Get number of periods from truncated normal cumulative distribution function.
- get_num_periods_from_truncated_normal_cdf()[source]¶
Get number of periods from truncated normal cumulative distribution function.
Events can occur mupltiple times over multiple periods in the occurrence file. The number of periods per event is modelled by sampling from a truncated normal distribution with mean self.mean and standard deviation self.stddev. The lower tail of the distribution is truncated at 0.5 and the cumulative distribution function is given by:
F(x) = [Phi(g(x)) - Phi(g(a))] / [Phi(g(b)) - Phi(g(a))] g(y) = (y - mean) / standard_deviation Phi(g(y)) = 1/2 * (1 + erf(g(y) / sqrt(2))) a = lower boundary = 0.5, b = upper boundary = infinity
therefore g(b) -> infinity ===> Phi(g(b)) -> 1
- Returns:
- lower boundary, when converted to an integer gives
number of periods for this event.
- Return type:
bound_a (int)
- get_num_periods_per_event()[source]¶
Get number of periods on event-by-event basis.
Determines whether sampling of truncated normal cumulative distribution function is required to obtain number of periods for this event.
- Returns:
Number of periods for this event.
- Return type:
mean|bound_a (int)
- class oasislmf.computation.data.dummy_model.generate.RandomFile(num_randoms, random_seed, directory)[source]¶
Bases:
ModelFileGenerate data for Random Numbers dummy model file.
This optional file contains random numbers for ground up loss sampling.
- class oasislmf.computation.data.dummy_model.generate.CoveragesFile(num_locations, coverages_per_location, random_seed, directory)[source]¶
Bases:
ModelFileGenerate data for Coverages dummy model Oasis file.
This file maps coverage IDs to Total Insured Values.
- class oasislmf.computation.data.dummy_model.generate.ItemsFile(num_locations, coverages_per_location, num_areaperils, num_vulnerabilities, random_seed, directory)[source]¶
Bases:
ModelFileGenerate data for Items dummy model Oasis file.
This file lists the exposure items for which ground up loss will be sampled.
- generate_data()[source]¶
Generate Items dummy model file data.
- Yields:
item (int) – item ID. item (int): coverage ID = item ID (1-1 mapping). areaperils[coverage] (int): areaperil ID corresponding to
coverage ID.
- vulnerabilities[coverage] (int): vulnerability ID corresponding to
coverage ID.
location (int): group ID mapped to location ID.
- class oasislmf.computation.data.dummy_model.generate.AmplificationsFile(num_locations, coverages_per_location, num_amplifications, random_seed, directory)[source]¶
Bases:
ModelFileGenerate data for Amplifications dummy model Oasis file.
This file maps exposure items to amplification IDs.
- class oasislmf.computation.data.dummy_model.generate.FMProgrammeFile(num_locations, coverages_per_location, directory)[source]¶
Bases:
FMFileGenerate data for Financial Model Programme dummy model Oasis file.
This file shows the level hierarchy.
- class oasislmf.computation.data.dummy_model.generate.FMPolicyTCFile(num_locations, coverages_per_location, num_layers, directory)[source]¶
Bases:
FMFileGenerate data for Financial Model Policy dummy model Oasis file.
This file shows the calculation rule (from the Financial Model Policy file) that should be applied to aggregations of loss at a particular level.
- class oasislmf.computation.data.dummy_model.generate.FMProfileFile(num_layers, directory)[source]¶
Bases:
ModelFileGenerate data for Financial Model Profile dummy model Oasis file.
This file contains the list of calculation rules with profile values used to generate insurance losses.
- generate_data()[source]¶
Generate Financial Model Profile dummy model file data.
- Yields:
profile_id (int) – profile ID. calculation rule ID (int): calculation rule ID (2 or 100). first deductible (float): first deductible (fixed at 0.0). second deductible (float): second deductible (fixed at 0.0). third deductible (float): third deductible (fixed at 0.0). attachment1 (float): attachment point/excess. limit1 (float): limit. first proportional share (float): first proportional
share (0.0 or 0.3).
- second proportional share (float): second proportional
share (fixed at 0.0).
- third proportional share (float): third proportional
share (fixed at 0.0).
- class oasislmf.computation.data.dummy_model.generate.FMXrefFile(num_locations, coverages_per_location, num_layers, directory)[source]¶
Bases:
FMFileGenerate data for Financial Model Cross Reference dummy model Oasis file.
This file shows the mapping between the financial model output ID, and aggregate and layer IDs.
- class oasislmf.computation.data.dummy_model.generate.GULSummaryXrefFile(num_locations, coverages_per_location, directory)[source]¶
Bases:
FMFileGenerate data for Ground Up Losses Summary Cross Reference dummy model Oasis file.
This file shows how item ground up losses are summed together at various summary levels in summarycalc.
- class oasislmf.computation.data.dummy_model.generate.FMSummaryXrefFile(num_locations, coverages_per_location, num_layers, directory)[source]¶
Bases:
FMFileGenerate data for Financial Model Summary Cross Reference dummy model Oasis file.
This file shows how insurance losses are summed together at various levels by summarycalc.