Skip to content

Adopt petrolib.data_qc_io in 2020-2022 articles (PR-B2) - #159

Merged
ingehap merged 1 commit into
mainfrom
claude/petrophysics-library-merge-plan-txjfx9
Jul 10, 2026
Merged

ingehap merged 1 commit into
mainfrom
claude/petrophysics-library-merge-plan-txjfx9

Conversation

@ingehap

@ingehap ingehap commented Jul 10, 2026

Copy link
Copy Markdown
Owner

Summary

Second adoption chunk (PR-B2) for the data_qc_io domain — four 2020–2022 article files now delegate to the canonical package (#157), following #158. Strangler-fig facades: names, signatures, and docstrings unchanged.

File Function Canonical target
src2020_10/article3_cavein_clustering_detection.py rolling_cv filt.moving_stat(rhob, 2*wr+1, "cv") — the article's half-width wr maps exactly onto the full-window API (half = (2wr+1)//2 = wr)
src2021_04/article5_nmr_fluid_contacts.py stacking_snr signal.stack_gain
src2021_12/article01_data_quality_ml.py sentinels_to_nan, zscore_outliers, iqr_outliers, normalize_reference, add_gaussian_noise clean.sentinels_to_nan, clean.outlier_mask("zscore"/"iqr"), scale.normalize_to_reference, signal.add_gaussian_noise
src2022_08/article5_cpa_fcm_logfacies.py synth_log_suite synth.log_suite (verbatim RNG draw sequence; facade column-stacks the canonical curve dict) + bootstrap header

Kept local on purpose in src2021_12/article01: zscore (its std if std>1e-12 else 1.0 guard differs from ml_stats.zscore's additive-eps form and is not bit-compatible) and iqr_bounds (a bounds-returning API the canon doesn't expose; iqr_outliers no longer routes through it).

Verification

  • stdout byte-identical old (HEAD) vs new for all four modules — including the RNG-heavy synth_log_suite and add_gaussian_noise paths.
  • python3 tools/golden_diff.py on all four directories: 4/4 PASS (31 modules total).
  • python3 -m mypy petrolib clean; python3 -m pytest tests/petrolib: 252 passed.

🤖 Generated with Claude Code

https://claude.ai/code/session_01B2BX1XL8422gebCU1oVoQC


Generated by Claude Code

Strangler-fig delegation to the canonical package (PR-B2 of the
data_qc_io train):

- src2020_10/article3: rolling_cv -> filt.moving_stat(2*wr+1, "cv")
  (half-width convention mapped to the full-window API)
- src2021_04/article5: stacking_snr -> signal.stack_gain
- src2021_12/article01: sentinels_to_nan -> clean.sentinels_to_nan;
  zscore_outliers -> clean.outlier_mask("zscore"); iqr_outliers ->
  clean.outlier_mask("iqr"); normalize_reference ->
  scale.normalize_to_reference; add_gaussian_noise ->
  signal.add_gaussian_noise (zscore and iqr_bounds stay local: the
  guarded z-score form and the bounds-returning API have no canonical
  equivalent)
- src2022_08/article5: synth_log_suite -> synth.log_suite (verbatim draw
  sequence; column_stack of the canonical curve dict, + bootstrap header)

All function names, signatures, and docstrings unchanged. Verified:
stdout byte-identical old vs new for all four modules; golden_diff 4/4
directories pass; mypy clean; 252 tests pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B2BX1XL8422gebCU1oVoQC
@ingehap
ingehap marked this pull request as ready for review July 10, 2026 09:41
@ingehap
ingehap merged commit 6fda2be into main Jul 10, 2026
7 checks passed
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.

2 participants