Skip to content

Commit

Permalink
ExpInt+Matern: corrections for spectrum approximation nu -> inf
Browse files Browse the repository at this point in the history
  • Loading branch information
MuellerSeb committed Oct 11, 2022
1 parent eebd160 commit f704dee
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions src/gstools/covmodel/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,23 +368,17 @@ def cor(self, h):

def spectral_density(self, k): # noqa: D102
k = np.asarray(k, dtype=np.double)
x = (k * self.len_rescaled) ** 2
# for nu > 20 we just use an approximation of the gaussian model
if self.nu > 20.0:
return (
(self.len_rescaled / np.sqrt(np.pi)) ** self.dim
* np.exp(-((k * self.len_rescaled) ** 2))
* (
1
+ (
((k * self.len_rescaled) ** 2 - self.dim / 2.0) ** 2
- self.dim / 2.0
)
/ self.nu
)
* np.exp(-x)
* (1 + 0.5 * x**2 / self.nu)
* np.sqrt(1 + x / self.nu) ** (-self.dim)
)
return (self.len_rescaled / np.sqrt(np.pi)) ** self.dim * np.exp(
-(self.nu + self.dim / 2.0)
* np.log(1.0 + (k * self.len_rescaled) ** 2 / self.nu)
-(self.nu + self.dim / 2.0) * np.log(1.0 + x / self.nu)
+ sps.loggamma(self.nu + self.dim / 2.0)
- sps.loggamma(self.nu)
- self.dim * np.log(np.sqrt(self.nu))
Expand Down Expand Up @@ -474,7 +468,9 @@ def spectral_density(self, k): # noqa: D102
return (
(0.5 * self.len_rescaled / np.sqrt(np.pi)) ** self.dim
* np.exp(-x)
* (1.0 + x / (self.nu * 0.5 + 1.0))
* self.nu
/ (self.nu + self.dim)
* (1.0 + 2 * x / (self.nu + self.dim + 2))
)
return (
self.nu
Expand Down

0 comments on commit f704dee

Please sign in to comment.