fix: correct min_radial_dist unit mismatch in calc_sfaps#10
Merged
RaulSimpetru merged 1 commit intoMay 19, 2026
Merged
Conversation
The default min_radial_dist was computed as mean(fiber_diameters) * 1000, which converts ~0.05 mm diameters to ~52.5 mm. Since radial_distance (fiber-to-electrode) is in mm and typically 0.03-8.5 mm, every fiber was clamped to the same 52.5 mm threshold, making SFAPs spatially invariant to electrode XY displacement. Remove the * 1000 multiplier so the clamping threshold equals the mean fiber diameter (~0.05 mm), restoring correct XY sensitivity.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The default
min_radial_distinMotorUnitSim.calc_sfaps()is computed as:With typical fiber diameters of ~0.05 mm, this yields a clamping threshold of ~52.5 mm. Since
radial_distance(fiber-to-electrode, line 349) is in mm and ranges from 0.03–8.5 mm, every fiber is clamped to the same value, making SFAPs spatially invariant to electrode XY displacement.Changes
* 1000multiplier — the clamping threshold now equals the mean fiber diameter (~0.05 mm), keeping consistent mm units.min_radial_distis in mm and serves as a singularity guard.Impact
After this fix,
calc_sfaps()correctly produces distance-dependent SFAP amplitudes. All existing tests pass (39 passed, 2 skipped).