Skip to content

Commit baedfd9

Browse files
committed
Updated tests with .nc test file rather than data entry
1 parent 4e8281d commit baedfd9

3 files changed

Lines changed: 14 additions & 11 deletions

File tree

Binary file not shown.
Binary file not shown.

torax/torax_imastools/tests/core_profiles_test.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
from torax.config import build_runtime_params
3636
from torax.orchestration.run_simulation import prep_simulation
3737
from torax.tests.test_lib import sim_test_case
38-
from torax.torax_imastools.equilibrium import geometry_to_IMAS
3938
from torax.torax_imastools.util import load_IMAS_data, load_ids_from_Data_entry, update_dict
4039
from torax.torax_imastools.core_profiles import core_profiles_from_IMAS, core_profiles_to_IMAS
4140
from torax.torax_pydantic import model_config
@@ -65,9 +64,10 @@ def test_run_with_core_profiles_to_IMAS(
6564
config = self._get_config_dict(config_name)
6665

6766
#Has to be replaced to load open access data
68-
path = '/home/ITER/belloum/git/torax_dir/torax/torax/data/third_party/geo/scenario.yaml' #Specify path to load core_profiles -> should we generate example core_profiles ?
69-
# core_profiles_in = load_IMAS_data(path, "core_profiles")
70-
core_profiles_in = load_ids_from_Data_entry(path, "core_profiles")
67+
# path = '/home/ITER/belloum/git/torax_dir/torax/torax/data/third_party/geo/scenario.yaml' #Specify path to load core_profiles -> should we generate example core_profiles ?
68+
path = 'torax/data/third_party/geo/core_profiles_ddv4_iterhybrid_rampup_conditions.nc'
69+
core_profiles_in = load_IMAS_data(path, "core_profiles")
70+
# core_profiles_in = load_ids_from_Data_entry(path, "core_profiles")
7171

7272
# Modifying the input config profiles_conditions class
7373
core_profiles_conditions = core_profiles_from_IMAS(core_profiles_in)
@@ -106,9 +106,11 @@ def test_init_profiles_from_IMAS(
106106
# Input core_profiles reading and config loading
107107
config = self._get_config_dict(config_name)
108108
#Has to be replaced to load open access data
109-
path = '/home/ITER/belloum/git/torax_dir/torax/torax/data/third_party/geo/scenario.yaml' #Specify path to load core_profiles -> should we generate example core_profiles ?
110-
# core_profiles_in = load_IMAS_data(path, "core_profiles")
111-
core_profiles_in = load_ids_from_Data_entry(path, "core_profiles")
109+
# path = '/home/ITER/belloum/git/torax_dir/torax/torax/data/third_party/geo/scenario.yaml' #Specify path to load core_profiles -> should we generate example core_profiles ?
110+
# path = 'torax/data/third_party/geo/core_profiles_ddv4_iterhybrid_rampup_conditions.nc'
111+
path = 'torax/data/third_party/geo/core_profiles_15MA_DT_50_50_flat_top_slice.nc' #Using another input core_profiles with more radial resolution.
112+
core_profiles_in = load_IMAS_data(path, "core_profiles")
113+
# core_profiles_in = load_ids_from_Data_entry(path, "core_profiles")
112114
rhon_in = core_profiles_in.profiles_1d[0].grid.rho_tor_norm
113115

114116
# Modifying the input config profiles_conditions class
@@ -151,7 +153,7 @@ def test_init_profiles_from_IMAS(
151153
)
152154
np.testing.assert_allclose(
153155
np.interp(rhon_in, face_centers, init_core_profiles["psi"].face_value()),
154-
-1 * core_profiles_in.profiles_1d[0].grid.psi,
156+
core_profiles_in.profiles_1d[0].grid.psi,
155157
rtol=rtol,
156158
atol=atol,
157159
err_msg="psi profile failed",
@@ -175,9 +177,10 @@ def test_save_profiles_to_IMAS(
175177
# Input core_profiles reading and config loading
176178
config = self._get_config_dict(config_name)
177179
#Has to be replaced to load open access data
178-
path = '/home/ITER/belloum/git/torax_dir/torax/torax/data/third_party/geo/scenario.yaml' #Specify path to load core_profiles -> should we generate example core_profiles ?
179-
# core_profiles_in = load_IMAS_data(path, "core_profiles")
180-
core_profiles_in = load_ids_from_Data_entry(path, "core_profiles")
180+
# path = '/home/ITER/belloum/git/torax_dir/torax/torax/data/third_party/geo/scenario.yaml' #Specify path to load core_profiles -> should we generate example core_profiles ?
181+
path = 'torax/data/third_party/geo/core_profiles_ddv4_iterhybrid_rampup_conditions.nc'
182+
core_profiles_in = load_IMAS_data(path, "core_profiles")
183+
# core_profiles_in = load_ids_from_Data_entry(path, "core_profiles")
181184

182185
# Modifying the input config profiles_conditions class
183186
core_profiles_conditions = core_profiles_from_IMAS(core_profiles_in, read_psi_from_geo = False)

0 commit comments

Comments
 (0)