Skip to content

Commit b2913f6

Browse files
renamed imaspy to imas
1 parent 693f035 commit b2913f6

File tree

311 files changed

+4631
-3343
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

311 files changed

+4631
-3343
lines changed

.gitignore

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,21 +91,16 @@ ENV/
9191
*.swo
9292

9393
# SCM setuptools
94-
imaspy/version.py
95-
96-
# Saxon symlink or downloaded file
97-
saxon*.jar
94+
imas/_version.py
9895

9996
# IMAS DD
10097
data-dictionary
101-
access-layer
102-
containers/arch/imaspy/
98+
containers/arch/imas/
10399
containers/arch/data-dictionary/
104-
containers/arch/access-layer/
105-
imaspy/assets/IDSDef.zip
100+
imas/assets/IDSDef.zip
106101

107102
# IDS files
108-
*.ids
103+
# *.ids
109104

110105
# ASV folder
111106
/.asv

MANIFEST.in

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
include imaspy/assets/IDSDef.zip
2-
include imaspy/assets/IDSDef2MDSpreTree.xsl
3-
include imaspy/assets/ITER_134173_106_equilibrium.ids
4-
include imaspy/assets/ITER_134173_106_core_profiles.ids
5-
include imaspy/assets/equilibrium.ids
6-
include imaspy/assets/core_profiles.ids
1+
include imas/assets/IDSDef.zip
2+
include imas/assets/IDSDef2MDSpreTree.xsl
3+
include imas/assets/ITER_134173_106_equilibrium.ids
4+
include imas/assets/ITER_134173_106_core_profiles.ids
5+
include imas/assets/equilibrium.ids
6+
include imas/assets/core_profiles.ids

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# IMAS-Python
1+
# imas-python
22

3-
IMAS-Python is a pure-python library to handle arbitrarily nested data structures.
4-
It is designed for, but not necessarily bound to, interacting with Interface
3+
imas-python is a pure-python library to handle arbitrarily nested data structures.
4+
imas-python is designed for, but not necessarily bound to, interacting with Interface
55
Data Structures (IDSs) as defined by the Integrated Modelling & Analysis Suite (IMAS)
66
Data Model.
77

@@ -11,7 +11,7 @@ Data Model.
1111
Install steps are described in the documentation generated from `/docs/source/installing.rst`.
1212

