Poliastro: Observation time in transformations from/to fixed frames

Created on 21 Nov 2019  路  3Comments  路  Source: poliastro/poliastro

Use/goal of obstime for fixed frames is not 100% clear.

馃悶 Problem

import astropy.time
import astropy.units as u
from poliastro import frames
from poliastro import bodies
import numpy as np

obstime = astropy.time.Time.now() + astropy.time.TimeDelta(np.arange(60 * 24 * 10) * 60 * u.s)
start_time = obstime[0]
testloc = frames.fixed.MarsFixed(10 * u.deg, 20 * u.deg, distance=bodies.Mars.R, obstime=start_time)
testloc.transform_to(frames.MarsICRS)

This piece of code returns:

<MarsICRS Coordinate (obstime=J2000.000): (ra, dec, distance) in (deg, deg, AU)
    (193.84796915, -4.78614788, 1.63061226)>

Which is incorrect since get_body_barycentric_posvel has been performed with testloc.obstime and the rotational elements have been evaluated at testloc.obstime as well.

馃挕 Possible solutions

Solution 1:

  • In this case the obstime should be copied from fixed_coo to equatorial_frame to stay consistent.
    Solution 2:
  • Perform the calculation w.r.t the obstime of the new frame

Currently it makes sense to me to just overwrite the obstime of the new frame with the obstime of the FixedFrame since the transform_to method is not performing any propagation but merely transforming coordinate systems without touching the time value.

bug

All 3 comments

Actually, solution 1 is the correct one, even if in inertial frames the obstime does not change the coordinates it may be preserved for future calculations.

Good report @noc0lour, labeling this as a bug!

Looking at how this is handled in astropy:

  • Transformations to new frames take the target frame obstime
  • For some frames (taking into account earth nutation etc.) this requires transforming the source coordinates to the required target obstime
  • For the planetary fixed frames this is not a big issue since they are simplified versions.

I will send a PR pulling the fixed frames in line with the astropy frames.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

void4 picture void4  路  6Comments

astrojuanlu picture astrojuanlu  路  7Comments

astrojuanlu picture astrojuanlu  路  6Comments

SolSysMiner picture SolSysMiner  路  4Comments

astrojuanlu picture astrojuanlu  路  5Comments