This is part of the changes to kadi, chandra_aca, ska_sun, Quaternion, and Chandra.Maneuver to make kadi command states faster.
This change is to use convert_time_format in place of CxoTime or DateTime. Some slight re-ordering of code logic was needed but the changes should be fairly understandable.
This PR also avoids using astropy units in this context. While units are nice and elegant, regular floats / np.arrays are much faster.
Interface impacts
Testing
Unit tests
[x] Mac
Independent check of unit tests by Jean
[x] Linux
Functional tests
Functional performance improvements
About a factor of two for these cases.
Setup:
>>> from chandra_aca.planets import get_planet_eci, get_planet_angular_sep
>>> from cxotime import CxoTime
>>> times = CxoTime("2023:001").secs + np.linspace(0, 1000, 100)
Flight:
>>> %timeit dat = get_planet_eci("mars", times)
823 µs ± 15.5 µs per loop (mean ± std. dev. of 7 runs, 1,000 loops each)
>>> %timeit get_planet_angular_sep("mars", time=times, ra=0, dec=1)
860 µs ± 4.5 µs per loop (mean ± std. dev. of 7 runs, 1,000 loops each)
Description
This is part of the changes to kadi, chandra_aca, ska_sun, Quaternion, and Chandra.Maneuver to make kadi command states faster.
This change is to use
convert_time_format
in place ofCxoTime
orDateTime
. Some slight re-ordering of code logic was needed but the changes should be fairly understandable.This PR also avoids using astropy units in this context. While units are nice and elegant, regular floats / np.arrays are much faster.
Interface impacts
Testing
Unit tests
Independent check of unit tests by Jean
Functional tests
Functional performance improvements
About a factor of two for these cases.
Setup:
Flight:
PR:
convert_time_format() reference
For reference, here are timing comparisons showing that
convert_time_format
is indeed faster thanDateTime
for common cases: