Add a custom kernel to a Trajectory / TourConfig
Description
Currently the moon-coverage tracks the content of the SPICE pool in a very aggressive way.
When a Trajectory
property is requested:
- if the computation result is in the cache, the result is return to the user without any SPICE calculation (and the pool is left untouched).
- if the computation result is not in the cache, the tool will check that the content of the SPICE pool correspond to the kernels listed when the
Trajectory
was configured (usually in theTourConfig
). If the content is the same, the calculation is performed without touching the pool. If the content of the pool has changed (with a manualspiceypy.furnsh()
for example), then the whole content of the pool is purged and only the kernels listed in theTrajectory
object are reloaded.
This approach ensure that Trajectory
objects always compute their properties on their own set of kernels and avoids pool poisoning from other trajectories or/and if the user have manually changed the pool content.
Update the docs
This clarification needs to be highlighted in the docs to make sure that the user is aware of this behavior that could be counterintuitive when they want to manually add kernels to a given trajectory.
New feature
It should be possible for the user to add a kernel to a Trajectory
object:
custom_traj = traj.add_kernel('custom.ck')
The results will be a new Trajectory
object, with an empty cache, and its list of kernels will be:
custom_traj.kernels == traj.kernels + ['custom.ck']
Similarly, it should also be possible to add a new kernel at the TourConfig
level:
new_tour = tour.add_kernel('custom.ck')
All the children trajectories will include the custom.ck
kernel.
Possible extension
- Support for multiple kernels inputs could be envisioned:
traj.add_kernel('custom_1.ck', 'custom_2.ck')
# or/and
traj.add_kernel(['custom_1.ck', 'custom_2.ck'])
- It could be useful to add a
.remove_kernel()
function as well, but it is unclear how to select which kernel to remove (full path name vs. short name, duplicated kernels in pool). For now (%Version 0.12) this feature will not be included.
/cc @mcosta @ibelgacem