Skip to content

Conversation

@jl-wynen
Copy link
Member

@jl-wynen jl-wynen commented Apr 2, 2025

This is an attempt to make the user guide more approachable. The basic notebook shows the simplest code to reduce some powder data. The advanced notebook shows how the reduction can be customised.

We may want to use different default values in the basic notebook eventually. In particular, we should figure out which normalisation will be the default.

Reviewer: please look at the rendered docs. In particular, take a look at the plots for integrated monitor norm and stacked detectors. I am not completely sure they are correct.

This supersedes #126. I think it is not feasible to have a separate notebook for each set of workflow params because that would lead to an exponential grows in notebooks. So in contrast to #126, this PR shows the individual customisation points in isolation.

@jl-wynen jl-wynen requested a review from nvaytet April 2, 2025 15:04
@jl-wynen jl-wynen force-pushed the simpler-user-guide branch from 1bee196 to 0ea0ef0 Compare April 3, 2025 11:27
Copy link
Member

@nvaytet nvaytet left a comment

Choose a reason for hiding this comment

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

Nice idea with the thumbnails. Two things:

  • The basic thumbnails are displaying empty axes
  • In Plopp, I saved a figures to the _static folder when running the notebooks, and then used those as thumbnails instead of uploading the svgs to the git repo. This is nice as we don't need to update the images when the workflow updates, but it also means having a hidden cell at the bottom of the notebook, which is annoying if the users download the notebook.

"outputs": [],
"source": [
"result = workflow.compute(IofTof)\n",
"result.hist().plot()"
Copy link
Member

Choose a reason for hiding this comment

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

This plot is empty in the generated docs.

Copy link
Member Author

@jl-wynen jl-wynen Apr 3, 2025

Choose a reason for hiding this comment

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

Not completely empty for me but definitely broken:
integrated

This seems to be a problem with the integrated monitor norm. I don't know what. But it should not have been caused by this PR. See $146

Copy link
Member

Choose a reason for hiding this comment

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

We should really have a test in place that catches this...

Copy link
Member Author

Choose a reason for hiding this comment

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

The plot looks fine now

"id": "31",
"metadata": {},
"source": [
"We can plot the detectors individually with the help of `sc.collapse`:"
Copy link
Member

Choose a reason for hiding this comment

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

Instead of stacking the detectors, could we simply put them in a datagroup?
Then we don't have to remember that detector number 0 is mantle?

Copy link
Member Author

Choose a reason for hiding this comment

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

We could. I thought it would be easier to process them all at once when they are stacked like this. Note that I added a 'detector' coord that contains the name.

But I can change this if you prefer a data group.

Copy link
Member

Choose a reason for hiding this comment

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

Personally, I would go with a DataGroup.

" da.coords['detector'].value: da\n",
" for da in sc.collapse(result, keep='tof').values()\n",
"})\n",
"split.hist().plot()"
Copy link
Member

Choose a reason for hiding this comment

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

Some of the results look weird, with broken lines (maybe NaNs in the data?)

Copy link
Member Author

Choose a reason for hiding this comment

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

(maybe NaNs in the data?)

I think so.

But this is not a problem with the docs, AFAIK. It may be caused by the normalisation with slices the data based on the wavelength range of the monitor.

Copy link
Member Author

Choose a reason for hiding this comment

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

The monitor contains NaNs. So some detector events also become NaN when normalising.

I could hide this from the basic docs by using the proton charge normalisation. Should I?

@jl-wynen
Copy link
Member Author

jl-wynen commented Apr 3, 2025

* The basic thumbnails are displaying empty axes

Fixed.

* In Plopp, I saved a figures to the `_static` folder when running the notebooks, and then used those as thumbnails instead of uploading the svgs to the git repo. This is nice as we don't need to update the images when the workflow updates, but it also means having a hidden cell at the bottom of the notebook, which is annoying if the users download the notebook.

Could do. I wouldn't want to do it with the basic workflow though, because that is supposed to be immediately usable when downloaded. So we would have two separate solutions for the different notebooks.

jl-wynen added 4 commits May 7, 2025 09:26
- Clarifying comments
- Show IofDspacing instead of IofTof
- Define workflows in the same cells as setting params
- Show graphs everywhere
- Show detector names in plots
This hides the problem with monitor normalization (#161)
@jl-wynen jl-wynen force-pushed the simpler-user-guide branch from 8f1b3a3 to 979ac00 Compare May 7, 2025 07:26
@jl-wynen
Copy link
Member Author

jl-wynen commented May 7, 2025

@nvaytet, @celinedurniak I think I addressed all your comments. Can you take a look?

I changed the section that processes all banks to use proton charge normalisation to hide the problems from #161 I don't think we need to address them in this PR.

@nvaytet
Copy link
Member

nvaytet commented May 7, 2025

Interesting this line on the left edge of the endcap_forward (orange):
Screenshot_20250507_104617

It seems it is a line because other banks show a line there, but it gets boosted by the low counts in the vanadium...

@jl-wynen
Copy link
Member Author

jl-wynen commented May 7, 2025

It seems it is a line because other banks show a line there, but it gets boosted by the low counts in the vanadium...

Agree. If you look at the unnormalised data, it has a line there but a much weaker one.

Co-authored-by: Neil Vaytet <39047984+nvaytet@users.noreply.github.com>
@jl-wynen jl-wynen merged commit 11bf997 into main May 7, 2025
4 checks passed
@jl-wynen jl-wynen deleted the simpler-user-guide branch May 7, 2025 09:10
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.

3 participants