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

fix for failing workflows on github actions #406

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ jobs:

- name: Install simsopt package
# run: env CMAKE_BUILD_TYPE=Debug pip install -v .[MPI,SPEC]
run: pip install -v ".[MPI,SPEC,VIS]"
run: pip install -v ".[MPI,SPEC]"

- name: Verify that importing simsopt does not automatically initialize MPI
run: ./tests/verify_MPI_not_initialized.py
Expand Down
72 changes: 35 additions & 37 deletions tests/mhd/test_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,29 +138,28 @@ def test_set_profile_non_cumulative(self):

filename = os.path.join(TEST_DIR, 'RotatingEllipse_Nvol8.sp')

with ScratchDir("."):
s = Spec(filename)
nvol = s.inputlist.nvol
mvol = nvol + s.inputlist.lfreebound
s = Spec(filename)
nvol = s.inputlist.nvol
mvol = nvol + s.inputlist.lfreebound

cumulative = False # Surfaces currents are non-cumulative quantities in SPEC
surface_current = ProfileSpec(np.zeros((mvol,)), cumulative=cumulative)
cumulative = False # Surfaces currents are non-cumulative quantities in SPEC
surface_current = ProfileSpec(np.zeros((mvol,)), cumulative=cumulative)

s.interface_current_profile = surface_current
s.interface_current_profile = surface_current

# Check that all currents are actually zero
for lvol in range(1, mvol):
self.assertEqual(s.get_profile('interface_current', lvol), 0)
# Check that all currents are actually zero
for lvol in range(1, mvol):
self.assertEqual(s.get_profile('interface_current', lvol), 0)

# Modify one interface current
s.set_profile('interface_current', lvol=3, value=1)
# Modify one interface current
s.set_profile('interface_current', lvol=3, value=1)

# Check values
for lvol in range(1, mvol):
if lvol != 3:
self.assertEqual(s.get_profile('interface_current', lvol), 0)
else:
self.assertEqual(s.get_profile('interface_current', lvol), 1)
# Check values
for lvol in range(1, mvol):
if lvol != 3:
self.assertEqual(s.get_profile('interface_current', lvol), 0)
else:
self.assertEqual(s.get_profile('interface_current', lvol), 1)

def test_set_profile_cumulative(self):
"""
Expand All @@ -170,31 +169,30 @@ def test_set_profile_cumulative(self):

filename = os.path.join(TEST_DIR, 'RotatingEllipse_Nvol8.sp')

with ScratchDir("."):
s = Spec(filename)
nvol = s.inputlist.nvol
mvol = nvol + s.inputlist.lfreebound
s = Spec(filename)
nvol = s.inputlist.nvol
mvol = nvol + s.inputlist.lfreebound

cumulative = True # Surfaces currents are non-cumulative quantities in SPEC
volume_current = ProfileSpec(np.zeros((mvol,)), cumulative=cumulative)
cumulative = True # Surfaces currents are non-cumulative quantities in SPEC
volume_current = ProfileSpec(np.zeros((mvol,)), cumulative=cumulative)

s.volume_current_profile = volume_current
s.volume_current_profile = volume_current

# Check that all currents are actually zero
for lvol in range(1, mvol):
self.assertEqual(s.get_profile('volume_current', lvol), 0)
# Check that all currents are actually zero
for lvol in range(1, mvol):
self.assertEqual(s.get_profile('volume_current', lvol), 0)

# Modify one interface current
s.set_profile('volume_current', lvol=3, value=1)
# Modify one interface current
s.set_profile('volume_current', lvol=3, value=1)

print(s.volume_current_profile)
print(s.volume_current_profile)

# Check values
for lvol in range(1, mvol):
if lvol < 3:
self.assertEqual(s.get_profile('volume_current', lvol), 0)
else:
self.assertEqual(s.get_profile('volume_current', lvol), 1)
# Check values
for lvol in range(1, mvol):
if lvol < 3:
self.assertEqual(s.get_profile('volume_current', lvol), 0)
else:
self.assertEqual(s.get_profile('volume_current', lvol), 1)

def test_integrated_stellopt_scenarios_1dof(self):
"""
Expand Down
Loading