3
3
4
4
import numpy as np
5
5
6
- import imaspy
6
+ import imas
7
7
8
8
from .utils import (
9
9
available_backends ,
@@ -22,16 +22,16 @@ def fill_slices(core_profiles, times):
22
22
"""Fill a time slice of a core_profiles IDS with generated data.
23
23
24
24
Args:
25
- core_profiles: core_profiles IDS (either from IMASPy or AL HLI)
25
+ core_profiles: core_profiles IDS (either from imas-python or AL HLI)
26
26
times: time values to fill a slice for
27
27
"""
28
28
core_profiles .ids_properties .homogeneous_time = 1 # HOMOGENEOUS
29
- core_profiles .ids_properties .comment = "Generated for the IMASPy benchmark suite"
29
+ core_profiles .ids_properties .comment = "Generated for the imas-python benchmark suite"
30
30
core_profiles .ids_properties .creation_date = datetime .date .today ().isoformat ()
31
- core_profiles .code .name = "IMASPy ASV benchmark"
32
- core_profiles .code .version = imaspy .__version__
31
+ core_profiles .code .name = "imas-python ASV benchmark"
32
+ core_profiles .code .version = imas .__version__
33
33
core_profiles .code .repository = (
34
- "https://git.iter.org/projects/IMAS/repos/imaspy/browse "
34
+ "https://github.com/iterorganization/imas-python "
35
35
)
36
36
37
37
core_profiles .time = np .array (times )
@@ -50,7 +50,14 @@ def fill_slices(core_profiles, times):
50
50
profiles_1d .ion .resize (len (ions ))
51
51
profiles_1d .neutral .resize (len (ions ))
52
52
for i , ion in enumerate (ions ):
53
- profiles_1d .ion [i ].label = profiles_1d .neutral [i ].label = ion
53
+ if hasattr (profiles_1d .ion [i ], 'label' ):
54
+ profiles_1d .ion [i ].label = ion
55
+ profiles_1d .neutral [i ].label = ion
56
+ if hasattr (profiles_1d .ion [i ], 'name' ):
57
+ profiles_1d .ion [i ].name = ion
58
+ profiles_1d .neutral [i ].name = ion
59
+
60
+ # profiles_1d.ion[i].label = profiles_1d.neutral[i].label = ion
54
61
profiles_1d .ion [i ].z_ion = 1.0
55
62
profiles_1d .ion [i ].neutral_index = profiles_1d .neutral [i ].ion_index = i + 1
56
63
@@ -74,7 +81,7 @@ def setup(self, hli, backend):
74
81
75
82
def time_get_slice (self , hli , backend ):
76
83
for t in TIME :
77
- self .dbentry .get_slice ("core_profiles" , t , imaspy .ids_defs .CLOSEST_INTERP )
84
+ self .dbentry .get_slice ("core_profiles" , t , imas .ids_defs .CLOSEST_INTERP )
78
85
79
86
def teardown (self , hli , backend ):
80
87
if hasattr (self , "dbentry" ): # imas + netCDF has no dbentry
@@ -96,8 +103,8 @@ class LazyGet:
96
103
param_names = ["lazy" , "backend" ]
97
104
98
105
def setup (self , lazy , backend ):
99
- self .dbentry = create_dbentry ("imaspy " , backend )
100
- core_profiles = factory ["imaspy " ].core_profiles ()
106
+ self .dbentry = create_dbentry ("imas " , backend )
107
+ core_profiles = factory ["imas " ].core_profiles ()
101
108
fill_slices (core_profiles , TIME )
102
109
self .dbentry .put (core_profiles )
103
110
0 commit comments