Astropy: 速度と「単位」表現を持つフレームはデカルトに変換できません

作成日 2017年12月23日  ·  3コメント  ·  ソース: astropy/astropy

#6944のいくつかのコーナーケーステストでは、実際の表現がUnitSphericalである速度を持つフレームの問題のある動作が明らかになりました。 これが真実であることが判明しました。 以下のケースは、問題を示しています。

#6944がマージされた場合、このバグの回避策がある場所がいくつかあることにも注意してください。 このバグが修正された場合は、これらの回避策を削除する必要があります( coordinatesサブパッケージで#7028を検索して見つけてください)。

これは機能します:

>>> f = ICRS(1*u.deg, 2*u.deg)
>>> f.cartesian
<CartesianRepresentation (x, y, z) [dimensionless]
    ( 0.99923861,  0.01744177,  0.0348995)>

しかし、これら2つのケースはそうではありません:

>>> f = ICRS(1*u.deg, 2*u.deg,
          pm_dec=1*u.mas/u.yr, pm_ra_cosdec=2*u.mas/u.yr, radial_velocity=10*u.km/u.s)
>>> f.represent_as('cartesian', in_frame_units=True)
UnitConversionError: 'mas / (rad yr)' (frequency) and 'km / s' (speed) are not convertible
>>> f = ICRS(1*u.deg, 2*u.deg, 
                pm_dec=1*u.mas/u.yr, pm_ra_cosdec=2*u.mas/u.yr)
>>> g = f.transform_to(GCRS)
>>> g.cartesian
UnitConversionError: '1 / s' (frequency) and 'km / s' (speed) are not convertible

2番目の失敗したケースでは、 f.cartesian機能することはおそらく有用な手がかりですが、GCRSへの変換の何かが、失敗し始める原因になっています。 これらは微妙に異なる問題である可能性がありますが、おそらく一緒に解決する必要があるほど十分に近いものです。

@adrnまたは@mhvk 、ここで何が起こっているのか考えてみませんか? 少なくとも上記の変換ステップはやや不明確であると主張することもできますが、単位が少し変わっていても、デカルト表現を取得できるはずです...

Bug coordinates

全てのコメント3件

こんにちは@eteq

私はこの問題に取り組んでいました。 しかし、例の場合、


>>> f = ICRS(1*u.deg, 2*u.deg,
          pm_dec=1*u.mas/u.yr, pm_ra_cosdec=2*u.mas/u.yr, radial_velocity=10*u.km/u.s)
>>> f.represent_as('cartesian', in_frame_units=True)

この例にはdistanceは含まれていませんが、 radial_velocityます。 私はそれが正確に何を意味するのか理解していませんでした。 また、フレームに少し距離を置くと完璧に動作します!

問題を理解させていただけませんか。混乱しています。

@shreyasbapathttps ://github.com/astropy/astropy/pull/9064でこの問題が修正されるかどうかを確認して

9086は私にこの問題を思い出させました。 2つの場合:

距離はありませんがRV付き

>>> f = ICRS(1*u.deg, 2*u.deg,
          pm_dec=1*u.mas/u.yr, pm_ra_cosdec=2*u.mas/u.yr, radial_velocity=10*u.km/u.s)
>>> f.represent_as('cartesian', in_frame_units=True)
UnitConversionError: 'mas / (rad yr)' (frequency) and 'km / s' (speed) are not convertible

これは解決できないと思います。距離がないと、固有運動を空間速度に変換したり、空間速度を無秩序な速度に変換したりすることはできません。 したがって、この場合は、エラーメッセージがより明確であることを確認する必要があると思います(RVはあるが距離がないことによってトリガーされます)。

座標変換によって導入されたRV

>>> f = ICRS(1*u.deg, 2*u.deg, 
                pm_dec=1*u.mas/u.yr, pm_ra_cosdec=2*u.mas/u.yr)
>>> g = f.transform_to(GCRS)
>>> repr(g)
# error
>>> g.data
<CartesianRepresentation (x, y, z) [dimensionless]
    (0.99923901, 0.01742676, 0.03489572)
 (has differentials w.r.t.: 's')>
g.data.differentials
<CartesianDifferential (d_x, d_y, d_z) in 1 / s
    (6.07736084e-13, -1.85772092e-11, -8.12625661e-12)>

これはかなり微妙です。 固有運動がなければ、 gUnitSphericalであり、これは理にかなっています。ここでもそうあるはずなので、変換に問題があります。 完全を期すために、単位球でそれを表すことは機能します。

g.represent_as('unitspherical')                                                               
Out[24]: 
<UnitSphericalRepresentation (lon, lat) in rad
    (0.01743826, 0.0349028)
 (has differentials w.r.t.: 's')>

In [25]: g.represent_as('unitspherical').differentials['s']                                            
Out[25]: 
<UnitSphericalDifferential (d_lon, d_lat) in rad / s
    (-1.85963079e-11, -8.13120751e-12)>

しかし、それでも、 g.cartesianはずです-ここでの問題は、フレームがユーザーにとって適切な単位を決定し、デカルト速度がkm/sであると主張することです(もちろん、これは元に戻ります)表現の座標単位が私のために決定されるという私の長年の苦情に...): https

ユニット自体は以下から取得されます。

g.representation_info
{astropy.coordinates.representation.CartesianRepresentation: {'names': ['x',
   'y',
   'z'],
  'units': [None, None, None]},
 astropy.coordinates.representation.UnitSphericalRepresentation: {'names': ('ra',
   'dec'),
  'units': (Unit("deg"), Unit("deg"))},
 astropy.coordinates.representation.RadialRepresentation: {'names': ['distance'],
  'units': [None]},
 astropy.coordinates.representation.SphericalRepresentation: {'names': ('ra',
   'dec',
   'distance'),
  'units': (Unit("deg"), Unit("deg"), None)},
 astropy.coordinates.representation.PhysicsSphericalRepresentation: {'names': ['phi',
   'theta',
   'r'],
  'units': [Unit("deg"), Unit("deg"), None]},
 astropy.coordinates.representation.CylindricalRepresentation: {'names': ['rho',
   'phi',
   'z'],
  'units': [None, Unit("deg"), None]},
 astropy.coordinates.representation.CartesianDifferential: {'names': ('v_x',
   'v_y',
   'v_z'),
  'units': (Unit("km / s"), Unit("km / s"), Unit("km / s"))},
 astropy.coordinates.representation.UnitSphericalDifferential: {'names': ('pm_ra',
   'pm_dec'),
  'units': (Unit("mas / yr"), Unit("mas / yr"))},
 astropy.coordinates.representation.SphericalDifferential: {'names': ('pm_ra',
   'pm_dec',
   'radial_velocity'),
  'units': (Unit("mas / yr"), Unit("mas / yr"), Unit("km / s"))},
 astropy.coordinates.representation.UnitSphericalCosLatDifferential: {'names': ('pm_ra_cosdec',
   'pm_dec'),
  'units': (Unit("mas / yr"), Unit("mas / yr"))},
 astropy.coordinates.representation.SphericalCosLatDifferential: {'names': ('pm_ra_cosdec',
   'pm_dec',
   'radial_velocity'),
  'units': (Unit("mas / yr"), Unit("mas / yr"), Unit("km / s"))},
 astropy.coordinates.representation.RadialDifferential: {'names': ['d_distance'],
  'units': [None]},
 astropy.coordinates.representation.PhysicsSphericalDifferential: {'names': ['d_phi',
   'd_theta',
   'd_r'],
  'units': [None, None, None]},
 astropy.coordinates.representation.CylindricalDifferential: {'names': ['d_rho',
   'd_phi',
   'd_z'],
  'units': [None, None, None]}}

ここで間違っているのはCartesianDifferentialだけであることがわかります。これは、優先単位が設定されているためです。

これはおそらく、#9086の修正は小さな変更で問題ないことを意味します。要求されたユニットに移動しようとしますが、失敗しても気にしないでください。

このページは役に立ちましたか?
0 / 5 - 0 評価