Add explicit new trajectory for new target, spacecraft and instrument
At the moment, if the user wants to change the target, spacecraft or instrument property of the Trajectory
object, it should be done with the __getitem__()
function:
new_traj_janus = traj_sc['JANUS'] # new observer => JUICE_JANUS
new_traj_juice = traj_inst['JUICE'] # new observer => JUICE
new_traj_jupiter = traj['JUPITER'] # new target => Earth
Internally, a new trajectory object is created and return to the user with the updated parameter.
The ways the new trajectory is created can be a bit confusing. It is not clear which property is updated and in some case we even observed name collisions (JANUS
can be JUICE_JANUS
instrument and JANUS
the minor moon of Saturn).
@lpenasa also noticed that it is possible to edit the Trajectory
property directly and in that case, the properties already computed are kept in the cache:
>>> traj.dist # Distance to Ganymede for example
[1, 2, 3, 4, ...]
>>> traj.target = 'Earth'
>>> traj.dist
[1, 2, 3, 4, ...] # Cached propertied from the old target
This manual property change should not be allowed or at least should purge the cache if it appends (and raise a warning message).
Here we propose to add an explicit method to create/edit trajectory properties:
traj.new_target('Earth')
traj.new_spacecraft('Europa Clipper')
traj.new_instrument('JANUS')
The current __getitem__()
should be depreciated (with a warning) and the new syntax should be reported in the docs and its usage encourage.
These methods can also be promoted to the TourConfig
object as well.
Note:
We currently support shortcuts like traj['SUN']
and traj['SS']
to retrieve the sub-solar points coordinates. These shortcuts will also be depreciated and the user is encourage to use the traj.ss
or traj.sun_lonlat
property instead.