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

Can't create orbit #36

Closed
mileslucas opened this issue Sep 22, 2022 · 0 comments · Fixed by #37
Closed

Can't create orbit #36

mileslucas opened this issue Sep 22, 2022 · 0 comments · Fixed by #37

Comments

@mileslucas
Copy link
Member

Found a small bug that happened where the mean anomaly would not get reduced to a unitless number automatically, which creates a method error for AstroLib.kepler_solver.

orbit = KeplerianOrbit(;
    period=(40.57±0.19)u"yr",
    ecc=0.42±0.009,
    Omega=(318.6±0.6)u"°",
    tp=(1972.12±0.16)u"yr",
    incl=(54.7±0.6)u"°",
    a=(0.154±0.001) * 144.51u"AU",
    omega=(72.6±0.8)u"°"
)
pos = relative_position(orbit, orbit.tp)

Output:

ERROR: MethodError: no method matching kepler_solver(::Quantity{Measurement{Float64}, NoDims, Unitful.FreeUnits{(AU⁻³ᐟ², m³ᐟ²), NoDims, nothing}}, ::Float64)
Closest candidates are:
  kepler_solver(::Real, ::Real) at ~/.julia/packages/AstroLib/Yq5lS/src/kepler_solver.jl:4
Stacktrace:
 [1] compute_true_anomaly(# ...

it gets fixed by throwing a uconvert(u"NoUnits", M) in the compute_true_anomaly method, which should work fine because normal numbers won't be affected by the conversion. I have a PR ready for this.

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 a pull request may close this issue.

1 participant