Skip to content

Conversation

@bmaranville
Copy link
Member

Currently PolarizedQProbe cannot initialize properly, because of changes made to the oversampling logic in #310 I think.

This PR fixes the initialization.


def _calculate_union(self):
theta_offsets = [x.theta_offset.value for x in self.xs if x is not None]
theta_offsets = [x.theta_offset.value for x in self.xs if x is not None and hasattr(x, "theta_offset")]
Copy link
Member

Choose a reason for hiding this comment

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

The measurement union function uses both Q (hence the dependence on theta_offset) and also dQ, therefore sample_broadening should also be part of the key.

Rather than assuming these properties exist and that they are the only properties that affect the measurement union, we could be delegating to the underlying class, with something like a xs._QdQ_key() method. This will matter more when we have full support for ProbeSet as polarized cross sections.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's a good catch on the sample_broadening dependency... this optimization (_calculate_union) is pretty useful in reducing calculation time but it adds a lot of complexity!

@bmaranville bmaranville marked this pull request as draft November 13, 2025 20:19
@bmaranville bmaranville marked this pull request as ready for review November 13, 2025 20:55
@bmaranville bmaranville requested a review from pkienzle November 13, 2025 20:56
Copy link
Member

@pkienzle pkienzle left a comment

Choose a reason for hiding this comment

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

Looks good. I didn't test.

@bmaranville bmaranville merged commit 1c0ec53 into master Nov 14, 2025
14 checks passed
@bmaranville bmaranville deleted the fix-initialize-polarized-qprobe branch November 14, 2025 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants