Repository navigation
A choice reads the same everywhere: fraction=1 or 3 for the band set, "free", "diffuse" or "pressure" for the field, weighting= for the curve - #976
Conversation
|
Sorry @jmrplens, your pull request is larger than the review limit of 150,000 diff characters |
|
Important Review skippedToo many files! This PR contains 273 files, which is 173 over the limit of 100. To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch. Upgrade to a paid plan to raise the limit. ⚙️ Run configuration
⛔ Files ignored due to path filters: 5
📒 Files selected for processing: 273
You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
fraction=1 or 3 for the band set, "free", "diffuse" or "pressure" for the field, weighting= for the curve
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## fix/levels-carry-no-db-suffix #976 +/- ##
=================================================================
+ Coverage 96.86% 96.88% +0.01%
=================================================================
Files 444 445 +1
Lines 89966 89986 +20
=================================================================
+ Hits 87150 87185 +35
+ Misses 2816 2801 -15 ☔ 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. Renamed (3)
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.
|
…set, `"free"`, `"diffuse"` or `"pressure"` for the field, `weighting=` for the curve Three choices were spelled differently from one function to the next: the band set of a spectrum, the sound field and the frequency weighting. Code written against one module had to be relearned for the next, and a misspelt choice reached the function as a plain string. Each of them now has one spelling everywhere it is offered, every choice is a `Literal` a type checker reads, and the old words are refused by name.
593ad64 to
286b816
Compare
[Medium impact] The PR appears safe to merge, with no actionable defect established. Reviews (1) · Last reviewed commit: "A choice reads the same everywhere: `fra..." · Reviewed by Greptile |
|



