Skip to content

Commit c33c8bc

Browse files
committed
update black
1 parent 14fa105 commit c33c8bc

File tree

13 files changed

+28
-28
lines changed

13 files changed

+28
-28
lines changed

examples/02_cov_model/00_intro.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# use CovModel as the base-class
2020
class Gau(gs.CovModel):
2121
def cor(self, h):
22-
return np.exp(-(h ** 2))
22+
return np.exp(-(h**2))
2323

2424

2525
###############################################################################

examples/02_cov_model/05_additional_para.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def default_opt_arg(self):
2020
return {"alpha": 1.5}
2121

2222
def cor(self, h):
23-
return np.exp(-(h ** self.alpha))
23+
return np.exp(-(h**self.alpha))
2424

2525

2626
###############################################################################

examples/02_cov_model/06_fitting_para_ranges.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def default_opt_arg(self):
1616
return {"alpha": 1.5}
1717

1818
def cor(self, h):
19-
return np.exp(-(h ** self.alpha))
19+
return np.exp(-(h**self.alpha))
2020

2121

2222
# Exemplary variogram data (e.g. estimated from field observations)

gstools/covmodel/fit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ def _r2_score(model, x_data, y_data, is_dir_vario):
499499
else:
500500
vario = model.variogram(x_data)
501501
residuals = y_data - vario
502-
ss_res = np.sum(residuals ** 2)
502+
ss_res = np.sum(residuals**2)
503503
ss_tot = np.sum((y_data - np.mean(y_data)) ** 2)
504504
return 1.0 - (ss_res / ss_tot)
505505

gstools/covmodel/models.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class Gaussian(CovModel):
6868

6969
def cor(self, h):
7070
"""Gaussian normalized correlation function."""
71-
return np.exp(-(h ** 2))
71+
return np.exp(-(h**2))
7272

