From 63ebb0e1f6d3c5adf4651aa6cf314bcc2d35aff4 Mon Sep 17 00:00:00 2001 From: Le Roux Erwan <erwan.le-roux@irstea.fr> Date: Tue, 13 Nov 2018 18:21:16 +0100 Subject: [PATCH] [R Model] refactor directory names. --- extreme_estimator/{R_fit => R_model}/__init__.py | 0 extreme_estimator/{R_fit => R_model}/abstract_model.py | 2 +- .../{R_fit/gev_fit => R_model/margin_model}/__init__.py | 0 .../margin_model}/abstract_margin_model.py | 4 ++-- .../{R_fit/gev_fit => R_model/margin_model}/gev_mle_fit.R | 0 .../{R_fit/gev_fit => R_model/margin_model}/gev_mle_fit.py | 2 +- .../max_stable_fit => R_model/max_stable_model}/__init__.py | 0 .../max_stable_model}/abstract_max_stable_model.py | 2 +- .../max_stable_model}/max_stable_fit.R | 0 .../max_stable_model}/max_stable_models.py | 2 +- .../max_stable_fit => R_model/max_stable_model}/test.R | 0 extreme_estimator/{R_fit => R_model}/utils.py | 0 extreme_estimator/estimator/full_estimator.py | 4 ++-- extreme_estimator/estimator/margin_estimator.py | 2 +- extreme_estimator/estimator/max_stable_estimator.py | 2 +- extreme_estimator/robustness_plot/msp_robustness.py | 4 ++-- spatio_temporal_dataset/dataset/simulation_dataset.py | 4 ++-- .../spatial_coordinates/generated_coordinates.py | 2 +- .../temporal_observations/annual_maxima_observations.py | 4 ++-- test/test_extreme_estimator/test_margin_estimators.py | 6 +++--- test/test_extreme_estimator/test_max_stable_estimators.py | 4 ++-- utils.py | 3 +-- 22 files changed, 23 insertions(+), 24 deletions(-) rename extreme_estimator/{R_fit => R_model}/__init__.py (100%) rename extreme_estimator/{R_fit => R_model}/abstract_model.py (76%) rename extreme_estimator/{R_fit/gev_fit => R_model/margin_model}/__init__.py (100%) rename extreme_estimator/{R_fit/gev_fit => R_model/margin_model}/abstract_margin_model.py (94%) rename extreme_estimator/{R_fit/gev_fit => R_model/margin_model}/gev_mle_fit.R (100%) rename extreme_estimator/{R_fit/gev_fit => R_model/margin_model}/gev_mle_fit.py (94%) rename extreme_estimator/{R_fit/max_stable_fit => R_model/max_stable_model}/__init__.py (100%) rename extreme_estimator/{R_fit/max_stable_fit => R_model/max_stable_model}/abstract_max_stable_model.py (97%) rename extreme_estimator/{R_fit/max_stable_fit => R_model/max_stable_model}/max_stable_fit.R (100%) rename extreme_estimator/{R_fit/max_stable_fit => R_model/max_stable_model}/max_stable_models.py (96%) rename extreme_estimator/{R_fit/max_stable_fit => R_model/max_stable_model}/test.R (100%) rename extreme_estimator/{R_fit => R_model}/utils.py (100%) diff --git a/extreme_estimator/R_fit/__init__.py b/extreme_estimator/R_model/__init__.py similarity index 100% rename from extreme_estimator/R_fit/__init__.py rename to extreme_estimator/R_model/__init__.py diff --git a/extreme_estimator/R_fit/abstract_model.py b/extreme_estimator/R_model/abstract_model.py similarity index 76% rename from extreme_estimator/R_fit/abstract_model.py rename to extreme_estimator/R_model/abstract_model.py index 8c6c4d86..00673d98 100644 --- a/extreme_estimator/R_fit/abstract_model.py +++ b/extreme_estimator/R_model/abstract_model.py @@ -1,4 +1,4 @@ -from extreme_estimator.R_fit.utils import get_loaded_r +from extreme_estimator.R_model.utils import get_loaded_r class AbstractModel(object): diff --git a/extreme_estimator/R_fit/gev_fit/__init__.py b/extreme_estimator/R_model/margin_model/__init__.py similarity index 100% rename from extreme_estimator/R_fit/gev_fit/__init__.py rename to extreme_estimator/R_model/margin_model/__init__.py diff --git a/extreme_estimator/R_fit/gev_fit/abstract_margin_model.py b/extreme_estimator/R_model/margin_model/abstract_margin_model.py similarity index 94% rename from extreme_estimator/R_fit/gev_fit/abstract_margin_model.py rename to extreme_estimator/R_model/margin_model/abstract_margin_model.py index e2c6aa8a..644ef37d 100644 --- a/extreme_estimator/R_fit/gev_fit/abstract_margin_model.py +++ b/extreme_estimator/R_model/margin_model/abstract_margin_model.py @@ -1,8 +1,8 @@ import numpy as np import pandas as pd -from extreme_estimator.R_fit.abstract_model import AbstractModel -from extreme_estimator.R_fit.gev_fit.gev_mle_fit import GevMleFit, mle_gev +from extreme_estimator.R_model.abstract_model import AbstractModel +from extreme_estimator.R_model.margin_model.gev_mle_fit import GevMleFit, mle_gev class AbstractMarginModel(AbstractModel): diff --git a/extreme_estimator/R_fit/gev_fit/gev_mle_fit.R b/extreme_estimator/R_model/margin_model/gev_mle_fit.R similarity index 100% rename from extreme_estimator/R_fit/gev_fit/gev_mle_fit.R rename to extreme_estimator/R_model/margin_model/gev_mle_fit.R diff --git a/extreme_estimator/R_fit/gev_fit/gev_mle_fit.py b/extreme_estimator/R_model/margin_model/gev_mle_fit.py similarity index 94% rename from extreme_estimator/R_fit/gev_fit/gev_mle_fit.py rename to extreme_estimator/R_model/margin_model/gev_mle_fit.py index bfd5413a..8778f990 100644 --- a/extreme_estimator/R_fit/gev_fit/gev_mle_fit.py +++ b/extreme_estimator/R_model/margin_model/gev_mle_fit.py @@ -4,7 +4,7 @@ import rpy2.robjects.numpy2ri as rpyn import os.path as op # Defining some constants -from extreme_estimator.R_fit.utils import get_associated_r_file +from extreme_estimator.R_model.utils import get_associated_r_file def mle_gev(x_gev: np.ndarray, start_loc=0, start_scale=1, start_shape=0): diff --git a/extreme_estimator/R_fit/max_stable_fit/__init__.py b/extreme_estimator/R_model/max_stable_model/__init__.py similarity index 100% rename from extreme_estimator/R_fit/max_stable_fit/__init__.py rename to extreme_estimator/R_model/max_stable_model/__init__.py diff --git a/extreme_estimator/R_fit/max_stable_fit/abstract_max_stable_model.py b/extreme_estimator/R_model/max_stable_model/abstract_max_stable_model.py similarity index 97% rename from extreme_estimator/R_fit/max_stable_fit/abstract_max_stable_model.py rename to extreme_estimator/R_model/max_stable_model/abstract_max_stable_model.py index 67e4ab5b..ab0c717c 100644 --- a/extreme_estimator/R_fit/max_stable_fit/abstract_max_stable_model.py +++ b/extreme_estimator/R_model/max_stable_model/abstract_max_stable_model.py @@ -4,7 +4,7 @@ import numpy as np import rpy2 from rpy2.robjects import ListVector -from extreme_estimator.R_fit.abstract_model import AbstractModel +from extreme_estimator.R_model.abstract_model import AbstractModel class AbstractMaxStableModel(AbstractModel): diff --git a/extreme_estimator/R_fit/max_stable_fit/max_stable_fit.R b/extreme_estimator/R_model/max_stable_model/max_stable_fit.R similarity index 100% rename from extreme_estimator/R_fit/max_stable_fit/max_stable_fit.R rename to extreme_estimator/R_model/max_stable_model/max_stable_fit.R diff --git a/extreme_estimator/R_fit/max_stable_fit/max_stable_models.py b/extreme_estimator/R_model/max_stable_model/max_stable_models.py similarity index 96% rename from extreme_estimator/R_fit/max_stable_fit/max_stable_models.py rename to extreme_estimator/R_model/max_stable_model/max_stable_models.py index 683899ce..f339db9e 100644 --- a/extreme_estimator/R_fit/max_stable_fit/max_stable_models.py +++ b/extreme_estimator/R_model/max_stable_model/max_stable_models.py @@ -1,6 +1,6 @@ from enum import Enum -from extreme_estimator.R_fit.max_stable_fit.abstract_max_stable_model import AbstractMaxStableModel, \ +from extreme_estimator.R_model.max_stable_model.abstract_max_stable_model import AbstractMaxStableModel, \ AbstractMaxStableModelWithCovarianceFunction, CovarianceFunction diff --git a/extreme_estimator/R_fit/max_stable_fit/test.R b/extreme_estimator/R_model/max_stable_model/test.R similarity index 100% rename from extreme_estimator/R_fit/max_stable_fit/test.R rename to extreme_estimator/R_model/max_stable_model/test.R diff --git a/extreme_estimator/R_fit/utils.py b/extreme_estimator/R_model/utils.py similarity index 100% rename from extreme_estimator/R_fit/utils.py rename to extreme_estimator/R_model/utils.py diff --git a/extreme_estimator/estimator/full_estimator.py b/extreme_estimator/estimator/full_estimator.py index b5f226f1..cec7a3ce 100644 --- a/extreme_estimator/estimator/full_estimator.py +++ b/extreme_estimator/estimator/full_estimator.py @@ -1,5 +1,5 @@ -from extreme_estimator.R_fit.gev_fit.abstract_margin_model import AbstractMarginModel -from extreme_estimator.R_fit.max_stable_fit.abstract_max_stable_model import AbstractMaxStableModel +from extreme_estimator.R_model.margin_model.abstract_margin_model import AbstractMarginModel +from extreme_estimator.R_model.max_stable_model.abstract_max_stable_model import AbstractMaxStableModel from extreme_estimator.estimator.abstract_estimator import AbstractEstimator from extreme_estimator.estimator.margin_estimator import SmoothMarginEstimator from extreme_estimator.estimator.max_stable_estimator import MaxStableEstimator diff --git a/extreme_estimator/estimator/margin_estimator.py b/extreme_estimator/estimator/margin_estimator.py index 0c997032..0bcf9006 100644 --- a/extreme_estimator/estimator/margin_estimator.py +++ b/extreme_estimator/estimator/margin_estimator.py @@ -1,4 +1,4 @@ -from extreme_estimator.R_fit.gev_fit.abstract_margin_model import AbstractMarginModel +from extreme_estimator.R_model.margin_model.abstract_margin_model import AbstractMarginModel from extreme_estimator.estimator.abstract_estimator import AbstractEstimator from spatio_temporal_dataset.dataset.abstract_dataset import AbstractDataset diff --git a/extreme_estimator/estimator/max_stable_estimator.py b/extreme_estimator/estimator/max_stable_estimator.py index 96322572..6d40cc26 100644 --- a/extreme_estimator/estimator/max_stable_estimator.py +++ b/extreme_estimator/estimator/max_stable_estimator.py @@ -1,5 +1,5 @@ from extreme_estimator.estimator.abstract_estimator import AbstractEstimator -from extreme_estimator.R_fit.max_stable_fit.abstract_max_stable_model import AbstractMaxStableModel +from extreme_estimator.R_model.max_stable_model.abstract_max_stable_model import AbstractMaxStableModel from spatio_temporal_dataset.dataset.abstract_dataset import AbstractDataset import numpy as np diff --git a/extreme_estimator/robustness_plot/msp_robustness.py b/extreme_estimator/robustness_plot/msp_robustness.py index 5940a62e..6124a4e3 100644 --- a/extreme_estimator/robustness_plot/msp_robustness.py +++ b/extreme_estimator/robustness_plot/msp_robustness.py @@ -1,5 +1,5 @@ -from extreme_estimator.R_fit.max_stable_fit.abstract_max_stable_model import AbstractMaxStableModel, CovarianceFunction -from extreme_estimator.R_fit.max_stable_fit.max_stable_models import Smith, BrownResnick, Schlather, ExtremalT +from extreme_estimator.R_model.max_stable_model.abstract_max_stable_model import AbstractMaxStableModel, CovarianceFunction +from extreme_estimator.R_model.max_stable_model.max_stable_models import Smith, BrownResnick, Schlather, ExtremalT from extreme_estimator.estimator.abstract_estimator import AbstractEstimator from extreme_estimator.estimator.max_stable_estimator import MaxStableEstimator from extreme_estimator.robustness_plot.multiple_plot import MultiplePlot diff --git a/spatio_temporal_dataset/dataset/simulation_dataset.py b/spatio_temporal_dataset/dataset/simulation_dataset.py index 6a571271..bcf21316 100644 --- a/spatio_temporal_dataset/dataset/simulation_dataset.py +++ b/spatio_temporal_dataset/dataset/simulation_dataset.py @@ -1,5 +1,5 @@ -from extreme_estimator.R_fit.gev_fit.abstract_margin_model import AbstractMarginModel -from extreme_estimator.R_fit.max_stable_fit.abstract_max_stable_model import AbstractMaxStableModel +from extreme_estimator.R_model.margin_model.abstract_margin_model import AbstractMarginModel +from extreme_estimator.R_model.max_stable_model.abstract_max_stable_model import AbstractMaxStableModel from spatio_temporal_dataset.dataset.abstract_dataset import AbstractDataset from spatio_temporal_dataset.spatial_coordinates.abstract_spatial_coordinates import AbstractSpatialCoordinates from spatio_temporal_dataset.temporal_observations.abstract_temporal_observations import AbstractTemporalObservations diff --git a/spatio_temporal_dataset/spatial_coordinates/generated_coordinates.py b/spatio_temporal_dataset/spatial_coordinates/generated_coordinates.py index 6cf57904..c9ae9953 100644 --- a/spatio_temporal_dataset/spatial_coordinates/generated_coordinates.py +++ b/spatio_temporal_dataset/spatial_coordinates/generated_coordinates.py @@ -2,7 +2,7 @@ import math import numpy as np import pandas as pd -from extreme_estimator.R_fit.utils import get_loaded_r +from extreme_estimator.R_model.utils import get_loaded_r from spatio_temporal_dataset.spatial_coordinates.abstract_spatial_coordinates import AbstractSpatialCoordinates import matplotlib.pyplot as plt diff --git a/spatio_temporal_dataset/temporal_observations/annual_maxima_observations.py b/spatio_temporal_dataset/temporal_observations/annual_maxima_observations.py index 6488ebb1..9c4f1387 100644 --- a/spatio_temporal_dataset/temporal_observations/annual_maxima_observations.py +++ b/spatio_temporal_dataset/temporal_observations/annual_maxima_observations.py @@ -1,7 +1,7 @@ import pandas as pd -from extreme_estimator.R_fit.gev_fit.abstract_margin_model import AbstractMarginModel -from extreme_estimator.R_fit.max_stable_fit.abstract_max_stable_model import AbstractMaxStableModel +from extreme_estimator.R_model.margin_model.abstract_margin_model import AbstractMarginModel +from extreme_estimator.R_model.max_stable_model.abstract_max_stable_model import AbstractMaxStableModel from spatio_temporal_dataset.spatial_coordinates.abstract_spatial_coordinates import AbstractSpatialCoordinates from spatio_temporal_dataset.temporal_observations.abstract_temporal_observations import AbstractTemporalObservations diff --git a/test/test_extreme_estimator/test_margin_estimators.py b/test/test_extreme_estimator/test_margin_estimators.py index 6ea4da1d..2b896d91 100644 --- a/test/test_extreme_estimator/test_margin_estimators.py +++ b/test/test_extreme_estimator/test_margin_estimators.py @@ -2,9 +2,9 @@ import unittest import numpy as np -from extreme_estimator.R_fit.gev_fit.abstract_margin_model import ConstantMarginModel -from extreme_estimator.R_fit.gev_fit.gev_mle_fit import GevMleFit -from extreme_estimator.R_fit.utils import get_loaded_r +from extreme_estimator.R_model.margin_model.abstract_margin_model import ConstantMarginModel +from extreme_estimator.R_model.margin_model.gev_mle_fit import GevMleFit +from extreme_estimator.R_model.utils import get_loaded_r from extreme_estimator.estimator.margin_estimator import SmoothMarginEstimator from spatio_temporal_dataset.dataset.simulation_dataset import MarginDataset from spatio_temporal_dataset.spatial_coordinates.generated_coordinates import CircleCoordinatesRadius1 diff --git a/test/test_extreme_estimator/test_max_stable_estimators.py b/test/test_extreme_estimator/test_max_stable_estimators.py index f8365192..c00ef17d 100644 --- a/test/test_extreme_estimator/test_max_stable_estimators.py +++ b/test/test_extreme_estimator/test_max_stable_estimators.py @@ -1,8 +1,8 @@ import unittest -from extreme_estimator.R_fit.max_stable_fit.abstract_max_stable_model import \ +from extreme_estimator.R_model.max_stable_model.abstract_max_stable_model import \ AbstractMaxStableModelWithCovarianceFunction, CovarianceFunction -from extreme_estimator.R_fit.max_stable_fit.max_stable_models import Smith, BrownResnick, Schlather, \ +from extreme_estimator.R_model.max_stable_model.max_stable_models import Smith, BrownResnick, Schlather, \ Geometric, ExtremalT, ISchlather from extreme_estimator.estimator.max_stable_estimator import MaxStableEstimator from spatio_temporal_dataset.dataset.simulation_dataset import MaxStableDataset diff --git a/utils.py b/utils.py index 8b65aecf..36d17edc 100644 --- a/utils.py +++ b/utils.py @@ -1,9 +1,8 @@ -import os import os.path as op def get_root_path() -> str: - return os.path.dirname(os.path.abspath(__file__)) + return op.dirname(op.abspath(__file__)) def get_full_path(relative_path: str) -> str: -- GitLab