Skip to content

Handle errors when a multi-leaf dt has no 2D data - #65

Merged
shum23 merged 6 commits into
mainfrom
handle-error-when-multi-leaf-dt-has-no-2D-scan
Jul 23, 2026
Merged

Handle errors when a multi-leaf dt has no 2D data#65
shum23 merged 6 commits into
mainfrom
handle-error-when-multi-leaf-dt-has-no-2D-scan

Conversation

@shum23

@shum23 shum23 commented Jul 18, 2026

Copy link
Copy Markdown
Collaborator

now raises a proper error there

Fix #62

Comment thread peaks/core/GUI/disp_panels/disp.py Outdated
Comment thread tutorials/2_plotting_data.ipynb Outdated
Comment thread CHANGELOG.md Outdated
shum23 and others added 3 commits July 21, 2026 00:49
Co-authored-by: Phil King <78075132+phrgab@users.noreply.github.com>
@shum23

shum23 commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks @phrgab. This should now be fixed. I'll fix the merge conflict when we're ready to merge.

Comment thread tutorials/2_plotting_data.ipynb Outdated
"## Interactive plotting\n",
"### Interactive UIs\n",
"Interactive UIs for visualising and aligning data can be accessed by calling {py:func}`.disp <peaks.core.GUI.disp_panels.disp.disp>` on a 2D, 3D, or 4D {py:class}`xarray.DataArray`, or on a {py:class}`xarray.DataTree` containing either a single data entry, or on a tree with multiple leafs. If the latter, or if passing a list of 2D {py:class}`xarray.DataArray`'s to {py:func}`pks.disp <peaks.core.GUI.disp_panels.disp.disp>`, all 2D scans are included in a data explorer view.\n",
"Interactive UIs for visualising and aligning data can be accessed by calling {py:func}`.disp <peaks.core.GUI.disp_panels.disp.disp>` on a 2D, 3D, or 4D {py:class}`xarray.DataArray`, or on a {py:class}`xarray.DataTree` containing either a single data entry, or on a tree with multiple leaves that each hold a 2D scan. If the latter, or if passing a list of 2D {py:class}`xarray.DataArray`'s to {py:func}`pks.disp <peaks.core.GUI.disp_panels.disp.disp>`, all 2D scans are included in a data explorer view.\n",

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks @shum23, sorry to be pedantic, but is this strictly correct yet? I think if we pass a DataTree containing multiple leaves, it will strip out all 2D ones to put into a 2D display panel. So there could be a structure with e.g. a mix of 2D, 3D, 4D, 1D arrays in a tree, and it would load all of the 2D ones into a single 2D viewer.

So should we say: "or on a tree with multiple leaves where at least one holds a 2D scan."

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Thanks @phrgab. Yea that's true. I've also just added a dispersion to the tree to double-check and it worked. Could have thought it through more but didn't since this was done during the beamtime - also just realised I had forgotten I'd created a branch from the issue already so I've ended up with two branches for this... I'll bin the extra one after this is merged.

@phrgab phrgab left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks @shum23, looks good. Please go ahead and tidy the merge conflicts and then merge.

@shum23
shum23 merged commit e963913 into main Jul 23, 2026
4 checks passed
@shum23
shum23 deleted the handle-error-when-multi-leaf-dt-has-no-2D-scan branch July 23, 2026 12:54
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.

[DOC] Interactive 2D display command

2 participants