Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove numerical instability in shock_spectrum for damp values near zero #182

Open
CrepeGoat opened this issue Feb 16, 2022 · 1 comment
Labels
endaq.calc Related to `endaq.calc` enhancement New feature or request

Comments

@CrepeGoat
Copy link
Contributor

CrepeGoat commented Feb 16, 2022

The coefficient generation functions are written to perform the verbatim calculations described in ISO 18431-4. These formulas are written in terms of the quality factor Q, which is related to the damping coefficient:
ζ = 1 / (2Q)
-> Q = 1 / (2ζ)
Notably, the damping coefficient can take any value in the range ζ ∈ [0, 1], which means the quality factor lies in the infinite range Q ∈ [1/2, ∞], which can exhibit numerical instabilities in the higher value range, i.e., when ζ -> 0.

However, because these formulas exclusively use Q as an inverted factor (1 / Q), the equations could be equivalently expressed in terms of the damping coefficient (1 / Q) = 2ζ, which would remove the numerical instabilities from computations involving near-infinite-valued Q. This would make our shock_spectrum calculations more resilient to numerical errors in the (admittedly uncommon) use case where ζ -> 0.

@CrepeGoat CrepeGoat added enhancement New feature or request endaq.calc Related to `endaq.calc` labels Feb 16, 2022
@pscheidler
Copy link
Member

It looks like damping is always set as named parameter (not sure if that's the right term, but you need to call endaq.calc.shock.shock_spectrum(accel, damp=0.05). So it seems safe if you can add a named parameter for quality, have it override damp if it is explicitly set. Not sure if you can check if the user explicitly sets damp, but it would be great to have a deprecation warning if they do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
endaq.calc Related to `endaq.calc` enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants