Skip to content

Feature/geometry overlay#79

Open
jwasikpsnc wants to merge 13 commits into
iterorganization:developfrom
jwasikpsnc:feature/geometry_overlay
Open

Feature/geometry overlay#79
jwasikpsnc wants to merge 13 commits into
iterorganization:developfrom
jwasikpsnc:feature/geometry_overlay

Conversation

@jwasikpsnc

Copy link
Copy Markdown
Collaborator
  • New endpoint /ids_info/geometry_overlay_nodes
    • returns geometry overlay nodes from IDS (pointed by uri)
    • allows to show/hide structures
    • allows to show/hide empty nodes (IMAS-Core >= 5.7 & IMAS-Python >= 2.2.2)
    • allows to show/hide error bars

@jwasikpsnc

Copy link
Copy Markdown
Collaborator Author

FYI @mfiaudrin-epsyl

@mfiaudrin-epsyl

mfiaudrin-epsyl commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator

Hi @jwasikpsnc,

Thank you for the feature. I think the geometries returned are insufficient. @olivhoenen Can you please ensure if I undestand well the geometries I have to overlay ?

I explain my point of view. Currently, the endpoint return all geometry nodes included somewhere in the given uri.
However, I don't think it's the exepected behavior checking with this example given by @olivhoenen :
image

As you can see, in this example the uri is : imas:hdf5?path=/home/ITER/hoeneno/public/expdata/HL3/20250515#equilibrium:0/time_slice[:]/profiles_2d[:]/psi
Since the data displayed is in equilibrium, we don't receive geometries from pf_active and wall :
image

In the feature I am implementing, I want to display #equilibrium:0/time_slice[:]/profiles_2d[:]/psi and to overlay geometries from pf_active and wall (maybe I have more geometries to overlay but I think I should at least overlay the mentionned ones).

Currently in my feature, the paths I overlay with psi are :

  • '#wall:0/description_2d[:]/limiter/unit[:]/outline',
  • '#pf_active/coil[:]/element[:]/geometry/rectangle',
  • '#pf_active/coil[:]/element[:]/geometry/oblique',

There are the overlayed geometries :
image

If I am not wrong, we should get all geometries having data from this uri: imas:hdf5?path=/home/ITER/hoeneno/public/expdata/HL3/20250515 but it doesn't return anything:
image

@olivhoenen Can you please confirm what geometries we need to overlay in in this example ?

FYI @imbeauf

@jwasikpsnc

Copy link
Copy Markdown
Collaborator Author

@mfiaudrin-epsyl
Current behavior returns geometries from IDS pointed by URI.
Do you want to get all geometry nodes from whole pulsefile and all IDSes, or you need some more logic to return only geometries plottable on the same plot with for instance psi?
I am not sure how we can extract this information from DD.

@mfiaudrin-epsyl

Copy link
Copy Markdown
Collaborator

@mfiaudrin-epsyl Current behavior returns geometries from IDS pointed by URI. Do you want to get all geometry nodes from whole pulsefile and all IDSes, or you need some more logic to return only geometries plottable on the same plot with for instance psi? I am not sure how we can extract this information from DD.

@jwasikpsnc I would like that the BE returns me all plottable geometries compatible with the displayed plot. To do that I think we need to get them from whole pulsefile but we certainly need to add more logic to the rule.

I don't know what is the rule so it will simplify the FE to ask to the BE what geometries I should overlay. Maybe we need @olivhoenen and @imbeauf to clarify this need.

@jwasikpsnc jwasikpsnc marked this pull request as draft June 3, 2026 06:12
@maarten-ic

Copy link
Copy Markdown

There is a lot of geometric data that can be stored in IMAS: shouldn't the user select which geometries they want to overlay, instead of IBEX plotting everything that's stored in the dataset? Maybe that could work in a similar way as that users now select which quantities they want to plot?

Sometimes you may want to plot geometry data from a machine description URI and overlay with data from another URI: will that be possible?

@imbeauf

imbeauf commented Jun 3, 2026

Copy link
Copy Markdown

If I understood correctly, the idea of Olivier is:

  1. The BE sends to the FE all the non-empty geometries (defined as per the generic types that we chose) of the selected data entry (i.e. all IDSs)
  2. The paths of the non-empty geometries form a menu on the FE
  3. The user selects from the menu which data he wants to overlay

@imbeauf

imbeauf commented Jun 3, 2026

Copy link
Copy Markdown

Sometimes you may want to plot geometry data from a machine description URI and overlay with data from another URI: will that be possible?

I agree that this would be useful, but this may double the size of the menu for selecting which URIs to plot ... not sure that this will be very practical if we keep this menu concept.

@mfiaudrin-epsyl

Copy link
Copy Markdown
Collaborator

The fact that we want to display geometries from another URI should be possible.

Maybe we could allow the user to select the geometries he want to display in the visual customization component ?
In that case, I could add an accordion to select geometries and I could provide a parameter to choose the URI used for the geometry.

If needed, I can allow the user to add geometries from several URIs at the same time. Do you think it will be usefull or we just want to display geometries from one URI ?

@imbeauf

imbeauf commented Jun 3, 2026

Copy link
Copy Markdown

Displaying geometries from different URIs will certainly be useful, if you find a way to present this nicely on the FE !

@mfiaudrin-epsyl

Copy link
Copy Markdown
Collaborator

@jwasikpsnc, having this conversation helps me to clarify the wanted response from BE.

I would like to always get the structures and their parameters. So I don't need the parameter show_structures, it could be always set to true.

I will use this object to easily use the data returned by your endpoint:

[
    {
        geometryNode: 'imas:hdf5?path=/home/ITER/hoeneno/public/expdata/HL3/20250515#pf_active:0/coil[:]/element[:]/geometry/rectangle/',
        parameters: ['r', 'z', 'width', 'height'],
    },
    ...
]

Is it possible for you to return the data in an object like this one ?

@jwasikpsnc jwasikpsnc marked this pull request as ready for review June 8, 2026 11:13
@jwasikpsnc

Copy link
Copy Markdown
Collaborator Author

@olivhoenen This PR is ready for further review

@mfiaudrin-epsyl Please check if new endpoint fulfills your needs

@mfiaudrin-epsyl

Copy link
Copy Markdown
Collaborator

Hi @jwasikpsnc,

I am testing with:
URI : imas:hdf5?path=/home/ITER/hoeneno/public/expdata/HL3/20250515#equilibrium:0/time_slice[:]/profiles_2d[:]/psi

It almost good for me. The only thing to improves is here:
image

Instead of element[:]/geometry list of nodes, I would like to have each nodes with their parameters:

  • geometry_node: element[:]/geometry/outline
    • parameters: ["r", "z"]
  • geometry_node: element[:]/geometry/rectangle
    • parameters: ["r", "z", "width", "height"]
  • etc.

Here is the structure from IBEX tree:
image

About geometry/geometry_type node I'm wondering if we need it. It's a leaf node and currently I don't know if we have to handle it and how.

@jwasikpsnc jwasikpsnc marked this pull request as draft June 8, 2026 11:55
@jwasikpsnc

Copy link
Copy Markdown
Collaborator Author

Ok, understood.
Will do it tomorrow

@maarten-ic

Copy link
Copy Markdown

About geometry/geometry_type node I'm wondering if we need it. It's a leaf node and currently I don't know if we have to handle it and how.

The geometry_type should be filled with a number that indicates which of the geometry nodes are filled. See for example the documentation in pf_active: https://imas-data-dictionary.readthedocs.io/en/latest/generated/ids/pf_active.html#pf_active-coil-geometry-geometry_type

Type used to describe the element shape (1:’outline’, 2:’rectangle’, 3:’oblique’, 4:’arcs of circle, 5: ‘annulus’, 6 : ‘thick line’)

It may be more efficient to parse the geometry_type so you know which of the actual geometry data you need to read?

@jwasikpsnc

jwasikpsnc commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator Author

Current implementation cuts out geometry_type from list.
If not cutted out response will contain something like this:

{
  "geometry_node": "imas:hdf5?path=/home/ITER/hoeneno/public/expdata/HL3/20250515#pf_active:0/coil[:]/element[:]/geometry",
  "parameters": ["geometry_type"]
}

Would it be useful for you @mfiaudrin-epsyl?

@mfiaudrin-epsyl

Copy link
Copy Markdown
Collaborator

Current implementation cuts out geometry_type from list. If not cutted out response will contain something like this:

{
  "geometry_node": "imas:hdf5?path=/home/ITER/hoeneno/public/expdata/HL3/20250515#pf_active:0/coil[:]/element[:]/geometry",
  "parameters": ["geometry_type"]
}

Would it be useful for you @mfiaudrin-epsyl?

Yes, the not cutted out response will be better

@mfiaudrin-epsyl

Copy link
Copy Markdown
Collaborator

About geometry/geometry_type node I'm wondering if we need it. It's a leaf node and currently I don't know if we have to handle it and how.

The geometry_type should be filled with a number that indicates which of the geometry nodes are filled. See for example the documentation in pf_active: https://imas-data-dictionary.readthedocs.io/en/latest/generated/ids/pf_active.html#pf_active-coil-geometry-geometry_type

Type used to describe the element shape (1:’outline’, 2:’rectangle’, 3:’oblique’, 4:’arcs of circle, 5: ‘annulus’, 6 : ‘thick line’)

It may be more efficient to parse the geometry_type so you know which of the actual geometry data you need to read?

Ok thank you. I will test it once I will return on geometry overlay feature. If there is a way we can improve performances I will inform how we can do it.

@mfiaudrin-epsyl

Copy link
Copy Markdown
Collaborator

Could be done. Simplest will be to add key to ids_info/node_info/ response. For uri: imas:hdf5?path=/home/ITER/hoeneno/public/expdata/HL3/20250515#pf_active:0/coil[:]/element[:]/geometry:

{
  "name": "geometry",
  "type": "structure",
  "ndim": 0,
  "shape": [],
  "has_data": null,
  "is_geometry_strucure": True # <========= HERE
  "children": [
    {
      "name": "geometry_type",
      "type": "INT",
      "ndim": 0,
      "has_data": null
    },
    ...
    {
      "name": "thick_line",
      "type": "structure",
      "ndim": 0,
      "has_data": null
    }
  ],
  "coordinates": [
    "1...N",
    "1...N"
  ]
}

I would add "is_geometry_strucure": True key. Is it ok to have it only on structure level?:

`coil[:]/element[:]/geometry`

or do you need it also for children structures and leaf nodes?

`coil[:]/element[:]/geometry/outline`
`coil[:]/element[:]/geometry/outline/r`
`coil[:]/element[:]/geometry/outline/z`

It is much easier for me to do it only for geometry stuctures, without chilren

Which solution fits you best?

Ok the is_geometry_strucure attribut is good for me. I will prefer to also add this attribut in the leaf nodes but if it's more works for you don't worry. I will add a rule in the FE to provide the geometry information in his children

@jwasikpsnc

Copy link
Copy Markdown
Collaborator Author

Done with one minor change
replaced is_geometry_strucure with is_geometry_node so it won't cause confusion when assigned to leaf nodes.

Now is_geometry_node is returned in /ids_info/node_info/

Example:
imas:hdf5?path=/home/ITER/hoeneno/public/expdata/HL3/20250515#pf_active:0/coil[:]/element[:]

{
  "name": "element",
  "type": "struct_array",
  "ndim": 1,
  "shape": [],
  "is_geometry_node": false,
  "has_data": null,
  "children": [
    {
      "name": "name",
      "type": "STR",
      "ndim": 0,
      "is_geometry_node": false,
      "has_data": null
    },
    ...
    {
      "name": "geometry",
      "type": "structure",
      "ndim": 0,
      "is_geometry_node": true,
      "has_data": null
    }
  ],
  "coordinates": [
    "1...N",
    "1...N"
  ]
}

@maarten-ic

Copy link
Copy Markdown

@jwasikpsnc At the tree, I would like to prevent users from clicking in geometry nodes by displaying them with the disabled state. However, currently I don't know which node is used for geometry.

It may still be relevant to view the metadata associated to geometry nodes (for example, the exact values). Is that still possible when you disable the geometry nodes in the tree?

@mfiaudrin-epsyl

Copy link
Copy Markdown
Collaborator

@jwasikpsnc At the tree, I would like to prevent users from clicking in geometry nodes by displaying them with the disabled state. However, currently I don't know which node is used for geometry.

It may still be relevant to view the metadata associated to geometry nodes (for example, the exact values). Is that still possible when you disable the geometry nodes in the tree?

It can be done if needed. I propose this solution:

  • Disable the geometry nodes only when we update a graph (in order to prevent adding geometries from the tree).
  • When no graph are in edited, allow to select geometry nodes from the tree. In this case, I will add a rule to display only their metadata.

@mfiaudrin-epsyl mfiaudrin-epsyl 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.

The behavior works as expected in FE.

Once merged, I will call the new endpoint to get geometries to display and I will adapt the logic in the tree with geometry nodes.

@mfiaudrin-epsyl mfiaudrin-epsyl self-requested a review June 9, 2026 09:58
@mfiaudrin-epsyl

Copy link
Copy Markdown
Collaborator

About show_empty_nodes parameter, it looks that /ids_info/geometry_overlay_nodes endpoint return nodes having no data even if show_empty_nodes is set to false. Is it normal ?

@jwasikpsnc

Copy link
Copy Markdown
Collaborator Author

It is normal for IMAS_CORE < 5.7 and IMAS-Python < 2.2.2

@jwasikpsnc jwasikpsnc marked this pull request as ready for review June 9, 2026 10:06
@mfiaudrin-epsyl

Copy link
Copy Markdown
Collaborator

Hi @jwasikpsnc,

Is it possible to also have is_geometry_node attribut in response of /ids_info/find_paths endpoint ?

I need it to get the information when we use the feature to search nodes

@jwasikpsnc

Copy link
Copy Markdown
Collaborator Author

Yes, it is.
I will do it

@jwasikpsnc jwasikpsnc marked this pull request as draft June 10, 2026 08:00
@jwasikpsnc jwasikpsnc marked this pull request as ready for review June 11, 2026 11:09
@jwasikpsnc

Copy link
Copy Markdown
Collaborator Author

@mfiaudrin-epsyl done

@olivhoenen
You can go further with review

@jwasikpsnc jwasikpsnc marked this pull request as draft June 12, 2026 08:29
@jwasikpsnc

Copy link
Copy Markdown
Collaborator Author

Hi @mfiaudrin-epsyl
Here's my proposition
Instead of having every geometry sub-structure separately:

    {
      "geometry_node": "imas:hdf5?path=/work/imas/shared/imasdb/ITER/3/135011/7#pf_active:0/coil[:]/element[:]/geometry/outline",
      "parameters": [
        "r",
        "z"
      ]
    },
    {
      "geometry_node": "imas:hdf5?path=/work/imas/shared/imasdb/ITER/3/135011/7#pf_active:0/coil[:]/element[:]/geometry/rectangle",
      "parameters": [
        "r",
        "z",
        "width",
        "height"
      ]
    },
    {
      "geometry_node": "imas:hdf5?path=/work/imas/shared/imasdb/ITER/3/135011/7#pf_active:0/coil[:]/element[:]/geometry/oblique",
      "parameters": [
        "r",
        "z",
        "length_alpha",
        "length_beta",
        "alpha",
        "beta"
      ]
    },

We could put them in single dict:

        {
      "geometry_node": "imas:hdf5?path=/work/imas/shared/imasdb/ITER/3/135011/7#pf_active:0/coil[:]/element[:]/geometry",
      "parameters": [
        "outline/r",
        "outline/z"
        "rectangle/r",
        "rectangle/z",
        "rectangle/width",
        "rectangle/height"
        "oblique/r",
        "oblique/z",
        "oblique/length_alpha",
        "oblique/length_beta",
        "oblique/alpha",
        "oblique/beta"
      ]
    },

Would it help?
Feel free to express any opinions, you know better what exactly do you need 🙌

@mfiaudrin-epsyl

Copy link
Copy Markdown
Collaborator

Hi @jwasikpsnc,

Thank you for the solution. It works for me. It's great because it doesn't change the structure of the response.

@prasad-sawantdesai

Copy link
Copy Markdown
Contributor

You can also look for this implementation which covers all geometry types and its visualization.

https://github.com/iterorganization/IDStools/blob/develop/idstools/compute/pf_active.py#L32
https://github.com/iterorganization/IDStools/blob/develop/idstools/view/pf_active.py#L32

@jwasikpsnc jwasikpsnc marked this pull request as ready for review June 12, 2026 10:33
@jwasikpsnc

Copy link
Copy Markdown
Collaborator Author

@mfiaudrin-epsyl please check if the response is correct

@mfiaudrin-epsyl

Copy link
Copy Markdown
Collaborator

@jwasikpsnc It looks good but it doesn't works for thick_line geometry. I need all the parameters and currently I don't get the leaf nodes, just the get the nodes at 1st level:
image

@jwasikpsnc

Copy link
Copy Markdown
Collaborator Author

Should be fixed now

@mfiaudrin-epsyl

Copy link
Copy Markdown
Collaborator

Great, once it'll be merged I will finalize the FE with your updates.

@mfiaudrin-epsyl mfiaudrin-epsyl mentioned this pull request Jun 18, 2026
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.

5 participants