Closed MichaelBonnet closed 10 months ago
For what it's worth, I switched to using a better angle calculation function that gets around potential precision issues inherent to arccos:
def angle_between_vectors_deg(a: np.ndarray, b: np.ndarray) -> float:
n_a = np.linalg.norm(a, axis=0)
n_b = np.linalg.norm(b, axis=0)
y = np.linalg.norm(n_b * a - n_a * b, axis=0)
x = np.linalg.norm(n_b * a + n_a * b, axis=0)
return np.rad2deg(2 * np.arctan2(y, x))
but my issue still remains.
I've answered more at length over on your Stack Exchange question:
But, in short, you are applying the affects of aberration and deflection when you call .apparent()
, but FreeFlyer doesn't appear to do those calculations, so if you leave that call off you should get much closer agreement. I'm going to close this issue, as I think that answers your question, but feel free to comment further about any lingering questions.
I have two functions that get TEME and GCRS Earth-Sun position vectors:
earth_sun_vectors.py
To validate the functionality, I have generated test data with a common industry tool, FreeFlyer. The FreeFlyer documentation clearly states that
FreeFlyer will use the De430.dat file by default
, hence why I usede430_1850-2150.bsp
as my ephemeris file.Below are my test functions, written using pytest:
test_earth_sun_vectors.py
I have created a gist with these and other files, including the test data csv and Docker-related files to minimize possible differences between machines.
An rtol of 0.001 is only 1/10th of 1% which seems not that accurate, especially given that they're seemingly using the same ephemeris. More concerning is the variance in the 1e1 arcseconds range, which could throw off things like eclipse calculations.
My chief concern is understanding why my methodology is resulting in different results from my test data, when both my methods and the test data generating tool are using the same ephemeris. What might be the root cause of this difference? Am I using an incorrect function?
Thanks for any and all help.