Skip to content

Conversation

@jokasimr
Copy link
Contributor

Fixes #3207.

Replaced part of the bin-edge finding logic with what I found in the C++ string formatting code:

if ((datasetSizes->contains(dim) ? (*datasetSizes)[dim] : 1) + 1 == dims[dim])
    diminfo += " [bin-edge]";

This does not change the alignment bolding however, because there it seems the behaviour in the html fomatting is the same as the string formatting.

if length == 2:
bin_edges.append(dim)
elif dim in ds.dims and ds.shape[ds.dims.index(dim)] + 1 == length:
elif ds.sizes.get(dim, 1) + 1 == length:
Copy link
Member

Choose a reason for hiding this comment

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

Does this handle bin edges with extra dimensions correctly?

Since this code was written, we have also added https://scipp.github.io/generated/classes/scipp.Coords.html?highlight=is_edges#scipp.Coords.is_edges, I don't know if that helps here.

I also wonder about line 234ff, was this an incomplete solution for the same problem you are fixing here? If so, can it (the if branch) be removed, or is it not covered by you solution?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does this handle bin edges with extra dimensions correctly?

I don't understand what bin edges with extra dimensions means. Can you explain / write a short example?

I also wonder about line 234ff, was this an incomplete solution for the same problem you are fixing here?

That might be the case. Ill take a look.

Copy link
Member

Choose a reason for hiding this comment

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

Scipp supports "2D" (or higher) coords. This shows up all the time in neutron-scattering data reduction after transforming coords, e.g., from time-of-flight to wavelength, since the transform depends on the other "dimensions" (such as pixel positions). See a concrete example here: https://scipp.github.io/ess/instruments/external/powgen/powgen_reduction.html#Conversion-to-d-spacing

Copy link
Contributor Author

@jokasimr jokasimr Sep 18, 2023

Choose a reason for hiding this comment

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

I've marked this as a draft because for now I'm not sure what the correct behavior is.
This fix does however do the right thing for the MRE and the example @SimonHeybrock posted in the original issue.

@jokasimr jokasimr force-pushed the html-bin-edge-label-missing branch from e2bc344 to 314809f Compare September 18, 2023 14:52
@jokasimr jokasimr marked this pull request as ready for review September 20, 2023 08:51
@jokasimr jokasimr force-pushed the html-bin-edge-label-missing branch from 314809f to 408042f Compare September 20, 2023 08:51
@jokasimr jokasimr force-pushed the html-bin-edge-label-missing branch from 068bf1d to 36e76d0 Compare October 5, 2023 11:13
jokasimr and others added 3 commits October 10, 2023 13:50
@jokasimr jokasimr force-pushed the html-bin-edge-label-missing branch from 36e76d0 to e22748e Compare October 10, 2023 11:50
@jokasimr jokasimr merged commit 6eb4b27 into main Oct 10, 2023
@jokasimr jokasimr deleted the html-bin-edge-label-missing branch October 10, 2023 12:15
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.

bin-edge label and alignment indication are missing for a selected bin.

3 participants