Add an explicit way to force kernels loading in Tourconfig/Trajectory
Description of the current behavior
At the moment, TourConfig
and Trajectory
objects store the list of kernels they require internally, up to the moment when they need to compute a SPICE related quantity. This check of the SPICE pool is performed by the @check_kernels
decorator (by comparing the SpicePool with the object hash that list its kernels content).
This behavior allows the user to work safely with multiple kernels set without any risk of collisions (the pool is check, flush and refilled if this content does not correspond to the expected content).
However, for performance reasons, the kernels are only loaded when required. If the user does not request any SPICE related quantity, the kernels are not loaded into the pool:
>>> spiceypy.kclear()
>>> tour = TourConfig(mk='juice_crema_5_0.tm')
>>> spiceypy.ktotal('ALL')
0
The pool is empty. But if you request a SPICE related quantity skd_version
for example:
>>> spiceypy.kclear()
>>> tour = TourConfig(mk='juice_crema_5_0.tm')
>>> tour.skd_version
>>> spiceypy.ktotal('ALL')
66
The kernels are loaded into the pool.
Proposition
In some case, the user may way to load its kernels with TourConfig
and perform its computation with spiceypy. In that case, we need a method to explicit force the kernels to be loaded into the pool at the initialization step or later on (to reload the kernels):
tour = TourConfig(mk='juice_crema_5_0.tm', load_kernels=True)
tour.load_kernels()
The pool should be check and the kernels reload only if necessary.