Skip to content

Conversation

@jokasimr
Copy link
Contributor

Fixes #142

@github-project-automation github-project-automation bot moved this to In progress in Development Board Jul 30, 2025
@jokasimr jokasimr moved this from In progress to Selected in Development Board Jul 30, 2025
Copy link
Member

@SimonHeybrock SimonHeybrock left a comment

Choose a reason for hiding this comment

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

This does not appear to be used anywhere, what is the idea here?

wmin, wmax = wbins[0], wbins[-1]
qmin = reflectometry_q(wavelength=wmax, theta=theta_min)
qmax = reflectometry_q(wavelength=wmin, theta=theta_max)
qmin = max(qmin, sc.scalar(1e-3, unit='1/angstrom'))
Copy link
Member

Choose a reason for hiding this comment

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

Any reason for this particular hard maximum? Should be documented in the docstring at least.

Copy link
Contributor Author

@jokasimr jokasimr Aug 18, 2025

Choose a reason for hiding this comment

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

From what I know about reflectometry it's a reasonable lower edge.
Depending on the setting for BeamDivergenceLimits the qmin value might be too small, even below 0.
In that case qmin is going to be too low, so it is truncated.

I'll add information about it in the docstring.

It doesn't really matter that we have a hard coded lower bound because if the user wants to set the QBins manually they can do that just like before.

qmin = reflectometry_q(wavelength=wmax, theta=theta_min)
qmax = reflectometry_q(wavelength=wmin, theta=theta_max)
qmin = max(qmin, sc.scalar(1e-3, unit='1/angstrom'))
return QBins(sc.geomspace('Q', qmin, qmax, 499))
Copy link
Member

Choose a reason for hiding this comment

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

Why 499? Should this be an input param?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's a reasonable default. I don't think we should make it an input parameter. If the user wants more control they can set QBins manually.

Copy link
Member

Choose a reason for hiding this comment

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

Won't people wonder about the unusual number of bins (498)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah you're right it's odd, I'll change it to 501 👍

@jokasimr
Copy link
Contributor Author

This does not appear to be used anywhere, what is the idea here?

The idea is that the user doesn't need to select QBins but they are determined automatically.

It is used in the Amor notebook, see this line that was removed: https://github.com/scipp/essreflectometry/pull/170/files#diff-403cf917aae91bdc5b55ef5e02c326fc55ca8642cc104dddefbadadd5ca44840L63

@jokasimr jokasimr merged commit 7fe8198 into main Aug 18, 2025
4 checks passed
@jokasimr jokasimr deleted the provider-for-qbins branch August 18, 2025 08:24
@github-project-automation github-project-automation bot moved this from Selected to Done in Development Board Aug 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Automatic QBins start and end based on sample rotation

3 participants