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

JS VectorObserver / inverse_terra sometimes fails to converge #347

Open
tostt opened this issue May 27, 2024 · 3 comments
Open

JS VectorObserver / inverse_terra sometimes fails to converge #347

tostt opened this issue May 27, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@tostt
Copy link
Contributor

tostt commented May 27, 2024

There is a possible heisenbug with VectorObserver().
When running the following loop, I end up with the error Uncaught inverse_terra failed to converge (for the value ts=1717780096005).

const body = Astronomy.Body.Sun
for (let ts = 1717780096000; ts <= 1717780096200; ts++) {
   var date = new Date(ts);
   var vect = Astronomy.GeoVector(body, date, true)
   console.log('ts, date, vector', ts, date.valueOf(), vect)
   var point = Astronomy.VectorObserver(vect)
   console.log('point', point)
   console.log('*')
}

However, when I change the starting point of the loop, say from 1717780096000 to 1717780096001, the program falls in error later in the loop. Is anyone able to reproduce this error ?

@cosinekitty
Copy link
Owner

Thank you for your bug report! I have confirmed this is a real problem. I am investigating, and will report back here when I have an update.

@cosinekitty cosinekitty self-assigned this May 27, 2024
@cosinekitty cosinekitty added the bug Something isn't working label May 27, 2024
@cosinekitty cosinekitty changed the title Possible bug with VectorObserver() JS VectorObserver / inverse_terra sometimes fails to converge May 27, 2024
@cosinekitty
Copy link
Owner

cosinekitty commented May 27, 2024

Here is a stack trace using unminified code:

$ node --trace-uncaught test vecobs

/home/don/github/astronomy/source/js/astronomy.js:1942
                throw `inverse_terra failed to converge.`;
                ^
inverse_terra failed to converge.
Thrown at:
    at inverse_terra (/home/don/github/astronomy/source/js/astronomy.js:1942:17)
    at VectorObserver (/home/don/github/astronomy/source/js/astronomy.js:2700:12)
    at VectorObserverTest (/home/don/github/astronomy/generate/test.js:2857:30)
    at main (/home/don/github/astronomy/generate/test.js:3719:16)
    at /home/don/github/astronomy/generate/test.js:3727:14
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at executeUserEntryPoint (node:internal/modules/run_main:86:12)

Node.js v18.18.0

cosinekitty added a commit that referenced this issue May 27, 2024
I tried more distant objects like Jupiter ... Neptune.
This revealed that at increasing distances, the convergence
threshold in inverse_terra needed to increased also.
So now I use 1 AU as a baseline, and scale up linearly
for more distant objects.
@cosinekitty
Copy link
Owner

This commit was not supposed to close the issue. Re-opening now, because there are more changes coming.

@cosinekitty cosinekitty reopened this May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants