basic test for generation stage

improvement-file_array
Oli 3 years ago
parent 40f5c5ba74
commit 4c3cfa0b5c

@ -11,9 +11,12 @@ fftma:
binaries:
./script_fortran.sh
test: binaries
test: binaries fftma
cd tests/integration && python3 -m unittest test.py
perf: binaries
cd tests/performance && python3 generation.py
cd tests/performance && python3 connectivity.py
cd tests/performance && python3 connectivity.py
test-gen: fftma
cd tests/stages/generation && python3 -m unittest test.py

File diff suppressed because one or more lines are too long

@ -28,8 +28,4 @@ variance=3.5682389
typ=3
k=gen(nx, ny, nz, dx, dy, dz, seed, variograms, mean, variance, typ, 8)
#np.save(f"out_{N}.npy",k)
k2 = np.load(f"out_{N}_ceci.npy")
print(k==k2)
np.save(f"out_{N}.npy",k)

Binary file not shown.

@ -0,0 +1,48 @@
from FFTMA import gen
import numpy as np
import unittest
def generate(N):
nx, ny, nz = N,N,N
dx, dy, dz = 1.0, 1.0, 1.0
seed= 1548762 #rdi(10000,99999)
var=1
vario=2
alpha=1
lcx=2
lcy=4
lcz=16
ap1x=1
ap1y=0
ap1z=0
ap2x=0
ap2y=1
ap2z=0
v1 = (var, vario, alpha, lcx, lcy, lcz, ap1x, ap1y, ap1z, ap2x, ap2y, ap2z)
variograms = [v1]
mean=15.3245987
variance=3.5682389
typ=3
return gen(nx, ny, nz, dx, dy, dz, seed, variograms, mean, variance, typ, 8)
def test(N):
k = generate(N)
k_correct = np.load(f"out_{N}.npy")
comparison = k == k_correct
return comparison.all()
class TestGeneration(unittest.TestCase):
def test_8(self):
self.assertTrue(test(8))
def test_16(self):
self.assertTrue(test(16))
def test_32(self):
self.assertTrue(test(32))
Loading…
Cancel
Save