Skip to content

Commit 8b26504

Browse files
Marius Iskenmiili
authored andcommitted
test: adding distance test
1 parent 73179d5 commit 8b26504

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

test/test_distance_weights.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import matplotlib.pyplot as plt
2+
import numpy as np
3+
import pytest
4+
5+
from qseek.distance_weights import weights_gaussian
6+
7+
KM = 1e3
8+
9+
10+
@pytest.mark.plot
11+
def test_weights_gaussian_min_stations():
12+
n_nodes = 10
13+
n_stations = 200
14+
distances = np.random.uniform(0, 100 * KM, size=(n_nodes, n_stations))
15+
16+
weights_gauss = weights_gaussian(
17+
distances,
18+
distance_taper=10 * KM,
19+
required_stations=1,
20+
waterlevel=0.1,
21+
)
22+
23+
node = 1
24+
25+
fig = plt.figure()
26+
ax = fig.add_subplot(111)
27+
ax.scatter(distances[node], weights_gauss[node], label="Gaussian", alpha=0.7)
28+
ax.set_xlabel("Distance (km)")
29+
ax.set_ylabel("Weight")
30+
ax.set_title("Gaussian Weights with Minimum Stations")
31+
ax.legend()
32+
plt.show()
33+
34+
35+
if __name__ == "__main__":
36+
test_weights_gaussian_min_stations()

0 commit comments

Comments
 (0)