Three choices were spelled differently from one function to the next: the band set of a spectrum, the sound field and the frequency weighting. Code written against one module had to be relearned for the next, and a misspelt choice reached the function as a plain string. Each of them now has one spelling everywhere it is offered, every choice is a
Literala type checker reads, and the old words are refused by name.What changes for you
The band set is
fractionThe filter bank, the room parameters and the intensity measurement already took the integer
fraction. The building, emission and vibration functions that pick a band set spelled itband="third",bands="third-octave",band_type="third"orbandwidth="octave". Every one of them now takesfraction: Literal[1, 3], 3 for one-third octaves and 1 for octaves:field_incidence_correction,mass_law_transmission_loss,single_panel_transmission_loss,double_wall_transmission_loss,orthotropic_transmission_loss) and the resilient layers (tapping_force_spectrum,short_pulse_mean_square_force,covering_improvement);weighted_rating,weighted_impact_rating,SoundReductionResult.rating), the facade and flanking predictions, and the detailed model of ISO 12354 (calculated_sound_reduction_index,reciprocity_impact_level,in_situ_element,detailed_airborne_prediction,detailed_impact_prediction);a_weighted_max_impact_level,tapping_machine_force_level_estimateandcylindrical_shell_modal_density;sound_power_intensity,sound_power_intensity_points,position_count_factor,determination_standard_deviation);reference_source_reproducibility,ReferenceSourceCalibration.sound_power_level_at), the service equipment level of ISO/DIS 16032, the cabins of ISO 11957 and the enclosures of ISO 11546.The results that record the band set hold it as
fraction(TappingForceResult,AWeightedMaxImpactResult,VibrationReductionResult,SoundPowerIntensityResult,DiscretePointIntensityResult, and the newServiceEquipmentResult,CabinInsulationResultandEnclosureInsulationResult), and the tables read by band set are keyed by the same integer (HEAVY_IMPACT_A_WEIGHTING[3],SERVICE_EQUIPMENT_WEIGHTING[1]). One shared check refuses a word, a flag or a float with a message that namesfraction, sofraction=Trueis not read as octaves. The ISO 10848 junction fiche now averages over the Annex A range of the band set aVibrationReductionResultstates, assingle_numberdoes.speech.sii_procedure(method="one-third-octave")keeps its value: it names one of the four procedures of ANSI S3.5, not a band set.With
fractionnaming only a band set, the share of the energy a transmission path carries is spelledenergy_fractiononbuilding.PathContributionandenergy_fractions(one row per path, one column per band) onDetailedAirborneResultandDetailedImpactResult, where they heldfractionandfractions, asLateralEnergyResult.energy_fractionalready reads.A sound field is
"free","diffuse"or"pressure"hearing.reference_thresholdandhearing.FIELDSread"free"and"diffuse"instead of"free-field"and"diffuse-field", the words the loudness models already used. The microphone calibrations by comparison and by reciprocity take and hold"free"beside"pressure", andDiffuseFieldSensitivity.routereads"free"for a reference calibrated in a free field. Every publicfieldthat names a sound field states its options as aLiteral, on the results that record it too (ZwickerLoudness,EcmaLoudness,MooreGlasbergLoudness, the ECMA-418-2 roughness, tonality and fluctuation strength,BinauralIndicators,FreeSoundFieldCheck). Three keep a word of their own, because the standard or the model names something that is not a free, diffuse or pressure field: the quasi-free field of ISO 8253-2 5.4, the plane wave at normal incidence of the slit model (Hopkins Eq. 4.99 sets m = 4 for it), and the eardrum of the Moore-Glasberg models.A frequency weighting is chosen by
weighting, and an unweighted signal is"Z"filters.weighting_filterandWeightingFiltertakeweighting=instead ofcurve=;WeightingFilter.weightingandWeightingComplianceResult.weightingreplace.curve.broadcast.quasi_peak_meter(weighting="468" | "Z")replacesweighted=True/False, andQuasiPeakResult.weightingreplaces.weighted.signals.ln_levelsandseldefault toweighting="Z"and refuseNonewith aTypeErrorthat names the parameter.electroacoustics.program_signal_levelandprogram_characteristic_voltagetakeweighting="A" | "Z"(default"Z"),environment.wind_turbine_low_frequency_leveltakesweighting="A" | "Z"(default"A"), andvibration.verify_vibration_metertakesweighting="kb" | "Z"."Z"is the Z-weighting of IEC 61672-1 on the sound-level weightings; elsewhere it is whatever the standard leaves unweighted, such as the band limitation of Formula (3) alone on the DIN 45669-1 vibration meter or the meter without its ITU-R BS.468-4 network. Two flags keep their names because they read a row of a printed table, not a weighting curve:emission.error_factor(a_weighted=)reads the A-weighted row of ISO 9614-1 Table B.1, andbuilding.estimate_reverberation_index(weighted=)the A/C column of ISO 10052 Table 4.The cabin rating takes the method, and the vibration choices are typed
weighted_cabin_insulation(*, method="laboratory" | "in-situ-loudspeaker" | "in-situ-actual-noise")takes the methodcabin_insulationtakes, andWeightedCabinInsulationholds it and readsapparentfrom it.The building class of DIN 4150-3 and of the DIN 45669-1 assessment weightings, the place of measurement, the duration, the pipe material, the period model of ISO 4866, the working range and weighting of the vibration meter and the dominant-frequency method are
Literaltypes in every signature and on every result that records them, with no| strbeside them.BuildingClassandWorkingRangeare written once, in a private module both packages read, andrequire_choiceis generic in its options, so a tuple typed with aLiteralalias narrows the checked value without a cast.What breaks, and how to migrate
Every parameter, field and value that shipped in 3.3.0 or 4.0.0rc1 has a row in "One spelling per concept" of the migration guide (
docs/start/upgrading.mdand its two site copies):band=,bands=,band_type=andbandwidth=on the functions above, and.band/.band_typeon their results: writefraction=3for one-third octaves andfraction=1for octaves;Nonestill reads the band set from the values where it did.building.HEAVY_IMPACT_A_WEIGHTING["third"]and["octave"]:[3]and[1].hearing.reference_threshold("free-field")and"diffuse-field", andhearing.FIELDS:"free"and"diffuse".curve=onweighting_filterandWeightingFilter,.curveonWeightingFilterandWeightingComplianceResult:weighting=and.weighting.quasi_peak_meter(weighted=)andQuasiPeakResult.weighted:weighting="468"(the default) orweighting="Z", and.weighting.weighting=Noneonsignals.ln_levelsandsel:weighting="Z", now the default.building.PathContribution.fraction, andfractionsonDetailedAirborneResultandDetailedImpactResult:.energy_fractionand.energy_fractions.The functions added since 4.0.0rc1 are described by their final spelling in the CHANGELOG
[Unreleased]entries, with no rename line. The curated API table, the API reference,llms.txtand the guides in English and Spanish follow; no conformance number moves.How it was verified
weighting="Z"raises the outdoor and indoor levels of each band by exactly that and leaves the row at zero; the footnote of the table allows the unweighted level.dataclasses.replace: the quasi-peak meter refuses"A", the programme level and the characteristic voltage refuse"C"instead of reading it as unweighted, andLowFrequencyLevelrefuses"C"."normal"was read on Hopkins (2007), Sound Insulation, PDF page 522, printed page 495: m = 8 for a diffuse field, m = 4 for a plane wave at normal incidence. The docstrings call the integer 1 or 3 the denominator b of the IEC 61260-1 bandwidth designator 1/b, as BS EN 61260-1:2014 3.3 (PDF page 10, printed page 8) defines it. The DIN 45669-1"Z"is the band limitation of Formula (3), as the vibration meter module states.diagram_slm_pipeline, in its four light, dark, English and Spanish variants) labels its weighting stepweighting_filter(weighting='A')instead ofweighting_filter(curve='A'). Every other figure regenerates byte for byte.ruff check,ruff format --check,mypy src scripts(700 files) andbanditare clean; the full suite, the documentation snippets and the site build and validation pass;docs/CONFORMANCE.mdregenerates with no change; the API reference andllms.txtare regenerated; the frozen-constant, parameter-unit, API-reference, em-dash, markdown, Spanish-accent, digit-grouping, raises-block, identifier-spelling, boundary-comparison, dead-constant and record-display checks pass.Guards
tests/test_choice_vocabulary.pyreads the installed package the way a caller meets it, every unpublished alias spelled out, plus every module-level tuple and table, private ones included. Each exception is keyed by its location and carries its reason, and an exception whose place is gone fails."third","third-octave","one-third-octave"or"octave"in aLiteralor as a default, and no choice named for a band set (band,bands,band_type,band_fraction,bandwidth,band_set,fraction) takes astr, whose words noLiteralwould show. The ANSI S3.5 procedure names and the ISO 3745 test-signal kind are exempt.fieldstates its options in aLiteraland offers only free, diffuse or pressure (a catalogue column, a record field named in a message and a field quantity of the FDTD grid are exempt as not sound fields, beside the three named above), and a tuple or table named for a field that holds a sound field holds only those three words.weightingoffers or defaults to a flat word orNone, no table named for a weighting holds one, and no table holds"unweighted"(the generalized cross-correlation weighting and a figure translation key exempt).a_weighted,weighted,curve,c_weighted,unweightedorflattakes a flag or a word, except the two table-row flags named above."unweighted", the threshold's"free-field"and"diffuse-field", the four calibrations'"free_field", the ratings'"third-octave", the mass law's"third", the reference source's"octave", and the keywordscurve=,weighted=andband_type=.tests/test_public_vocabulary.pymapsband_typeandband_fractiontofractionandcurvetoweighting.Red on the base, before the change (123 static findings, and all 13 retired spellings accepted or refused with another message):
A planted offender of each new shape fails on the branch: a public
rating_by_name(values, bands: str | None = None)checked against an inline tuple, a publicfield_by_name(x, field: str = "diffuse"), and"unweighted"put back into the vibration meter's tuple of weightings.Green on the branch: