Skip to content

Enhance alphaBetaMasses with velocity-dependent final mass computation#63

Merged
dvida merged 2 commits into
wmpg:masterfrom
AstroEloy:master
Jun 12, 2026
Merged

Enhance alphaBetaMasses with velocity-dependent final mass computation#63
dvida merged 2 commits into
wmpg:masterfrom
AstroEloy:master

Conversation

@AstroEloy

@AstroEloy AstroEloy commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

This update extends alphaBetaMasses() by supporting the full alpha-beta final-mass solution when both initial and terminal velocities are provided. The previous asymptotic approximation is retained for backward compatibility when velocity information is unavailable.

The new functionality has also been integrated into the command-line interface, using the terminal velocity predicted by the fitted alpha-beta solution to ensure consistency when calculating masses with the general alpha-beta formulation.

Additional improvements include:

  • Input validation for alpha, beta, slope, mu, density, drag parameter, shape coefficient, and velocity inputs.
  • Optional verbose output summarizing the adopted parameters and resulting mass estimates.
  • Expanded documentation and updated docstrings.
  • alphaBetaVelocity() now accepts both scalar and array height inputs.
  • Minor typos and documentation issues corrected.
  • The meteorite-dropping possibility plot now displays the estimated final masses for both μ = 0 and μ = 2/3.
  • Initial and final masses are now printed using scientific notation (:.2e) instead of fixed-point formatting.

This update extends alphaBetaMasses by supporting the full alpha-beta
final-mass solution when both initial and final velocities are provided.
The previous asymptotic approximation is retained for backward
compatibility when velocity information is unavailable.

Additional improvements include:
- Input validation for alpha, beta, mu, density, drag parameter,
  shape coefficient, and velocities.
- Optional verbose output summarizing the adopted parameters and
  resulting mass estimates.
- Expanded documentation.
@dvida

dvida commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Thanks for the PR — the velocity-dependent final-mass extension is a useful addition and the underlying math is correct (it's the standard Gritsevich dimensionless mass equation, with the old exp(-beta/(1-mu)) recovered as the v_end → 0 limit). The input validation is also a nice touch. A few things to fix before merge:

1. Duplicate function definition (blocking). The new alphaBetaMasses is appended after the existing one rather than replacing it. The file now has two functions with the same name (old at lines ~456–487, new right after). Python silently uses the last definition, so the old one becomes dead code. Please delete the original def alphaBetaMasses(...) block and keep only the new version. As-is, this also leaves two conflicting docstrings (gamma described as "Drag coefficient (2*drag factor)" in the old one vs. "Γ = C_D/2" in the new one).

2. Feature isn't wired into the CLI. The only callers are in the __main__ block (lines ~612 and ~614), and they don't pass vel_init/vel_end — so the new full solution is never exercised by the script itself, only via direct import. Since v_init is already available (line ~608) and the trajectory has the final velocity, please pass them through so the CLI actually uses the new path (or note explicitly that it's library-only).

3. Minor style. Trailing whitespace on several blank lines (docstring opener, before if verbose, etc.), and add a second blank line before the def per PEP8.

Once the duplicate is removed and the velocities are plumbed into the main block, this is good to go.

@AstroEloy

Copy link
Copy Markdown
Contributor Author

Thanks for the review.

The duplicate alphaBetaMasses definition has been removed and only the updated implementation remains.

The CLI has been updated to use the terminal velocity predicted by the fitted alpha-beta solution and now passes vel_init and vel_end to alphaBetaMasses, so the full formulation is exercised directly from the command-line tool.

Additional updates include:

  • Input validation for alpha, beta, slope, mu, density, drag parameter, shape coefficient, and velocity inputs.
  • Optional verbose output summarizing the adopted parameters and resulting mass estimates.
  • Expanded documentation and updated docstrings.
  • alphaBetaVelocity() now accepts both scalar and array height inputs.
  • Minor typos and documentation issues corrected.
  • The meteorite-dropping possibility plot now displays the estimated final masses for both μ = 0 and μ = 2/3.
  • Initial and final masses are now printed using scientific notation.

@dvida dvida merged commit 7b53e33 into wmpg:master Jun 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants