Skip to content

Fix a regression on mdsplus models generation - #147

Merged
olivhoenen merged 3 commits into
iterorganization:developfrom
olivhoenen:fix/mds_models_generation
Oct 22, 2026
Merged

olivhoenen merged 3 commits into
iterorganization:developfrom
olivhoenen:fix/mds_models_generation

Conversation

@olivhoenen

@olivhoenen olivhoenen commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Fix #146
Affects IMAS-Python since 2.2.0 (but only when used with IMAS-Core>=5.6)
Also use this opportunity to remove a warning raised by Java-25 when running jTraverser.

@olivhoenen
olivhoenen force-pushed the fix/mds_models_generation branch from 95cc14f to af282ce Compare October 22, 2026 12:22

@prasad-sawantdesai prasad-sawantdesai left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix. It works..

$ python summary_rw.py 
16:23:19 INFO     Parsing data dictionary version 4.1.1 @dd_zip.py:89
16:23:19 INFO     Creating and caching MDSplus model at /tmp/sawantp1/imas/mdsplus/4.1.1.xml-8183868f_1959966d92a34fc0959de542a41f0353, this may take a while @mdsplus_model.py:177
16:24:46 INFO     MDSplus model at /tmp/sawantp1/imas/mdsplus/4.1.1.xml-8183868f_1959966d92a34fc0959de542a41f0353 created, moving to /home/ITER/sawantp1/.cache/imas/mdsplus/4.1.1.xml-8183868f @mdsplus_model.py:184
Wrote summary to imas:mdsplus?path=./summary_test (DD 4.1.1)
Read 11 time points
  t =  0.000 s   ip =   -0.000 MA
  t =  0.100 s   ip =   -6.932 MA
  t =  0.200 s   ip =  -11.424 MA
  t =  0.300 s   ip =  -13.577 MA
  t =  0.400 s   ip =  -14.460 MA
  t =  0.500 s   ip =  -14.799 MA
  t =  0.600 s   ip =  -14.926 MA
  t =  0.700 s   ip =  -14.973 MA
  t =  0.800 s   ip =  -14.990 MA
  t =  0.900 s   ip =  -14.996 MA
  t =  1.000 s   ip =  -14.999 MA
Round-trip OK

$ module list 2>&1 | grep -i IMAS-Core
 18) libffi/3.4.4-GCCcore-13.2.0              39) libxslt/1.1.38-GCCcore-13.2.0              60) LibTIFF/4.6.0-GCCcore-13.2.0              81) IMAS-Core/5.7.1-intel-2023b

$ python -c "import imas; print(imas.__version__)"
2.3.1.dev8
$ export IMAS_VERSION=3.42.2
$ python summary_rw.py 
16:27:30 INFO     Parsing data dictionary version 3.42.2 @dd_zip.py:89
16:27:30 INFO     Creating and caching MDSplus model at /tmp/sawantp1/imas/mdsplus/3.42.2.xml-d66c8a74_e1e0ff1de52a466c8d0df4268b774b8e, this may take a while @mdsplus_model.py:177
16:29:02 INFO     MDSplus model at /tmp/sawantp1/imas/mdsplus/3.42.2.xml-d66c8a74_e1e0ff1de52a466c8d0df4268b774b8e created, moving to /home/ITER/sawantp1/.cache/imas/mdsplus/3.42.2.xml-d66c8a74 @mdsplus_model.py:184
Wrote summary to imas:mdsplus?path=./summary_test (DD 3.42.2)
Read 11 time points
  t =  0.000 s   ip =   -0.000 MA
  t =  0.100 s   ip =   -6.932 MA
  t =  0.200 s   ip =  -11.424 MA
  t =  0.300 s   ip =  -13.577 MA
  t =  0.400 s   ip =  -14.460 MA
  t =  0.500 s   ip =  -14.799 MA
  t =  0.600 s   ip =  -14.926 MA
  t =  0.700 s   ip =  -14.973 MA
  t =  0.800 s   ip =  -14.990 MA
  t =  0.900 s   ip =  -14.996 MA
  t =  1.000 s   ip =  -14.999 MA
Round-trip OK
$ cat summary_rw.py 
#!/usr/bin/env python
import numpy as np
import imas

uri = f"imas:mdsplus?path=./summary_test"

# ---- Write ----
time = np.linspace(0.0, 1.0, 11)          # s
ip = -15.0e6 * np.tanh(5.0 * time)        # A (ramp-up to -15 MA)

with imas.DBEntry(uri, "w") as dbentry:
    summary = dbentry.factory.summary()
    summary.ids_properties.homogeneous_time = imas.ids_defs.IDS_TIME_MODE_HOMOGENEOUS
    summary.ids_properties.comment = "Test summary IDS: time + ip"
    summary.time = time
    summary.global_quantities.ip.value = ip
    dbentry.put(summary)
    print(f"Wrote summary to {uri} (DD {dbentry.factory.version})")

# ---- Read ----
with imas.DBEntry(uri, "r") as dbentry:
    summary = dbentry.get("summary")
    t = summary.time
    ip_r = summary.global_quantities.ip.value
    print(f"Read {len(t)} time points")
    for ti, ipi in zip(t, ip_r):
        print(f"  t = {ti:6.3f} s   ip = {ipi / 1e6:8.3f} MA")

assert np.allclose(t, time) and np.allclose(ip_r, ip)
print("Round-trip OK")

Comment thread imas/backends/imas_core/mdsplus_model.py
@olivhoenen
olivhoenen merged commit 39c5739 into iterorganization:develop Oct 22, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issue in MDSplus models generation (IMAS-Core>=5.6)

2 participants