An error occurred while loading the file. Please try again.
-
Le Roux Erwan authored0db99592
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
from extreme_estimator.estimator.max_stable_estimator import MaxStableEstimator
from extreme_estimator.extreme_models.max_stable_model.abstract_max_stable_model import AbstractMaxStableModel
from extreme_estimator.extreme_models.max_stable_model.max_stable_models import Smith
from experiment.robustness_plot.display_item import DisplayItem
from experiment.robustness_plot.multiple_plot import MultiplePlot
from experiment.robustness_plot.single_plot import SinglePlot
from spatio_temporal_dataset.coordinates.abstract_coordinates import AbstractCoordinates
from spatio_temporal_dataset.coordinates.spatial_coordinates.generated_spatial_coordinates import CircleCoordinates
from spatio_temporal_dataset.dataset.simulation_dataset import MaxStableDataset
class MaxStableDisplayItem(DisplayItem):
def display_name_from_value(self, value: AbstractMaxStableModel):
return value.cov_mod
class CoordinateDisplayItem(DisplayItem):
def display_name_from_value(self, value: AbstractCoordinates):
return str(value).split('.')[-1].split("'")[0]
class MaxStableProcessPlot(object):
MaxStableModelItem = MaxStableDisplayItem('max_stable_model', Smith)
CoordinateClassItem = CoordinateDisplayItem('coordinate_class', CircleCoordinates)
NbStationItem = DisplayItem('Number of stations', 50)
NbObservationItem = DisplayItem('nb_obs', 60)
def msp_spatial_ordinates(self, **kwargs_single_point) -> dict:
# Get the argument from kwargs
max_stable_model = self.MaxStableModelItem.value_from_kwargs(
**kwargs_single_point) # type: AbstractMaxStableModel
coordinate_class = self.CoordinateClassItem.value_from_kwargs(**kwargs_single_point)
nb_station = self.NbStationItem.value_from_kwargs(**kwargs_single_point)
nb_obs = self.NbObservationItem.value_from_kwargs(**kwargs_single_point)
# Run the estimation
spatial_coordinates = coordinate_class.from_nb_points(nb_points=nb_station)
dataset = MaxStableDataset.from_sampling(nb_obs=nb_obs, max_stable_model=max_stable_model,
coordinates=spatial_coordinates)
estimator = MaxStableEstimator(dataset, max_stable_model)
estimator.fit()
return estimator.scalars(max_stable_model.params_sample)
class SingleMaxStableProcessPlot(SinglePlot, MaxStableProcessPlot):
def compute_value_from_kwargs_single_point(self, **kwargs_single_point):
return self.msp_spatial_ordinates(**kwargs_single_point)
class MultipleMaxStableProcessPlot(MultiplePlot, MaxStableProcessPlot):
def compute_value_from_kwargs_single_point(self, **kwargs_single_point):
return self.msp_spatial_ordinates(**kwargs_single_point)