Repository navigation
feat: maps of GGD values on unstructured grids - #17
Merged
Merged
Conversation
The values of a GGD quantity on an unstructured grid in the (R, Z) plane -- one space whose nodes are in R and Z, with 2D cells, as edge codes such as SOLPS write them -- are a map of the cells of the grid, each filled with the color of its value, with a color bar. - Values on the cells are theirs; values on the nodes give each cell the mean of its nodes. What the values are on comes from their grid subset: from its elements, or, for all the nodes (1) and all the cells (5), from its identifier, which the Data Dictionary declares implicitly. Values on other subsets (e.g. edges), or that do not fit, are drawn along their index as before. - The grid is that of the GGD (e.g. distribution_sources), or, in IDSs such as edge_profiles, the one of grid_ggd at the time of the values. The nodes are R and Z in the order the coordinates of the space say. - The nodes of a cell are put in order around it when their order crosses itself (e.g. the corners of a quadrilateral row by row). - Reading tens of thousands of objects one by one, as lazy loading does, takes a read each: from a netCDF file, the arrays of the grid are read at once (an 8000-cell grid in 0.08 s instead of 6.7 s), else one by one as before. The last meshes are kept. - The cells of a color are drawn as one path, kept until the values, the levels or the colors change; the color bar controls them as it does an image. The status bar gives the value of the cell under the mouse. Color bars: their ticks show only the major values, and exponents compactly (2e19 for 2e+19), and they are 8 px wider, so that values such as densities are not cut off. The demo gains edge_profiles: the electron temperature on the cells and the density on the nodes of a ring of 96 x 12 cells from the plasma boundary to the first wall. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018aVekYzCRLPE71Mm6UH8Zp
Main now has the crosshair (#14) and the device template (#15). The crosshair gives the value of the image through Panel._image_value_at, so it also says the value of the cell of an unstructured grid under it, and the status bar keeps the coordinates rounded to the view. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018aVekYzCRLPE71Mm6UH8Zp
Main now has the arithmetic of signals and the sources relative to the first (#16). The conflicts were side by side: imports, helpers of the panel, and tests appended at the same place. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018aVekYzCRLPE71Mm6UH8Zp
With the arithmetic of signals (#16) on main, values on the cells of an unstructured grid can now be computed with: - numbers and abs(), cell by cell; - values on the same cells (the same points and cells, e.g. two runs of an edge code), at the closest slice of the second within its time range, and NaN for a slice on another grid; grids of different cells are an error; - a time trace, at the time of each slice, and a static grid at the times of a trace. deriv() and other maps or profiles are refused with an error. A panel showing sources relative to the first thus gives B − A or B / A of such values, where it failed with an AttributeError. Its line-style legend now counts these values as an image, as it does maps, so the boundaries over them are named after their sources (A, B), not "B − A". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018aVekYzCRLPE71Mm6UH8Zp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Maps on unstructured GGD grids.
edge_profiles/ggd/electrons/temperature[0]/values.autopick the map by themselves, so a path from the IDS browser works too.grid_ggdslice at the time of the values.contoursoption does not apply: cells are always filled.Arithmetic and comparison of sources (with #16, now on main):
abs(), cell by cell;deriv(), other maps and profiles are refused with an error.Color bars: they now show only the major ticks, with compact exponents (
2e19for2e+19), and they are 8 px wider. Values such as densities were cut off at the right edge before.Demo:
Notes
MeshSeriesis a map (kind == "map"), so panels treat it like other maps. It gives theMesh(points, cells in order, centers) and a value per cell for each time slice.IDSStructArray._lazy_ctx,nc2ids._lazy_map).len(array)rows are taken.Panel._image_value_at(the closest grid point, or the cell it is in). The status bar and the crosshair both use it, so the crosshair also gives the value of a cell, and nothing outside the cells. The status bar keeps the coordinates rounded to the view.MeshSeriesto the expressions and to the line-style legend of the panel.Test plan
QT_QPA_PLATFORM=offscreen pytest: 242 passed in the dev environment, a clean PySide6 6.11 environment and a PyQt5 5.15 environment, after merging main.cell_atin the plasma and beyond the wall;deriv()(refused);abs()over a trace, and B − A of the two demo sources;MeshItemwith the color bar levels of the values, the status bar value of the cell, the color of the hottest cell on screen, the color bar setting the levels, the time changing the values, and the crosshair giving the value of the cell (and none in the plasma, where there is no cell);pyflakes src testsreports nothing.🤖 Generated with Claude Code
https://claude.ai/code/session_018aVekYzCRLPE71Mm6UH8Zp
Generated by Claude Code