from meslas.means import ConstantMean from meslas.covariance.spatial_covariance_functions import Matern32 from meslas.covariance.cross_covariances import UniformMixing from meslas.covariance.heterotopic import FactorCovariance from meslas.grid import Grid from meslas.sampling import GRF # Dimension of the response. n_out = 2 # Spatial Covariance. matern_cov = Matern32(lmbda=0.1, sigma=1.0) # Cross covariance. cross_cov = UniformMixing(gamma0=0.9, sigmas=[np.sqrt(0.25), np.sqrt(0.6)]) covariance = FactorCovariance(matern_cov, cross_cov, n_out=n_out) # Specify mean function mean = ConstantMean([1.0, 0]) # Create the GRF. myGRF = GRF(mean, covariance) # Create a regular square grid in 2 dims. # Number of repsones. dim = 2 my_grid = Grid(100, dim) # Observe some data.
from meslas.covariance.cross_covariances import UniformMixing from meslas.covariance.heterotopic import FactorCovariance from meslas.geometry.grid import SquareGrid from meslas.random_fields import GRF from meslas.excursion import coverage_fct_fixed_location torch.set_default_dtype(torch.float32) # Dimension of the response. n_out = 2 # Spatial Covariance. matern_cov = Matern32(lmbda=0.1, sigma=1.0) # Cross covariance. cross_cov = UniformMixing(gamma0=0.0, sigmas=[np.sqrt(1.0), np.sqrt(1.5)]) covariance = FactorCovariance(matern_cov, cross_cov, n_out=n_out) # Specify mean function mean = ConstantMean([0.0, 0.0]) # Create the GRF. myGRF = GRF(mean, covariance) # Create a regular square grid in 2 dims. # Number of respones. dim = 2 my_grid = Grid(100, dim) # Observe some data.
from meslas.covariance.cross_covariances import UniformMixing from meslas.covariance.heterotopic import FactorCovariance from meslas.geometry.grid import TriangularGrid, SquareGrid from meslas.random_fields import GRF from meslas.excursion import coverage_fct_fixed_location # Dimension of the response. n_out = 4 # Spatial Covariance. matern_cov = Matern32(lmbda=0.1, sigma=1.0) # Cross covariance. cross_cov = UniformMixing( gamma0=0.0, sigmas=[np.sqrt(0.25), np.sqrt(0.3), np.sqrt(0.4), np.sqrt(0.5)]) covariance = FactorCovariance(matern_cov, cross_cov, n_out=n_out) # Specify mean function mean = ConstantMean([1.0, -2.0, 4.0, 33.0]) # Create the GRF. myGRF = GRF(mean, covariance) # Array of locations. S1 = torch.Tensor([[0, 0], [0, 1], [0, 2], [3, 0]]).float() S2 = torch.Tensor([[0, 0], [3, 0], [5, 4]]).float()
""" return # ------------------------------------------------------ # DEFINITION OF THE MODEL # ------------------------------------------------------ # Dimension of the response. n_out = 2 # Spatial Covariance. matern_cov = Matern32(lmbda=0.5, sigma=1.0) # Cross covariance. cross_cov = UniformMixing(gamma0=0.2, sigmas=[2.25, 2.25]) covariance = FactorCovariance(spatial_cov=matern_cov, cross_cov=cross_cov, n_out=n_out) # Specify mean function, here it is a linear trend that decreases with the # horizontal coordinate. beta0s = np.array([5.8, 24.0]) beta1s = np.array([[0, -4.0], [0, -3.8]]) mean = LinearMean(beta0s, beta1s) # Create the GRF. myGRF = GRF(mean, covariance) # ------------------------------------------------------ # DISCRETIZE EVERYTHING
# HYPERPARAMETERS sigma0_init = 221.6 m0 = 2133.8 lambda0 = 462.0 # ------------------------------------------------------ # DEFINITION OF THE MODEL # ------------------------------------------------------ # Dimension of the response. n_out = 1 # Spatial Covariance. matern_cov = Matern32(lmbda=lambda0, sigma=1.0) # Cross covariance. cross_cov = UniformMixing(gamma0=0.2, sigmas=[sigma0_init]) covariance = FactorCovariance(spatial_cov=matern_cov, cross_cov=cross_cov, n_out=n_out) # Specify mean function, here it is a linear trend that decreases with the # horizontal coordinate. beta0s = np.array([m0]) beta1s = np.array([[0.0, 0.0, 0.5]]) mean = LinearMean(beta0s, beta1s) # Create the GRF. myGRF = GRF(mean, covariance) # ------------------------------------------------------ # DISCRETIZE EVERYTHING