Skip to content

Commit

Permalink
Merge pull request #52 from mmaelicke/angle-math-bugfix
Browse files Browse the repository at this point in the history
Angle math bugfix
  • Loading branch information
mmaelicke authored Sep 24, 2020
2 parents e09a650 + ef393bb commit b5f656d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion skgstat/DirectionalVariogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,9 @@ def _triangle(self, local_ref):
# get the maximum x coordinate in the current representation
xmax = np.max(local_ref[:, 0])

if h >= xmax:
return self._compass(local_ref)

# build the figure
poly = Polygon([
(0, 0),
Expand Down Expand Up @@ -757,7 +760,7 @@ def _compass(self, local_ref):
xmax = np.max(local_ref[:,0])

# calculate the radius and y coordinates
r = xmax / a
r = xmax / np.cos(a)
y = r * np.sin(a)

# build and return the figure
Expand Down
6 changes: 3 additions & 3 deletions skgstat/tests/DirectionalVariogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def setUp(self):
def test_standard_settings(self):
DV = DirectionalVariogram(self.c, self.v, normalize=True)

for x, y in zip(DV.parameters, [406., 2145., 0]):
for x, y in zip(DV.parameters, [407.467, 2138.098, 0]):
self.assertAlmostEqual(x, y, places=0)

def test_azimuth(self):
Expand All @@ -38,7 +38,7 @@ def test_invalid_azimuth(self):
def test_tolerance(self):
DV = DirectionalVariogram(self.c, self.v, tolerance=15, normalize=True)

for x, y in zip(DV.parameters, [32.474, 2016.601, 0]):
for x, y in zip(DV.parameters, [26.342, 1880.015, 0]):
self.assertAlmostEqual(x, y, places=3)

def test_invalid_tolerance(self):
Expand All @@ -53,7 +53,7 @@ def test_invalid_tolerance(self):
def test_bandwidth(self):
DV = DirectionalVariogram(self.c, self.v, bandwidth=12, normalize=True)

for x, y in zip(DV.parameters, [435.733, 2746.608, 0]):
for x, y in zip(DV.parameters, [435.733, 2715.865, 0]):
self.assertAlmostEqual(x, y, places=3)

def test_invalid_model(self):
Expand Down

0 comments on commit b5f656d

Please sign in to comment.