Repository navigation
A count says it is a count, a confidence bound says it is one, and the enclosure result says what it holds - #974
Conversation
|
Important Review skippedToo many files! This PR contains 601 files, which is 501 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. Usage-priced reviews support at most 300 files. ⚙️ Run configuration
📒 Files selected for processing: 601
You can disable this status message by setting the
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 @@
## fix/no-module-behind-a-function #974 +/- ##
================================================================
Coverage 96.86% 96.86%
================================================================
Files 444 444
Lines 89874 89874
================================================================
Hits 87058 87058
Misses 2816 2816 ☔ 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.
|
…e enclosure result says what it holds A parameter, a field or a property that holds a whole number of things is `n_<plural>` across the library, the spelling `n_samples`, `n_points` and `n_harmonics` already had, and a limit on one is `min_n_` or `max_n_`. `events=3` could be read as the events themselves; `n_events=3` cannot. The sound energy functions of `emission` take `n_events` and their `SoundEnergyResult` and `ReverberationSoundEnergyResult` hold it; `measurement_positions`, `sound_power_pressure` and `sound_energy_pressure` take `n_reflecting_planes`; the ISO 9614-1 results hold `n_positions`, `n_subset_positions` and `n_additional_positions`, and the ISO 3743 results `n_microphone_positions` and `n_source_positions`. The induction loop functions take `n_turns`, the feedback functions `n_open_microphones`, `tone_burst` and the saw-tooth burst `n_cycles` and `n_repetitions`, the diffusers `n_repetitions`, the absorbers `n_quadrature_points` and `n_sum_terms`, `monte_carlo` `n_trials`, the silencer and valve functions `n_passages` and `n_stages`, the FDTD solvers `run(n_steps)`, the fault frequencies `n_sidebands`, `n_poles`, `n_rotor_bars`, `n_slot_harmonics` and `n_lobe_orders`, the building models `n_stories`, and `eigenrays` `max_n_arrivals`; `check_coherence` takes `min_n_records`. The hearing protector results hold `n_subjects`, the CNOSSOS-EU rolling stock `n_axles`, the calibrations `n_determinations` and `n_microphones`, and `ReportMetadata` `n_source_positions` and `n_receiver_positions`. `io.AudioFileInfo` reads `n_channels` and `n_samples`, the samples per channel, as `Signal` does.
afe3563 to
818b515
Compare
[Medium impact] Renames parameters and functions across the codebase for consistency. The PR appears safe to merge, with a non-blocking cleanup needed in count descriptions. Findings
Reviews (1) · Last reviewed commit: "A count says it is a count, a confidence..." · Reviewed by Greptile |
| :param n_planes: The number of n_planes :math:`n` the measurements are made | ||
| in (Default: 2, the X-Y and X-Z planes of Annex A). |
There was a problem hiding this comment.
Count descriptions lose their meaning
The rename also replaces ordinary English nouns. adjustment_factors now describes “measurements in n_planes n_planes” and “the number of n_planes.” Keep n_planes as the parameter name, but restore “planes” in the descriptions. The same replacement affects “Biquad n_sections” and “Number of n_axles per vehicle.” These descriptions reach the published API reference and guides, making them harder to understand.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
|



What changes for you
A parameter, a field or a property that holds a whole number of things is
n_<plural>across the library, the spellingn_samples,n_pointsandn_harmonicsalready had, and a limit on one ismin_n_ormax_n_.events=3could be read as the events themselves;n_events=3cannot. The sound energy functions ofemissiontaken_eventsand theirSoundEnergyResultandReverberationSoundEnergyResulthold it;measurement_positions,sound_power_pressureandsound_energy_pressuretaken_reflecting_planes; the ISO 9614-1 results holdn_positions,n_subset_positionsandn_additional_positions, and the ISO 3743 resultsn_microphone_positionsandn_source_positions. The induction loop functions taken_turns, the feedback functionsn_open_microphones,tone_burstand the saw-tooth burstn_cyclesandn_repetitions, the diffusersn_repetitions, the absorbersn_quadrature_pointsandn_sum_terms,monte_carlon_trials, the silencer and valve functionsn_passagesandn_stages, the FDTD solversrun(n_steps), the fault frequenciesn_sidebands,n_poles,n_rotor_bars,n_slot_harmonicsandn_lobe_orders, the building modelsn_stories, andeigenraysmax_n_arrivals;check_coherencetakesmin_n_records. The hearing protector results holdn_subjects, the CNOSSOS-EU rolling stockn_axles, the calibrationsn_determinationsandn_microphones, andReportMetadatan_source_positionsandn_receiver_positions.io.AudioFileInforeadsn_channelsandn_samples, the samples per channel, asSignaldoes.A duration names its quantity before its unit, never the unit alone: the ISO 1999 and ISO 2631-5 functions and results take
exposure_duration_yearswhere they tookyears, and the noise phases of RD 1367/2007 takeduration_hours. Every sweep and test signal generator takesduration_swhere it tookseconds(room.sweep_signal,inverse_filterandshaped_sweep_signal,electroacoustics.synchronized_sweep_signalandswept_sine_distortion, the headphone, induction loop and programme test signals,signals.noise_signalandspeech.stipa_signal), the spelling the other durations in seconds already had;room.image_source_rirtakes it where it tookduration, andSweptSineDistortionResultholds it, so a package never spells the same duration both bare and with its unit.environment.ldenandldntake the durations of their periods asperiod_hours, by name, where they tookhours.environment.impulse_prominenceand itsImpulseProminenceResulttake the assessment period of ISO/PAS 1996-3 asassessment_period_minuteswhere they tookassessment_period_min: a trailing_minreads as a minimum, as inf_minandkij_min, so the minute is spelled out, as the hour already is. A class or grade number (filter_class), an axis, a number of decimals and a length counted in samples (delay_samples,burst_samples) are not counts and keep their names, and so does a vectorised argument that takes one count or many, the rule the plural axes already follow (reverberation_time_standard_deviation(positions=),crowd_noise_level(talkers)).minimumandmaximumare writtenminandmaxin every public name,MIN/MAXin a constant andMin/Maxin a class, as numpy, SciPy, scikit-learn and Matplotlib write them and as the standards write Lmax and Lmin. A term of art is no exception any more: the maximum levels aremax_levels_dbandmax_level_db, the background maximumbackground_max_level_db, the heavy impact functionsa_weighted_max_impact_levelandstandardized_max_impact_levelwith theirAWeightedMaxImpactResultandStandardizedMaxImpactResult, the minimum-phase reconstructionsignals.min_phasewithPhaseDecompositionResult.min_phase_radandmin_phase_response, the takt maximumTAKT_MAX_FACTOR,takt_max_rmsandtakt_max_kb, and the functions and records named in words (max_output_current,MaxUncertaintyRow,floor_transfer_max,min_curve_radius,max_repeatability_standard_deviationand the rest) follow.junction_min_vibration_reduction,max_sampled_area_radiusandmax_infrastructure_limitkeep the names they shipped with. A maximum given in decibels is still the maximum level,max_level, never a baremax_db.The spectral density results of
signalscarry their chi-square bounds asconfidence_lowerandconfidence_upper, the spellingMethodBSummaryalready had.noise_control.EnclosureResult, whatenclosure_insertion_lossreturns, isEnclosureInsertionLossResult, besideEnclosureInsulationResult, and the two now say which is which: the first is the insertion loss IL = R − C predicted from the walls and the lining (Bies, Eqs. 7.103 and 7.111), the second the insulation D_W, D_p or D_pr measured on the enclosure once it is built (ISO 11546-1 and -2).The guides lose the spellings the snippet gate cannot see because they sit in comments, prose and tables: the metadiffuser example names the
HelmholtzResonatorfieldsneck_length_m,neck_side_m,cavity_length_mandcavity_side_m, the ground-effect examplesource_height_mandreceiver_height_m, the sound power guidesigma_omc_db, the underwater guidefluids.depth_to_gauge_pressure_mpa, the building response guide prints the modelstoriesits loop now runs, and the API reference readscheck.n_clipped_samplesfrom anOverloadCheck. The CHANGELOG entries that name a function this branch renames again (the heavy impact levels,story_fundamental_frequency(n_stories),min_cabin_clearance_m,foundation_transfer_maxandfloor_transfer_max) and the migration row ofModulationPeriod(n_valid_blocks) carry the final spelling.What breaks
The old names are gone, with no alias, and a call that passes one raises
TypeError.environment.ldenandldntakeperiod_hoursby name only, so a period split passed by position raisesTypeErrortoo. Four of them were exported by the 3.3.0 top level (EnclosureResult,maximum_repeatability_standard_deviation,minimum_cumulative_duration_hoursandminimum_phase), andjunction_min_vibration_reductionandmax_sampled_area_radiusare back under the names they had, so the migration guide re-measures its counts: of the 885 names, 813 are published by exactly one package today, three stay at the top level and sixty-nine are gone. The guide, in its three copies, maps each 3.3.0 or 4.0.0rc1 spelling to the 4.0 one, drops the rows that only recorded a lengthening tominimum_/maximum_of a name that shipped withmin_/max_, and rewrites its rule for words; the names that arrived after 4.0.0rc1 take their final spelling in the CHANGELOG entries that introduced them.How it was verified
Nothing numerical moved. The conformance report is the same 1893 of 1893 checks and
docs/CONFORMANCE.mdcomes out byte for byte the same. The 26 figure generators whose code reads a renamed name were regenerated in all four variants, and so were the three swept sine figures whose code now passesduration_s; every SVG came out byte-identical. The one clip whose builder reads a renamed keyword,anim_feedback_howl, computes data that is bit-identical before and after (the three gain sweeps offeedback_stabilityit draws), so its fingerprint was restamped and its files kept;anim_epnl_flyoverwas already stale on the base and is left for the next time the clips are made.The gates on this branch:
ruff check .andruff format --check .are clean,mypy src scriptsfinds no issue in 699 files andbandit -q -r srcreports nothing. The full suite passes, 28436 tests with 69 skipped, and the documentation snippets pass, 7535 blocks over 731 pages. The site type-checks, builds and validates.check_api_reference,check_frozen_constants,check_parameter_units(which also holdsldenandldntoperiod_hoursby name, and the minute to_minutes),check_identifier_spelling,check_em_dashes,check_spanish_accents,check_markdown_hazards,check_errata_evidence,check_digit_grouping,check_record_display,check_raises_blocks,check_figures(3316 figures) and the conformance checks pass. The API reference and the llms files are regenerated with no drift, and the 77 fiches regenerate within tolerance of the committed ones.tests/test_removed_names.pypins a sample of every kind of retired spelling: the old classes and functions raiseAttributeErrorbeside their new names, the old keywords of eighteen more functions and records are gone from their signatures (secondson the sweep, noise and STIPA generators,durationonimage_source_rirandSweptSineDistortionResult,hoursonldenandassessment_period_minonimpulse_prominenceamong them), and the old fields of seven records (ci_lower,minimum_phase_response,AudioFileInfo.frames,SoundEnergyResult.events,ReportMetadata.source_positions,ImpulseProminenceResult.assessment_period_minamong them) are gone from their dataclass fields.The guards
tests/test_public_vocabulary.pygains one guard, rewrites one and widens two, each with tests on made-up names that pin what it must catch and what it must leave alone.test_a_count_is_n_pluralreads every public parameter, field and property annotatedintorint | Noneand fails when its head noun is a plural withoutn_: the last word, read before a preposition (responses_at_threshold) and before a trailing participle (positions_used), behind amin_ormax_. A rate (points_per_bandwidth,seconds_per_decade) is not a count, and a name that is a unit of time alone (seconds,minutes,hours,days,years) fails as a duration that names no quantity whatever it holds, one number, a tuple of the durations of several periods or an array; that is how the elevensecondsand the twohoursofldenandldnwere found. Its exceptions are keyed by location with their reason: thedecimalsa value is rounded to, the degrees of freedom of the soundscape t test, and the lengths counted in samples or grid cells (delay_samples,linear_phase_samples,burst_samples,period_samples,absorbing_layer_cells); an exception that matches nothing fails too.test_words_are_spelled_outnow fails onminimumormaximumin any public name, parameter, field, property, constant, function, class or module, with the spelling to write in its case (min,MIN,Min); the term-of-art list and the rule that a function or a class is named in words are gone, and so are the two exemptions they needed. A maximum in decibels still fails asmax_db. It also fails oncias a word of any public name, so aci_low, aci_lower_dbor aCiBoundscannot come back where the exact spellings below would miss them; the impact sound adaptation term C_I of ISO 717-2 (ci,ci_50_2500,ci_delta,ci_r) keeps its symbol, keyed by location in seven entries with that reason. A made-up public function withci_low,ci_lower_dbandsecondsparameters, planted insignals.spectra, fails both guards by those three names.test_one_concept_is_spelled_one_wayrefusesci_lower,ci_upper,lower_ciandupper_ci. The message check refuses a message that names a count by the spelling it left ('events'besiden_events) or amin_/max_name by its long spelling; it foundFDTD2D.run(n_steps)handing its count to a helper that still called it'steps', fixed here. The walk under all of them now reads the three classes the root publishes, which is howReportMetadata.source_positionsandreceiver_positionswere found: the root serves them through a lazy__getattr__, so no namespace the guards read held them.Red on the base this branch sits on (0bc8fbe), with this branch's tests:
Green on this branch: all three lists are empty,
tests/test_public_vocabulary.pypasses 88 tests and, withtests/test_removed_names.py, 341.scripts/check_parameter_units.pyno longer reads_minas a unit. Its unit list wrote the minute as_min, so a period that ended in it passed as naming its unit, while every other public name that ends in_minis a minimum (f_min,kij_min,envelope_min) or a rate per minute. The minute is_minutesnow, as the hour is_hours, and a minute underperreads as the denominator of a rate (_ft_per_min, the climb rate of the ANP database). A period that ends in_minnames no unit and fails, which is howassessment_period_minwas found; tests on made-up names pin both halves, and thatminalone is no unit tail, so a name beside the same name ending in_minis never read as one quantity spelled two ways.Red on the base this branch sits on (0bc8fbe), with this branch's script. The third name and the stale exemption are this branch's own rename of
minimum_phase_response, whose exemption the script now keys undermin_phase_response:Green on this branch:
check_parameter_unitsreports nothing andtests/test_check_parameter_units.pypasses 152 tests.