1313
Documentation is autogenerated from the source using [Sphinx](http://sphinx-doc.org/)
14-
and can be found at the [ITER sharepoint](https://sharepoint.iter.org/departments/POP/CM/IMDesign/Code%20Documentation/IMAS-doc/index.html)
14+
and can be found at the [readthedocs](https://imas-python.readthedocs.io/en/latest/)
1515

1616
The documentation can be manually generated by installing sphinx and running:
1717

@@ -40,7 +40,7 @@ A quick 5 minutes introduction is available in the documentation generated from
4040

4141
## Legal
4242

43-
IMAS-Python is Copyright 2020-2024 ITER Organization, Copyright 2020-2023 Karel Lucas van de
43+
imas-python is Copyright 2020-2024 ITER Organization, Copyright 2020-2023 Karel Lucas van de
4444
Plassche <karelvandeplassche@gmail.com>, Copyright 2020-2022 Daan van Vugt <dvanvugt@ignitioncomputing.com>,
4545
and Copyright 2020 Dutch Institute for Fundamental Energy Research <info@differ.nl>.
4646
It is licensed under [LGPL 3.0](LICENSE.txt).

asv.conf.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
"version": 1,
55

66
// The name of the project being benchmarked
7-
"project": "imaspy",
7+
"project": "imas",
88

99
// The project's homepage
10-
"project_url": "https://git.iter.org/projects/IMAS/repos/imaspy/browse",
10+
"project_url": "https://github.com/iterorganization/imas-python",
1111

1212
// The URL or local path of the source code repository for the
1313
// project being benchmarked
@@ -53,7 +53,7 @@
5353
//"install_timeout": 600,
5454

5555
// the base URL to show a commit for the project.
56-
"show_commit_url": "https://git.iter.org/projects/IMAS/repos/imaspy/commits/",
56+
"show_commit_url": "https://github.com/iterorganization/imas-python/commits/main/",
5757

5858
// The Pythons you'd like to test against. If not provided, defaults
5959
// to the current version of Python used to run `asv`.

benchmarks/core_profiles.py

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import numpy as np
55

6-
import imaspy
6+
import imas
77

88
from .utils import (
99
available_backends,
@@ -22,16 +22,16 @@ def fill_slices(core_profiles, times):
2222
"""Fill a time slice of a core_profiles IDS with generated data.
2323
2424
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)
2626
times: time values to fill a slice for
2727
"""
2828
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"
3030
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__
3333
core_profiles.code.repository = (
34-
"https://git.iter.org/projects/IMAS/repos/imaspy/browse"
34+
"https://github.com/iterorganization/imas-python"
3535
)
3636

3737
core_profiles.time = np.array(times)
@@ -50,7 +50,14 @@ def fill_slices(core_profiles, times):
5050
profiles_1d.ion.resize(len(ions))
5151
profiles_1d.neutral.resize(len(ions))
5252
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
5461
profiles_1d.ion[i].z_ion = 1.0
5562
profiles_1d.ion[i].neutral_index = profiles_1d.neutral[i].ion_index = i + 1
5663

@@ -74,7 +81,7 @@ def setup(self, hli, backend):
7481

7582
def time_get_slice(self, hli, backend):
7683
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)
7885

7986
def teardown(self, hli, backend):
8087
if hasattr(self, "dbentry"): # imas + netCDF has no dbentry
@@ -96,8 +103,8 @@ class LazyGet:
96103
param_names = ["lazy", "backend"]
97104

98105
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()
101108
fill_slices(core_profiles, TIME)
102109
self.dbentry.put(core_profiles)
103110

benchmarks/edge_profiles.py

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import numpy as np
55

6-
import imaspy
6+
import imas
77

88
from .utils import available_backends, create_dbentry, factory, hlis
99

@@ -17,18 +17,18 @@ def fill_ggd(edge_profiles, times):
1717
"""Fill nested arrays of structures in grids_ggd and ggd substructures.
1818
1919
Args:
20-
edge_profiles: edge_profiles IDS object (either from IMASPy or AL HLI)
20+
edge_profiles: edge_profiles IDS object (either from imas-python or AL HLI)
2121
times: time values to fill
2222
"""
2323
edge_profiles.ids_properties.homogeneous_time = (
24-
imaspy.ids_defs.IDS_TIME_MODE_HETEROGENEOUS
24+
imas.ids_defs.IDS_TIME_MODE_HETEROGENEOUS
2525
)
26-
edge_profiles.ids_properties.comment = "Generated for IMASPy benchmark suite"
26+
edge_profiles.ids_properties.comment = "Generated for imas-python benchmark suite"
2727
edge_profiles.ids_properties.creation_date = datetime.date.today().isoformat()
28-
edge_profiles.code.name = "IMASPy ASV benchmark"
29-
edge_profiles.code.version = imaspy.__version__
28+
edge_profiles.code.name = "imas-python ASV benchmark"
29+
edge_profiles.code.version = imas.__version__
3030
edge_profiles.code.repository = (
31-
"https://git.iter.org/projects/IMAS/repos/imaspy/browse"
31+
"https://github.com/iterorganization/imas-python"
3232
)
3333

3434
# This GGD grid is not a valid description, but it's a good stress test for the
@@ -46,7 +46,13 @@ def fill_ggd(edge_profiles, times):
4646
grid.space[i].identifier.index = 1
4747
grid.space[i].identifier.description = "Description...."
4848
grid.space[i].geometry_type.index = 0
49-
grid.space[0].coordinates_type = np.array([4, 5], dtype=np.int32)
49+
grid.space[0].coordinates_type.resize(1)
50+
if imas.__version__ >= "4.0.0":
51+
grid.space[0].coordinates_type = np.array([4, 5], dtype=np.int32)
52+
else:
53+
grid.space[0].coordinates_type[0].name = "coordinates type"
54+
grid.space[0].coordinates_type[0].index = 0
55+
grid.space[0].coordinates_type[0].name = "example coordinates type"
5056
grid.space[0].objects_per_dimension.resize(3) # points, lines, surfaces
5157
points = grid.space[0].objects_per_dimension[0].object
5258
points.resize(N_POINTS)
@@ -61,7 +67,13 @@ def fill_ggd(edge_profiles, times):
6167
for i in range(N_SURFACES):
6268
surfaces[i].nodes = np.random.randint(1, N_LINES + 1, 4, dtype=np.int32)
6369

64-
grid.space[1].coordinates_type = np.array([6], dtype=np.int32)
70+
grid.space[1].coordinates_type.resize(1)
71+
if imas.__version__ >= "4.0.0":
72+
grid.space[1].coordinates_type = np.array([6], dtype=np.int32)
73+
else:
74+
grid.space[1].coordinates_type[0].name = "coordinates type"
75+
grid.space[1].coordinates_type[0].index = 0
76+
grid.space[1].coordinates_type[0].name = "example coordinates type"
6577
grid.space[1].objects_per_dimension.resize(2)
6678
obp = grid.space[1].objects_per_dimension[0]
6779
obp.object.resize(2)

benchmarks/technical.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,11 @@
1-
import imaspy
21
import imas
32

43

5-
def timeraw_create_default_imaspy_factory():
4+
def timeraw_create_default_imas_factory():
65
# timeraw to ensure that nothing is cached
76
return """
8-
import imaspy
9-
imaspy.IDSFactory()
10-
"""
11-
12-
13-
def timeraw_import_imaspy():
14-
return """
15-
import imaspy
7+
import imas
8+
imas.IDSFactory()
169
"""
1710

1811

@@ -38,6 +31,6 @@ def track_imas_versions():
3831
)
3932
4033
41-
def track_imaspy_dd_version():
42-
return imaspy.IDSFactory().version
34+
def track_imas_dd_version():
35+
return imas.IDSFactory().version
4336
"""

benchmarks/utils.py

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,8 @@
33
import uuid
44
from pathlib import Path
55

6-
import imaspy
7-
import imaspy.exception
8-
9-
# Don't directly import imas: code analyzers break on the huge code base
10-
imas = importlib.import_module("imas")
11-
6+
import imas
7+
import imas.exception
128

139
# Backend constants
1410
HDF5 = "HDF5"
@@ -28,11 +24,11 @@ def backend_exists(backend):
2824
"""Tries to detect if the lowlevel has support for the given backend."""
2925
uri = create_uri(backend, str(uuid.uuid4()))
3026
try:
31-
entry = imaspy.DBEntry(uri, "r")
27+
entry = imas.DBEntry(uri, "r")
3228
except Exception as exc:
3329
if "backend is not available" in str(exc):
3430
return False
35-
elif isinstance(exc, (imaspy.exception.ALException, FileNotFoundError)):
31+
elif isinstance(exc, (imas.exception.ALException, FileNotFoundError)):
3632
return True
3733
return True
3834
# Highly unlikely, but it could succeed without error
@@ -60,32 +56,27 @@ def backend_exists(backend):
6056
backend for backend in available_backends if backend not in [ASCII, NETCDF]
6157
]
6258

63-
hlis = ["imas", "imaspy"]
59+
hlis = ["imas"]
6460
DBEntry = {
6561
"imas": imas.DBEntry,
66-
"imaspy": imaspy.DBEntry,
6762
}
6863
factory = {
69-
"imas": imas,
70-
"imaspy": imaspy.IDSFactory(),
64+
"imas": imas.IDSFactory(),
7165
}
72-
available_serializers = [imaspy.ids_defs.ASCII_SERIALIZER_PROTOCOL]
66+
available_serializers = [imas.ids_defs.ASCII_SERIALIZER_PROTOCOL]
7367

7468

7569
def create_dbentry(hli, backend):
7670
if backend == NETCDF:
77-
if hli == "imas":
78-
# Raising NotImplementedError will skip the benchmarks for this combination
79-
raise NotImplementedError("AL-Python HLI doesn't implement netCDF.")
80-
if hli == "imaspy": # check if netcdf backend is available
71+
if hli == "imas": # check if netcdf backend is available
8172
try:
8273
assert (
83-
imaspy.DBEntry._select_implementation("x.nc").__name__
74+
imas.DBEntry._select_implementation("x.nc").__name__
8475
== "NCDBEntryImpl"
8576
)
8677
except (AttributeError, AssertionError):
8778
raise NotImplementedError(
88-
"This version of IMASPy doesn't implement netCDF."
79+
"This version of imas-python doesn't implement netCDF."
8980
) from None
9081

9182
path = Path.cwd() / f"DB-{hli}-{backend}"

ci/build_dd_zip.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ echo "Done loading modules"
1717
set -x
1818

1919
# Build the DD zip
20-
python imaspy/dd_helpers.py
20+
python imas/dd_helpers.py

ci/build_docs_and_dist.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
# Bamboo CI script to install imaspy and run all tests
2+
# Bamboo CI script to install imas and run all tests
33
# Note: this script should be run from the root of the git repository
44

55
# Debuggging:
@@ -27,7 +27,7 @@ pip install --upgrade pip setuptools wheel build
2727
rm -rf dist
2828
python -m build .
2929

30-
# Install imaspy and documentation dependencies from the just-built wheel
30+
# Install imas and documentation dependencies from the just-built wheel
3131
pip install "`readlink -f dist/*.whl`[docs,netcdf]"
3232

3333
# Debugging:

0 commit comments

Comments
 (0)