7373
def default_rescale(self):
7474
"""Gaussian rescaling factor to result in integral scale."""
@@ -147,7 +147,7 @@ def cor(self, h):
147147
def spectral_density(self, k): # noqa: D102
148148
k = np.asarray(k, dtype=np.double)
149149
return (
150-
self.len_rescaled ** self.dim
150+
self.len_rescaled**self.dim
151151
* sps.gamma((self.dim + 1) / 2.0)
152152
/ (np.pi * (1.0 + (k * self.len_rescaled) ** 2))
153153
** ((self.dim + 1) / 2.0)
@@ -186,7 +186,7 @@ def spectral_rad_ppf(self, u):
186186
if self.dim == 2:
187187
u_power = np.divide(
188188
1,
189-
u ** 2,
189+
u**2,
190190
out=np.full_like(u, np.inf),
191191
where=np.logical_not(np.isclose(u, 0)),
192192
)
@@ -454,7 +454,7 @@ def default_opt_arg_bounds(self):
454454

455455
def cor(self, h):
456456
"""Rational normalized correlation function."""
457-
return np.power(1 + h ** 2 / self.alpha, -self.alpha)
457+
return np.power(1 + h**2 / self.alpha, -self.alpha)
458458

459459
def calc_integral_scale(self): # noqa: D102
460460
return (
@@ -499,7 +499,7 @@ class Cubic(CovModel):
499499
def cor(self, h):
500500
"""Spherical normalized correlation function."""
501501
h = np.minimum(np.abs(h, dtype=np.double), 1.0)
502-
return 1.0 - 7 * h ** 2 + 8.75 * h ** 3 - 3.5 * h ** 5 + 0.75 * h ** 7
502+
return 1.0 - 7 * h**2 + 8.75 * h**3 - 3.5 * h**5 + 0.75 * h**7
503503

504504

505505
class Linear(CovModel):
@@ -578,7 +578,7 @@ def cor(self, h):
578578
h_l1 = h < 1.0
579579
h_low = h[h_l1]
580580
res[h_l1] = (
581-
2 / np.pi * (np.arccos(h_low) - h_low * np.sqrt(1 - h_low ** 2))
581+
2 / np.pi * (np.arccos(h_low) - h_low * np.sqrt(1 - h_low**2))
582582
)
583583
return res
584584

@@ -619,7 +619,7 @@ class Spherical(CovModel):
619619
def cor(self, h):
620620
"""Spherical normalized correlation function."""
621621
h = np.minimum(np.abs(h, dtype=np.double), 1.0)
622-
return 1.0 - 1.5 * h + 0.5 * h ** 3
622+
return 1.0 - 1.5 * h + 0.5 * h**3
623623

624624
def check_dim(self, dim):
625625
"""Spherical model is only valid in 1D, 2D and 3D."""

gstools/covmodel/tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def rad_fac(dim, r):
128128
elif dim == 2:
129129
fac = 2 * np.pi * r
130130
elif dim == 3:
131-
fac = 4 * np.pi * r ** 2
131+
fac = 4 * np.pi * r**2
132132
else: # pragma: no cover
133133
fac = (
134134
dim

gstools/field/upscaling.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def var_coarse_graining(model, point_volumes=0.0):
7474
# interprete volume as a hypercube and calculate the edge length
7575
edge = point_volumes ** (1.0 / model.dim)
7676
var_factor = (
77-
model.len_scale ** 2 / (model.len_scale ** 2 + edge ** 2 / 4)
77+
model.len_scale**2 / (model.len_scale**2 + edge**2 / 4)
7878
) ** (model.dim / 2.0)
7979

8080
return model.sill * var_factor

gstools/random/rng.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ def sample_sphere(self, dim, size=None):
170170
elif dim == 3:
171171
ang1 = self.random.uniform(0.0, 2 * np.pi, size)
172172
ang2 = self.random.uniform(-1.0, 1.0, size)
173-
coord[0] = np.sqrt(1.0 - ang2 ** 2) * np.cos(ang1)
174-
coord[1] = np.sqrt(1.0 - ang2 ** 2) * np.sin(ang1)
173+
coord[0] = np.sqrt(1.0 - ang2**2) * np.cos(ang1)
174+
coord[1] = np.sqrt(1.0 - ang2**2) * np.sin(ang1)
175175
coord[2] = ang2
176176
else: # pragma: no cover
177177
# http://corysimon.github.io/articles/uniformdistn-on-sphere/

gstools/random/tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class MasterRNG:
3131
def __init__(self, seed):
3232
self._seed = seed
3333
self._master_rng_fct = rand.RandomState(seed)
34-
self._master_rng = lambda: self._master_rng_fct.randint(1, 2 ** 16)
34+
self._master_rng = lambda: self._master_rng_fct.randint(1, 2**16)
3535

3636
def __call__(self):
3737
"""Return a random seed."""

gstools/tools/special.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ def inc_gamma(s, x):
6666
if np.isclose(s, 0):
6767
return sps.exp1(x)
6868
if np.isclose(s, np.around(s)) and s < -0.5:
69-
return x ** s * sps.expn(int(1 - np.around(s)), x)
69+
return x**s * sps.expn(int(1 - np.around(s)), x)
7070
if s < 0:
71-
return (inc_gamma(s + 1, x) - x ** s * np.exp(-x)) / s
71+
return (inc_gamma(s + 1, x) - x**s * np.exp(-x)) / s
7272
return sps.gamma(s) * sps.gammaincc(s, x)
7373

7474

@@ -87,7 +87,7 @@ def inc_gamma_low(s, x):
8787
if np.isclose(s, np.around(s)) and s < 0.5:
8888
return np.full_like(x, np.inf, dtype=np.double)
8989
if s < 0:
90-
return (inc_gamma_low(s + 1, x) + x ** s * np.exp(-x)) / s
90+
return (inc_gamma_low(s + 1, x) + x**s * np.exp(-x)) / s
9191
return sps.gamma(s) * sps.gammainc(s, x)
9292

9393

@@ -206,7 +206,7 @@ def tpl_exp_spec_dens(k, dim, len_scale, hurst, len_low=0.0):
206206
b = hurst + 0.5
207207
c = hurst + dim / 2.0 + 1.0
208208
d = dim / 2.0 + 0.5
209-
fac = len_scale ** dim * hurst * sps.gamma(d) / (np.pi ** d * a)
209+
fac = len_scale**dim * hurst * sps.gamma(d) / (np.pi**d * a)
210210
return fac / (1.0 + z) ** a * sps.hyp2f1(a, b, c, z / (1.0 + z))
211211
fac_up = (len_scale + len_low) ** (2 * hurst)
212212
spec_up = tpl_exp_spec_dens(k, dim, len_scale + len_low, hurst)

0 commit comments

Comments
 (0)