Skip to content

Azimuthal variance accumulation#2776

Merged
kif merged 4 commits into
silx-kit:mainfrom
kif:2774_variance_in_result_agregation
Feb 27, 2026
Merged

Azimuthal variance accumulation#2776
kif merged 4 commits into
silx-kit:mainfrom
kif:2774_variance_in_result_agregation

Conversation

@kif
Copy link
Copy Markdown
Member

@kif kif commented Jan 30, 2026

Propagate "properly" also azimuthal variance.

It makes sense to do it with union but I doubt it can be properly calculated with add or subtract ...

Needs to be checked with a demonstrator ... probably an extension to the Spotty tutorial

@kif kif requested a review from t20100 January 30, 2026 17:06
@kif kif added the work in progress Don't review label Jan 30, 2026
Comment thread src/pyFAI/containers.py Outdated
# Crossed term:
delta = (self._sum_signal * other._sum_normalization - other._sum_signal*self._sum_normalization)
if numpy.nansum(other._sum_normalization2) < numpy.nansum(self._sum_normalization2):
tmp = other._sum_normalization2 / other._sum_normalization
Copy link
Copy Markdown
Member

@t20100 t20100 Feb 2, 2026

Choose a reason for hiding this comment

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

Why deviating from how eq 18 is written in https://journals.iucr.org/j/issues/2025/01/00/jo5109/index.html?

Image

Maybe choose a better name than tmp to help the readers

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The implementation based on the formula is not always the most efficient...
Agreed for tmp

Comment thread src/pyFAI/containers.py Outdated
if self.error_model == ErrorModel.AZIMUTHAL:
# Crossed term:
delta = (self._sum_signal * other._sum_normalization - other._sum_signal*self._sum_normalization)
if numpy.nansum(other._sum_normalization2) < numpy.nansum(self._sum_normalization2):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this for numerical stability? other reason?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The formula is not "exact" but closer to when the A is larger than B.
Σnormalization² is positive, this is why we use it to assess the size of the ensemble.

@kif kif merged commit c40e325 into silx-kit:main Feb 27, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

work in progress Don't review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants