-
Notifications
You must be signed in to change notification settings - Fork 100
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
Optimize Astrometry #1643
Optimize Astrometry #1643
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #1643 +/- ##
==========================================
+ Coverage 68.55% 68.58% +0.03%
==========================================
Files 103 103
Lines 23516 23562 +46
Branches 4102 4113 +11
==========================================
+ Hits 16122 16161 +39
- Misses 6378 6380 +2
- Partials 1016 1021 +5
☔ View full report in Codecov by Sentry. |
Current performance comparison before and after these changes (updated periodically): (The benchmarks use example data for NGC6440E.) Before: After: |
7b6c6b4
to
d3c7be9
Compare
Is your override function fully accurate? It's basically the linear approximation, but there are cases where higher-order terms are needed (like for very large proper motions and long time spans). Do you have any tests to check the accuracy? |
If you look at: |
So I'm testing just the ERFA function alone, and it seems slower. so maybe it's not that simple. It's also possible that the differences between the linear and correct versions depend on things like an accurate distance and RV, which in general we don't have. So maybe we don't worry. |
Another possibility is that if you only need the cartesian components you could do something like:
|
OK, it's not the ERFA function itself that is slow. It's wrapping it into another
That is faster even than the linear version (maybe because of unit conversion?) and a lot faster than the astropy version. But I think it agrees exactly with the astropy version. |
Comparing:
I find:
|
Closing this because this only implements the linear approximation to the proper motion. A more rigorous treatment is needed for this. |
I am specifically targeting the NGC6440E example dataset in this PR. The benchmarks I am using are (for NGC6440E):
I'll add more benchmarks in the future.
The improvements I have made are as follows.
Quantity.decompose
as much as possible (seeQuantity.decompose()
is slower thanQuantity.to()
#1641)ssb_to_psb_xyz_ICRS
andssb_to_psb_xyz_ECL
functions in the astrometry classes are big performance sinks. I don't fully understand why this is so, only that this has something to do withastropy.coordinates
. I have added overrides ofssb_to_psb_xyz_ICRS
inAstrometryEquatorial
andAstrometryEcliptic
that don't useastropy.coordinates
, and this seems to take care of this issue.get_d_delay_quantities
.update
option inResiduals.chi2()
to re-compute cached quantities (helpful for profiling).