Skip to content

Wppf weights - #986

Open
saransh13 wants to merge 5 commits into
masterfrom
wppf-weights
Open

saransh13 wants to merge 5 commits into
masterfrom
wppf-weights

Conversation

@saransh13

@saransh13 saransh13 commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

Overview

This branch adds statistically informed weighting for WPPF refinements of azimuthally averaged polar data.

  • Adds N_valid(pv) to count valid pixels contributing to each polar lineout point.
  • Adds optional N_sampling=None arguments to LeBail and Rietveld.
  • When supplied, scales WPPF weights using the number of contributing samples.
  • Supports masked one-dimensional N_sampling arrays across disconnected valid regions.
  • Separates reduced χ² from goodness of fit:
    • chi2 = weighted_sum_squares / (N - P)
    • gofF = sqrt(chi2)
  • Updates WPPF output to report S (goodness-of-fit) instead of χ².
  • Changes calc_rwp() to return both chi2 and gofF.

Affected Workflows

LeBail and Rietveld refinements can now account for the number of detector pixels averaged into each lineout point. Existing callers remain compatible because N_sampling defaults to None, preserving the previous weighting behavior.

Callers unpacking calc_rwp() directly must account for its additional return value.

Documentation Changes

The LeBail and Rietveld parameter documentation now includes N_sampling.

Testing

No tests are added on this branch. Recommended coverage includes:

  • Valid-pixel counting for masked and NaN-containing polar images.
  • LeBail and Rietveld behavior with and without N_sampling.
  • Masked N_sampling region handling.
  • Independent χ² and goodness-of-fit calculations.

…muthal average, return chi^2 as well as goodness of fit, display goodness of fit instead of chi^2 in wppf
@saransh13
saransh13 requested a review from psavery October 2, 2026 23:31
@codecov

codecov Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 57.62712% with 25 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.38%. Comparing base (073fd14) to head (30529c6).

Files with missing lines Patch % Lines
hexrd/powder/wppf/WPPF.py 57.50% 17 Missing ⚠️
hexrd/core/projections/polar.py 27.27% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #986      +/-   ##
==========================================
- Coverage   75.45%   75.38%   -0.07%     
==========================================
  Files         149      149              
  Lines       22961    23000      +39     
==========================================
+ Hits        17325    17339      +14     
- Misses       5636     5661      +25     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

1 participant