Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introducing gulmc: full monte carlo loss engine #1137

Merged
merged 79 commits into from
Dec 8, 2022
Merged
Changes from 1 commit
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
26ed229
[mcgul] first implementation of full MC gul
mtazzari Oct 12, 2022
6587122
[modelpy] montecarlo implementation in modelpy
mtazzari Oct 13, 2022
9f1468f
stop tracking mcgul
mtazzari Oct 13, 2022
f90ec6a
[modelpy] fixes
mtazzari Oct 13, 2022
6a4f5a3
simplify algorithm
mtazzari Oct 13, 2022
94acf96
remove unused imports
mtazzari Oct 13, 2022
10fc8e8
use numba, process last areaperil id, cleanup
mtazzari Oct 14, 2022
15f1954
[modelpy] add docstrings
mtazzari Oct 14, 2022
d64c1ff
[modelpy] function namechange
mtazzari Oct 14, 2022
6a5c0fa
[modelpy] add TODOs not to forget
mtazzari Oct 14, 2022
8e35fd2
[gulpy] bugfix in calling read_getmodel_data
mtazzari Oct 14, 2022
3d4ebf5
[gulpy] drafting monte carlo implementation
mtazzari Oct 18, 2022
20704ab
[mcgul] Add major modelpy and gulpy rewrite as one tool
mtazzari Oct 21, 2022
5dec3ab
[mcgul] do not sample haz if no haz uncertainty
mtazzari Oct 21, 2022
4443888
[mcgul] cleanup
mtazzari Oct 21, 2022
bc3f3e4
[mcgul] good working implementation
mtazzari Oct 24, 2022
36d1a56
[mcgul] perfectly reproduces effective damageability
mtazzari Oct 24, 2022
dd914f5
[mcgul] further simplification
mtazzari Oct 24, 2022
7431a6e
[mcgul] wip
mtazzari Oct 25, 2022
bcda3c1
[mcgul] compute haz cdf in map_areaperil_ids_in_footprint
mtazzari Oct 25, 2022
e29b09c
[gulmc] update cli
mtazzari Oct 25, 2022
623672a
[getmodel] reverting full mc modifications
mtazzari Oct 25, 2022
05d4b16
[gul] reverting mc modifications
mtazzari Oct 25, 2022
84caafc
[getmodel] reverting mc modifications
mtazzari Oct 25, 2022
238b803
[getmodel] Reverting unused mc modifications
mtazzari Oct 25, 2022
bb0faf4
[gul] updating docstring
mtazzari Oct 25, 2022
b6690db
[getmode;] update docstring
mtazzari Oct 25, 2022
f01ce52
[gulmc] dynamic buff_size
mtazzari Oct 26, 2022
7e85363
[gulmc] imports cleanup
mtazzari Oct 26, 2022
a78b4e1
[gulmc] cleanup
mtazzari Oct 26, 2022
e0cf96c
[gulmc] dynamic buff size
mtazzari Nov 1, 2022
3ff5e26
[gulmc] compute effective damageability
mtazzari Nov 1, 2022
b884c83
[gulmc] effective damageability with numba
mtazzari Nov 1, 2022
05008ab
Merge branch 'develop' into feature/gulmc
mtazzari Nov 1, 2022
7b036c4
[gulpy] minor bugfix
mtazzari Nov 1, 2022
4d5275d
[gulmc] bugfix: use 4 as item size in int32_mv
mtazzari Nov 4, 2022
ac94e0c
[gulmc] minor cleanup
mtazzari Nov 4, 2022
28e5209
[gulmc] fix conflicts with stashed edits
mtazzari Nov 4, 2022
50517c6
Merge branch 'develop' into feature/gulmc
mtazzari Nov 7, 2022
4989962
[gulmc] cleanup
mtazzari Nov 8, 2022
5d32e90
Merge branch 'develop' into feature/gulmc
mtazzari Nov 11, 2022
7342153
[gulmc] remove unused imports
mtazzari Nov 14, 2022
40ceb1b
[modelpy] remove one blank line
mtazzari Nov 14, 2022
a0eccfe
[gulmc] add effective_damageability optional arg
mtazzari Nov 16, 2022
68e8dd0
[gulmc] bugfix effective damageability
mtazzari Nov 17, 2022
3573331
[gulmc] add tests
mtazzari Nov 17, 2022
ab8db52
[gulmc] add tests for effective damageability
mtazzari Nov 17, 2022
4925111
[gulmc] move gulpy tests to separate module
mtazzari Nov 17, 2022
3547c84
[tests] add test_model_1 to the tests assets
mtazzari Nov 17, 2022
a2919d4
[tests] use typing.Tuple for type hints
mtazzari Nov 17, 2022
be0e4bf
[gulmc] better tests, tiv set to float64
mtazzari Nov 21, 2022
31b5895
[gulmc] log info about effective_damageabilty
mtazzari Nov 21, 2022
5657157
[gulmc] cleaning up, adding docs (WIP).
mtazzari Nov 21, 2022
02d59a3
[gulmc] adding documentation and docstrings
mtazzari Nov 22, 2022
ff0719e
[gulmc] bugfix
mtazzari Nov 22, 2022
6952a4c
[gulmc] adding docs
mtazzari Nov 23, 2022
7ca5a30
[gulmc] add docs
mtazzari Nov 23, 2022
5783a2c
[gulmc] rewrite complex outputs as tuples
mtazzari Nov 23, 2022
17e1b4d
[gulmc] add final docs
mtazzari Nov 23, 2022
91ace7e
[gulmc] remove unused import
mtazzari Nov 23, 2022
f970467
[gulmc] Improve --debug flag
mtazzari Nov 23, 2022
396df02
[gulmc] raise ValueError if alloc_rule>0 when debug is 1 or 2
mtazzari Nov 23, 2022
e5a128c
[gulmc] cleanup
mtazzari Nov 23, 2022
5b1f1f2
[flake8] fix error code in ignore config
mtazzari Nov 24, 2022
d8e3eb1
[requirements] testing unpinning virtualenv
mtazzari Nov 24, 2022
f3798b2
[requirements] testing unpinning virtualenv
mtazzari Nov 24, 2022
d525acc
[requirements] fixing package clash
mtazzari Nov 24, 2022
481147c
[gulmc] test ValueError if alloc_rule is invalid
mtazzari Nov 24, 2022
1e2532c
[gulmc] improve tests
mtazzari Nov 24, 2022
310e36b
[gulmc] remove unnecessary binary files
mtazzari Dec 8, 2022
c8facbb
[requirements] removing unnecessary virtualenv
mtazzari Dec 8, 2022
1d79281
[CI] specify pip-compile resolver for py 3.7
mtazzari Dec 8, 2022
6b6d23b
Merge branch 'develop' into feature/gulmc
mtazzari Dec 8, 2022
6e3b74b
[CI] fix bug in CI
mtazzari Dec 8, 2022
09ad782
[CI] bugfix
mtazzari Dec 8, 2022
93e9f2f
[gulmc] update following review comments
mtazzari Dec 8, 2022
40abd3c
[gulmc] implement fixes following review
mtazzari Dec 8, 2022
6691535
Merge branch 'develop' into feature/gulmc
mtazzari Dec 8, 2022
0280821
[gulmc] bugfix in logging
mtazzari Dec 8, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'develop' into feature/gulmc
  • Loading branch information
mtazzari committed Nov 7, 2022
commit 50517c69c78bf9d3102b3616a7fce7e282b8825c
11 changes: 4 additions & 7 deletions oasislmf/pytools/gul/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,15 @@
ITEM_MAP_KEY_TYPE, ITEM_MAP_VALUE_TYPE,
gulSampleslevelRec_size, gulSampleslevelHeader_size, coverage_type, gul_header,
)
from oasislmf.pytools.gul.core import split_tiv_classic, split_tiv_multiplicative, get_gul, setmaxloss, compute_mean_loss
from oasislmf.pytools.gul.io import (
write_negative_sidx, write_sample_header,
write_sample_rec, read_getmodel_stream,
)

from oasislmf.pytools.gul.random import (
get_random_generator, compute_norm_cdf_lookup,
compute_norm_inv_cdf_lookup, get_corr_rval, generate_correlated_hash_vector
)

from oasislmf.pytools.gul.random import get_random_generator
from oasislmf.pytools.gul.core import split_tiv_classic, split_tiv_multiplicative, get_gul, setmaxloss, compute_mean_loss
from oasislmf.pytools.gul.utils import append_to_dict_value, binary_search


Expand Down Expand Up @@ -221,7 +218,7 @@ def run(run_dir, ignore_file_type, sample_size, loss_threshold, alloc_rule, debu

do_correlation = False
if ignore_correlation:
logger.info(f"Correlated random number generation: switched OFF because --ignore-correlation is True.")
logger.info("Correlated random number generation: switched OFF because --ignore-correlation is True.")

else:
file_path = os.path.join(input_path, 'correlations.bin')
Expand All @@ -232,11 +229,11 @@ def run(run_dir, ignore_file_type, sample_size, loss_threshold, alloc_rule, debu
if Nperil_correlation_groups > 0 and any(data['correlation_value'] > 0):
do_correlation = True
else:
logger.info(f"Correlated random number generation: switched OFF because 0 peril correlation groups were detected or "
logger.info("Correlated random number generation: switched OFF because 0 peril correlation groups were detected or "
"the correlation value is zero for all peril correlation groups.")

if do_correlation:
logger.info(f"Correlated random number generation: switched ON.")
logger.info("Correlated random number generation: switched ON.")

corr_data_by_item_id = np.ndarray(Nperil_correlation_groups + 1, dtype=Correlation)
corr_data_by_item_id[0] = (0, 0.)
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.