Commit 6e9c593e authored by Le Roux Erwan's avatar Le Roux Erwan
Browse files

[EUROCODE DATA] fix eurocode level for bottom quantile. improve label for the legend.

parent ef6df62b
No related merge requests found
Showing with 23 additions and 9 deletions
+23 -9
......@@ -44,8 +44,10 @@ class AbstractEurocodeRegion(object):
return 3.5, -2.45
def plot_max_loading(self, ax, altitudes):
old_label = 'Eurocode computed in {}'.format(LAST_YEAR_FOR_EUROCODE)
new_label = 'Eurocode standards'
ax.plot(altitudes, [self.eurocode_max_loading(altitude) for altitude in altitudes],
label='Eurocode computed in {}'.format(LAST_YEAR_FOR_EUROCODE), color='k')
label=new_label, color='k')
class C1(AbstractEurocodeRegion):
......
......@@ -80,6 +80,6 @@ class ExtractEurocodeReturnLevelFromExtremes(object):
@property
def posterior_eurocode_return_level_uncertainty_interval_for_the_year_of_interest(self):
# Bottom and upper quantile correspond to the quantile
bottom_and_upper_quantile = (0.250, 0.975)
bottom_and_upper_quantile = (0.025, 0.975)
return [np.quantile(self.posterior_eurocode_return_level_samples_for_year_of_interest, q=q)
for q in bottom_and_upper_quantile]
......@@ -13,13 +13,24 @@ from extreme_fit.model.margin_model.linear_margin_model.temporal_linear_margin_m
NonStationaryLocationAndScaleTemporalModel
from root_utils import get_display_name_from_object_type
# Model class
import matplotlib as mpl
mpl.rcParams['text.usetex'] = True
mpl.rcParams['text.latex.preamble'] = [r'\usepackage{amsmath}']
def dep_to_ordered_return_level_uncertainties(model_class, last_year_for_the_data, altitudes):
model_class_str = get_display_name_from_object_type(model_class).split('Stationary')[0] + 'Stationary'
model_name = model_class_str + ' 1958-' + str(last_year_for_the_data)
model_type = get_display_name_from_object_type(model_class).split('Stationary')[0] + 'Stationary'
# model_name += ' 1958-' + str(last_year_for_the_data)
is_non_stationary = model_type == 'NonStationary'
model_symbol = '{\mu_1, \sigma_1}' if is_non_stationary else '0'
parameter = ', 2017' if is_non_stationary else ''
model_name = ' $ \widehat{q_{\\textrm{GEV}}(\\boldsymbol{\\theta_{\mathcal{M}_'
model_name += model_symbol
model_name += '}}'
model_name += parameter
model_name += ')}_{ \\textrm{MMSE}} $ ' + '({})'.format(model_type)
# Load altitude visualizer
altitude_visualizer = load_altitude_visualizer(AltitudeHypercubeVisualizer, altitudes=altitudes,
last_starting_year=None, nb_data_reduced_for_speed=False,
......@@ -33,7 +44,8 @@ def dep_to_ordered_return_level_uncertainties(model_class, last_year_for_the_dat
dep_to_ordered_return_level_uncertainty = {dep: [] for dep in DEPARTEMENT_TYPES}
for altitude, visualizer in altitude_visualizer.tuple_to_study_visualizer.items():
print('{} processing altitude = {} '.format(model_name, altitude))
dep_to_return_level_uncertainty = visualizer.dep_class_to_eurocode_level_uncertainty(model_class, last_year_for_the_data)
dep_to_return_level_uncertainty = visualizer.dep_class_to_eurocode_level_uncertainty(model_class,
last_year_for_the_data)
for dep, return_level_uncertainty in dep_to_return_level_uncertainty.items():
dep_to_ordered_return_level_uncertainty[dep].append(return_level_uncertainty)
......@@ -42,15 +54,15 @@ def dep_to_ordered_return_level_uncertainties(model_class, last_year_for_the_dat
def main_drawing():
# Select parameters
fast_plot = [True, False][0]
fast_plot = [True, False][1]
model_class_and_last_year = [
(StationaryTemporalModel, LAST_YEAR_FOR_EUROCODE),
(StationaryTemporalModel, 2017),
(NonStationaryLocationAndScaleTemporalModel, 2017),
][:]
][1:]
altitudes = EUROCODE_ALTITUDES[:]
if fast_plot:
model_class_and_last_year = model_class_and_last_year[:1]
model_class_and_last_year = model_class_and_last_year[:2]
altitudes = altitudes[:2]
model_name_to_dep_to_ordered_return_level = {}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment