Repository navigation
Validating a jig or a coupler can take out the uncertainty two calibrations share (IEC 61094-5 6.7) - #946
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
⛔ Files ignored due to path filters (6)
📒 Files selected for processing (7)
🚧 Files skipped from review as they are similar to previous changes (3)
Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review. 📝 WalkthroughWalkthroughJig/coupler verification now accepts shared standard uncertainty and uses it to calculate correlated difference uncertainty. Results expose the shared uncertainty and correlation coefficient. Tests, plots, conformance records, and documentation reflect the new behavior. ChangesCorrelated calibration validation
Priority: ➖ Normal Estimated code review effort: 4 (Complex) | ~45 minutes Change: Feature Sequence Diagram(s)sequenceDiagram
participant Calibration caller
participant verify_jig_or_coupler
participant JigCouplerVerification
participant plot_jig_coupler_verification
Calibration caller->>verify_jig_or_coupler: calibration, validation, shared_standard_uncertainty_db
verify_jig_or_coupler->>JigCouplerVerification: validated shared uncertainty
JigCouplerVerification-->>Calibration caller: difference uncertainty and correlation coefficient
Calibration caller->>plot_jig_coupler_verification: verification result
plot_jig_coupler_verification-->>Calibration caller: shared band and independent bounds
Merge Risk: ⚪ Minimal · up to The shared-uncertainty change is mergeable after normal checks. An unusually tiny nonzero uncertainty may be rejected and can be addressed separately. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change is confined to calibration calculations and their presentation. Input validation limits the shared component, and inspected consumers do not introduce privileged access or cross-service effects. Broader security and deployment coverage remains incomplete. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## docs/anova-cuadrado-medio #946 +/- ##
==========================================================
Coverage 96.80% 96.80%
==========================================================
Files 443 443
Lines 87857 87888 +31
==========================================================
+ Hits 85050 85081 +31
Misses 2807 2807 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Numerical conformance1893/1893 checks pass across 111 domains and 523 standards (227 normative designations, 125 further published sources). Used in the tables below is how much of that clause's published tolerance the deviation consumes: 100 % sits exactly on the limit, 5 % uses a twentieth of the allowance, and a dash means the clause states no two-sided tolerance for the quantity, so there is no budget to spend. It is reported and never used to decide a verdict, which is settled at full precision before any rounding. New checks (2)
Closest to their published limit (top 5) The rows with the least room left, so the ones a change is most likely to push over.
|
…ations share (IEC 61094-5 6.7) metrology.verify_jig_or_coupler judged two calibrations of the same microphone as if their uncertainties were independent. When the two share a component, the calibration of the same reference microphone or the same measuring chain, its error moves both sensitivity levels together and cancels in their difference, while the root-sum-square counts it twice. The function now takes a keyword-only shared_standard_uncertainty_db, default 0 dB, and judges the difference against U_Delta = k sqrt(u_cal^2 + u_val^2 - 2 u_sh^2) (JCGM 100:2008 5.2.2 and F.1.2.3, k = 2 from IEC 61094-5 7.9); JigCouplerVerification carries the shared part and its correlation_coefficient, and the comparison calibration guide gains a section on calibrations that share a reference. The default gives the root-sum-square bit for bit.
b3d8562 to
be60b6e
Compare
|



metrology.verify_jig_or_couplerjudged two calibrations of the same microphone as if their uncertainties were independent. When the two share a component, the calibration of the same reference microphone or the same measuring chain, the error of that component moves both sensitivity levels together and cancels in their difference, while the root-sum-square counts it twice. The criterion was then looser than it should be.The function now takes a keyword-only
shared_standard_uncertainty_db, one value or one per frequency of the calibration, with a default of 0 dB. With it the difference is judged againstU_Delta = sqrt(U_cal^2 + U_val^2 - 2 (k u_sh)^2), that isk = 2times the root ofu_cal^2 + u_val^2 - 2 u_sh^2: the GUM law of propagation for correlated inputs (JCGM 100:2008 5.2.2, Formula (13)) with the covariance of two levels that each depend on the shared quantity with a sensitivity of 1 (F.1.2.3, Formula (F.2)). Thek = 2comes from IEC 61094-5 7.9 for a comparison and from IEC 61094-2:2009 7.5 for a reciprocity calibration. A negative shared part, one larger than either calibration's standard uncertainty, or one that leaves the difference with no uncertainty at all is refused.JigCouplerVerificationcarries the shared part as a keyword-only, read-only field, gives thecorrelation_coefficientof the two levels (Formula (14)), and its.plot()draws the band two independent calibrations would have, dotted around the narrower one. Two calibrations with the budget of IEC 61094-5 Table D.1 against the same LS2P are judged within 0.101 dB instead of 0.124 dB, and a pair that agrees within the root-sum-square can fail once the shared part is out.Only a component that enters both levels with the same sign and size can be given. A reciprocity calibration made in the same set of three microphones as the reference's is not such a case: in IEC 61094-2:2009 Formula (7) the pairs that go through the third microphone are in the numerator of one microphone's sensitivity and in the denominator of the other's, so they enter the two levels with opposite signs. That covariance is negative and widens the band beyond the root-sum-square, which this argument does not represent. The docstrings, the guide and its scope notes say so.
The comparison calibration guide has a new section, "Calibrations that share a reference", in English and Spanish and in the docs/ mirror: the jig of A.2 validated against the coupler of A.1 with the reference they share taken out, the figure with both bands, which components two calibrations can share (the reference's calibration, its drift since then, a common chain), and the case above that cannot be given.
Nothing breaks. The default of 0 dB gives the root-sum-square bit for bit, so every existing call returns the verdict it returned before. No migration is needed. The only visible change for an existing caller is the wording of the error raised when the difference of the two calibrations is left with no uncertainty.
How it was verified. The test oracle is worked by hand from IEC 61094-5:2016 Table D.1 (PDF page 22, folio 20): each calibration carries U = 0.0873 dB from its eight rows, the first row (the reference, 0.025 dB) is the shared one, and the difference carries 0.101272 dB against 0.123515 dB for two independent calibrations; a conformance row checks it. A second conformance row reproduces the correlation coefficients JCGM 100:2008 prints in F.1.2.3 Example 2 (PDF page 75, folio 63), about 0.5, 0.990 and 1.000 for comparisons of 100, 10 and 1 x 10^-6 against a standard of relative standard uncertainty 10^-4, to the decimals printed; Formula (F.2) was read on PDF page 74, folio 62. IEC 61094-2:2009 Formula (7) was read on PDF page 14, folio 12, and its 7.5 on PDF page 20, folio 18. Nineteen new tests cover the formula per frequency, the default being the root-sum-square to the last bit, a shared part equal to one uncertainty, the refusals, the shared part staying with its own frequency when the validation leaves out the first, a middle or the last frequency, the zero correlation where a calibration carries no uncertainty, and the plot in both languages.
Jarvis and Watkins (1997), NPL Report CIRA(EXT) 022, was read page by page. It compares jig calibrations of working standard microphones with reciprocity calibrations of the same microphones in Figures 6 and 7 (folio 4), and its text judges the differences in words against the typical repeatability, one standard deviation drawn as a band in Figure 7 (folio 2). It prints no numeric criterion, no worked numbers one could check against, and nothing about what the two calibrations share; its "less than 0.1 dB" on folio 5 reports a result. It is cited in the guide as a source that is not implemented, and no erratum was found in it, in Table D.1 or in GUM Example 2.
The conformance report passes 1893 of 1893 checks. Ruff, ruff format, mypy over src and scripts, bandit, the full test suite, every documentation snippet and the site build with its HTML validation pass.
Summary by CodeRabbit
New Features
Documentation