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

Orbit epoch #2027

Merged
merged 8 commits into from
Nov 12, 2021
Merged

Orbit epoch #2027

merged 8 commits into from
Nov 12, 2021

Conversation

gzotti
Copy link
Member

@gzotti gzotti commented Nov 11, 2021

Description

This finally adds the epoch information to the KeplerOrbit object.

For some time now we have avoided showing objects (minor bodies) when their orbital elements were outdated.
However, it was always assumed that the orbital elements' epoch was equal to perihelion date, which is not necessarily the case.
This lead to unclear situations like wrong cut-away dates for asteroids with several years' orbital period.

Orbital elements should in fact be updated regularly. I also added a warning in the InfoString when date is outside the "good" range. It may be discussed if the orbit_good evaluation or Planet::hasValidPositionalData() should be extended to allow differentiation between elements "good enough to show closed orbit" (years) and "good enough to find in telescope" (months).

Fixes #2000 (issue)

Screenshots (if appropriate):

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • This change requires a documentation update

How Has This Been Tested?

Test Configuration:

  • Operating system: Windows 10 (irrelevant)
  • Graphics Card: (irrelevant)

Checklist:

  • My code follows the code style of this project.
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@gzotti gzotti added the enhancement Improve existing functionality label Nov 11, 2021
@gzotti gzotti added this to the 0.21.3 milestone Nov 11, 2021
@gzotti gzotti self-assigned this Nov 11, 2021
@todo
Copy link

todo bot commented Nov 11, 2021

does that default to sth meaningful? Do we need it at all?

\item[orbit\_visualization\_period] [days] %TODO does that default to sth meaningful? Do we need it at all?
\end{description}
The other parameters are like those for the major planets.
\subsubsection{Minor Planet section}
\label{sec:ssystem.ini:MinorPlanet}


This comment was generated by todo based on a TODO comment in 7c21f77 in #2027. cc @Stellarium.

@github-actions github-actions bot requested a review from alex-w November 11, 2021 19:38
@github-actions
Copy link

Hello @gzotti! Thank you for this enhancement.

@github-actions
Copy link

github-actions bot commented Nov 11, 2021

Great PR! Please pay attention to the following items before merging:

Files matching src/**/*.cpp:

  • Are possibly unused includes removed?

Files matching guide/**:

  • Did you remember to update screenshots to match new updates?
  • Did you remember to grammar check in changed part of documentation?

This is an automatically generated QA checklist based on modified files

@alex-w
Copy link
Member

alex-w commented Nov 11, 2021

Please update comet_orbit strings in default ssystem_minor.ini file according to Stellarium User Guide.

Please move "note" line to the end of list.

@gzotti
Copy link
Member Author

gzotti commented Nov 11, 2021

I would still leave "comet_orbit" for compatibility with earlier versions. In 0.21+ we need no explicit orbit_func at all, but understand kepler_orbit and comet_orbit. But I often run earlier versions for comparison.

The NOTE in infostring is just below the coordinates. Do you mean I should move that to the end of the infostring?

@alex-w
Copy link
Member

alex-w commented Nov 11, 2021

I would still leave "comet_orbit" for compatibility with earlier versions. In 0.21+ we need no explicit orbit_func at all, but understand kepler_orbit and comet_orbit. But I often run earlier versions for comparison.

But I said about default file, which will be used in newly installation only. Existed ssystem_minor.ini file will be used as before with comet_orbit string in backward compatible mode.

The NOTE in infostring is just below the coordinates. Do you mean I should move that to the end of the infostring?

Yes, at end of the infosting - this line will be more visible here.

@alex-w
Copy link
Member

alex-w commented Nov 11, 2021

does that default to sth meaningful? Do we need it at all?

Yes, we need it to some moons and probably to some asteroids/comets

@gzotti
Copy link
Member Author

gzotti commented Nov 11, 2021

It's an oldish comment. We could just use one revolution as default for closed orbits. I think in previous years this and orbit_good was sometimes mixed up a bit. Probably we should use this to plot comet orbit around perihelion, and report orbit_good around epoch? Or still plot orbit with this value around epoch as well? These are things to still think over a bit.

@alex-w
Copy link
Member

alex-w commented Nov 11, 2021

It's an oldish comment. We could just use one revolution as default for closed orbits. I think in previous years this and orbit_good was sometimes mixed up a bit. Probably we should use this to plot comet orbit around perihelion, and report orbit_good around epoch? Or still plot orbit with this value around epoch as well? These are things to still think over a bit.

It’s all not for this PR

- it is better to keep hat for a while (while 0.*?) for better
interoperability while running older versions.
Copy link
Member

@alex-w alex-w left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much!

@gzotti
Copy link
Member Author

gzotti commented Nov 11, 2021

Don't merge yet. I may want to check a few more things.

@alex-w
Copy link
Member

alex-w commented Nov 11, 2021

OK, please do it yourself

Copy link
Contributor

@axd1967 axd1967 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gzotti There exists 1P/Halley (2061) - does it fit the current algorithm? 2061 is more than 3 years (approx 1000 days) in the future. It has orbit_good = 20000

Copy link
Contributor

@axd1967 axd1967 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gzotti have a look at axd1967@984084d

  • I really would avoid 1000 but put this in a constant
  • 0 and -1 beg to be cast in enums. but i somehow have a feeling that 0 could lead to bugs

(you can fetch that branch to make work easier)

@gzotti
Copy link
Member Author

gzotti commented Nov 11, 2021

The element set has an epoch of 1994. 20.000 days is definitely uselessly much for assume anything accurate, but it might be good enough for plotting an orbit.

I am just adding a distinction about whether the orbital data is "good enough for plotting an orbit" (defaults to 1/2 sidereal period or orbit_good) or "good enough to be sufficient for setting a telescope". The latter has higher requirements and uses the smaller of (epoch+/-orbit_good) and (epoch+/-1 year) to suggest updating elements after 1 year.

@axd1967
Copy link
Contributor

axd1967 commented Nov 11, 2021

I am just adding a distinction about whether the orbital data is "good enough for plotting an orbit" (defaults to 1/2 sidereal period or orbit_good) or "good enough to be sufficient for setting a telescope". The latter has higher requirements and uses the smaller of (epoch+/-orbit_good) and (epoch+/-1 year) to suggest updating elements after 1 year.

consider somehow coding these two requirements more explicitly? I proposed two enums to get rid of the magic 0 and -1, but these are probably unrelated.
but explicitly coding these requirements will make the code so much more clear.
I'd suggest to use 3*365 rather than 1000 days - even if both values still are magic and probably not 100% justifiable, it's just a bit more human-readable. even 20_000 is less readable than 54+ years...

- Either assumed accurate or good enough for orbit plotting
@lgtm-com
Copy link

lgtm-com bot commented Nov 12, 2021

This pull request introduces 1 alert when merging 48d05ca into cf52aa7 - view on LGTM.com

new alerts:

  • 1 for Missing return statement

@alex-w
Copy link
Member

alex-w commented Nov 12, 2021

The changes is good for me.

@todo
Copy link

todo bot commented Nov 12, 2021

Add state vector equations from Heafner to create orbits from position+velocity,

//! @todo Add state vector equations from Heafner to create orbits from position+velocity,
//! or change orbits from velocity changes.
class KeplerOrbit : public Orbit {
public:
//! Constructor.
//! @param epochJDE JDE epoch of orbital elements.


This comment was generated by todo based on a todo comment in 34b682f in #2027. cc @Stellarium.

@lgtm-com
Copy link

lgtm-com bot commented Nov 12, 2021

This pull request introduces 1 alert when merging 34b682f into cf52aa7 - view on LGTM.com

new alerts:

  • 1 for Missing return statement

@gzotti
Copy link
Member Author

gzotti commented Nov 12, 2021

(According to my understanding this is a false positive. All cases in the switch are handled, and whatever is not handled by some orbit object returns false. )

@axd1967
Copy link
Contributor

axd1967 commented Nov 13, 2021

(According to my understanding this is a false positive. All cases in the switch are handled, and whatever is not handled by some orbit object returns false. )

one day Murphy will knock on that door...

a switch should almost always include a default, even if never used. it's part of defensive programming.

and it's cheap to add a default case; just add a warning (that should never appear; so how about as ASSERT then ? ;-) .

@gzotti
Copy link
Member Author

gzotti commented Nov 13, 2021

Do you know the clang in-editor warning that all switch cases have been fulfilled so there is no need for a default clause?

Else, show me the logical error in the current code. Which code path does not return anything?

@axd1967
Copy link
Contributor

axd1967 commented Nov 13, 2021

I never wrote that the current situation is wrong ;-)
so currently it's OK (especially because all enums are covered.)

@alex-w
Copy link
Member

alex-w commented Nov 13, 2021

I never wrote that the current situation is wrong ;-)

You did it 2 hours ago

@github-actions
Copy link

Hello @gzotti! Please check the fresh version (development snapshot) of Stellarium:
https://github.com/Stellarium/stellarium-data/releases/tag/weekly-snapshot

gzotti added a commit that referenced this pull request Nov 28, 2021
gzotti added a commit that referenced this pull request Nov 28, 2021
- addition to #2027
- also add a ref element
@Stellarium Stellarium locked as resolved and limited conversation to collaborators Nov 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Improve existing functionality
Development

Successfully merging this pull request may close these issues.

Astrocal ephemeris ignores Ceres, Vesta, ...
3 participants