Astropy: الإطارات ذات السرعات وتمثيل "الوحدة" تفشل في التحويل إلى ديكارت

تم إنشاؤها على ٢٣ ديسمبر ٢٠١٧  ·  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)>

لكن هاتين الحالتين لا:

>>> 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

من المحتمل أن يكون لديه أدنى فكرة مفيدة أنه في حالة عدم الثانية، 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 . لم أفهم ما تعنيه بالضبط. أيضًا ، إذا وضعت بعض المسافة في الإطار ، فستعمل بشكل مثالي!

هل يمكنك أن تجعلني أفهم المشكلة ، أشعر بالارتباك.

shreyasbapat هل يمكنك من فضلك محاولة معرفة ما إذا كان https://github.com/astropy/astropy/pull/9064 يصلح هذه المشكلة؟ (تحرير: لا)

9086 ذكرني بهذه المشكلة. في الحالتين:

لا مسافة ولكن مع عربة سكن متنقلة

>>> 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)>

هذا أكثر دقة إلى حد ما. بدون الحركة المناسبة ، يكون g هو UnitSpherical ، وهو أمر منطقي ، وهنا يجب أن يكون كذلك ، لذلك هناك خطأ ما في التحويل. للتأكد من اكتمالها ، فإن تمثيلها في مجال الوحدة يعمل:

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://github.com/astropy/astropy/blob/c3dc7b38303b3615945aa36a11ebf7bd31d5cc0a/astropy/coordinates/baseframe.py#L1744 -L1753

الوحدات نفسها مأخوذة من:

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 التقييمات