Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor fixes in some tests #293

Merged
merged 4 commits into from
Mar 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tests/field/test_magneticfields.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ def test_circularcoil_Bfield(self):
### compare to biosavart(circular_coil)
## at these points
points = np.asarray(npoints * [[-1.41513202e-03, 8.99999382e-01, -3.14473221e-04]])
np.random.seed(0)
points += pointVar * (np.random.rand(*points.shape)-0.5)
## verify with a x^2+z^2=radius^2 circular coil
normal = [np.pi/2, np.pi/2]
Expand Down
2 changes: 1 addition & 1 deletion tests/geo/test_surface_xyzfourier.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def test_toRZFourier_lossless_at_quadrature_points(self):
for surface_type in ['SurfaceXYZFourier', 'SurfaceXYZTensorFourier']:
with self.subTest(surface_type=surface_type):
self.subtest_toRZFourier_lossless_at_quadraturepoints(surface_type)

def subtest_toRZFourier_lossless_at_quadraturepoints(self, surface_type):
s = get_exact_surface(surface_type=surface_type)
sRZ = s.to_RZFourier()
Expand Down
10 changes: 10 additions & 0 deletions tests/mhd/test_virtual_casing.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
import virtual_casing
except ImportError:
virtual_casing = None
try:
import matplotlib
except ImportError:
matplotlib = None

try:
from mpi4py import MPI
Expand Down Expand Up @@ -53,6 +57,9 @@ def test_different_initializations(self):
vc = VirtualCasing.from_vmec(vmec, src_nphi=10)


@unittest.skipIf(
(virtual_casing is None),
"Need virtual_casing python package installed to run VirtualCasingTests")
class VirtualCasingTests(unittest.TestCase):

def test_bnorm_benchmark(self):
Expand Down Expand Up @@ -153,6 +160,9 @@ def test_save_load(self):
logger.info(f'Variable {variable} in vc1 is {variable1} and in vc2 is {variable2}')
np.testing.assert_allclose(variable1, variable2)

@unittest.skipIf(
(matplotlib is None),
"Need matplotlib python package to test VirtualCasing plot")
def test_plot(self):
filename = os.path.join(TEST_DIR, 'wout_20220102-01-053-003_QH_nfp4_aspect6p5_beta0p05_iteratedWithSfincs_reference.nc')
vc = VirtualCasing.from_vmec(filename, src_nphi=8, src_ntheta=9)
Expand Down