You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
+f") and {print_apy_coordframe_warning_dict['these']}{print_apy_coordframe_warning_dict['were']} not explicitly set in the Orbit initialization using the keywords ({apy_coordframe_warning_keywords[:-2]}); {print_apy_coordframe_warning_dict['these']}{print_apy_coordframe_warning_dict['are']} required for Orbit initialization; proceeding with default {print_apy_coordframe_warning_dict['values']}",
"Orbit._call_internal(t0) and Orbit._call_internal(t=t0) return different results"
9723
9723
)
9724
9724
returnNone
9725
+
9726
+
9727
+
deftest_apy_sunkeywords_not_supplied():
9728
+
# Test for issues #709: print warning when a SkyCoord is used to initialize an
9729
+
# Orbit object, but the Sun's position and velocity are not specified through
9730
+
# galcen_distance, galcen_v_sun, and z_sun
9731
+
fromastropyimportunitsasu
9732
+
fromastropy.coordinatesimportSkyCoord
9733
+
9734
+
fromgalpy.orbitimportOrbit
9735
+
9736
+
# Just missing galcen_distance
9737
+
vxvv=SkyCoord(
9738
+
ra=1*u.deg,
9739
+
dec=1*u.deg,
9740
+
distance=20.8*u.pc,
9741
+
pm_ra_cosdec=0.0*u.mas/u.yr,
9742
+
pm_dec=0.0*u.mas/u.yr,
9743
+
radial_velocity=0.0*u.km/u.s,
9744
+
# galcen_distance=8.3 * u.kpc,
9745
+
z_sun=0.025*u.kpc,
9746
+
galcen_v_sun=[-11.1, 220.0, 7.25] *u.km/u.s,
9747
+
)
9748
+
withpytest.warns(galpyWarning) asrecord:
9749
+
o=Orbit(vxvv)
9750
+
raisedWarning=False
9751
+
forrecinrecord:
9752
+
# check that the message matches
9753
+
raisedWarning+= (
9754
+
str(rec.message.args[0])
9755
+
=="Supplied SkyCoord does not contain (galcen_distance) and this was not explicitly set in the Orbit initialization using the keywords (ro); this is required for Orbit initialization; proceeding with default value"
9756
+
)
9757
+
assertraisedWarning, (
9758
+
"Orbit initialization without galcen_distance should have thrown a warning, but didn't"
9759
+
)
9760
+
# Just missing z_sun
9761
+
vxvv=SkyCoord(
9762
+
ra=1*u.deg,
9763
+
dec=1*u.deg,
9764
+
distance=20.8*u.pc,
9765
+
pm_ra_cosdec=0.0*u.mas/u.yr,
9766
+
pm_dec=0.0*u.mas/u.yr,
9767
+
radial_velocity=0.0*u.km/u.s,
9768
+
galcen_distance=8.3*u.kpc,
9769
+
# z_sun=0.025 * u.kpc,
9770
+
galcen_v_sun=[-11.1, 220.0, 7.25] *u.km/u.s,
9771
+
)
9772
+
withpytest.warns(galpyWarning) asrecord:
9773
+
o=Orbit(vxvv)
9774
+
raisedWarning=False
9775
+
forrecinrecord:
9776
+
# check that the message matches
9777
+
raisedWarning+= (
9778
+
str(rec.message.args[0])
9779
+
=="Supplied SkyCoord does not contain (z_sun) and this was not explicitly set in the Orbit initialization using the keywords (zo); this is required for Orbit initialization; proceeding with default value"
9780
+
)
9781
+
assertraisedWarning, (
9782
+
"Orbit initialization without z_sun should have thrown a warning, but didn't"
9783
+
)
9784
+
# Just missing galcen_v_sun
9785
+
vxvv=SkyCoord(
9786
+
ra=1*u.deg,
9787
+
dec=1*u.deg,
9788
+
distance=20.8*u.pc,
9789
+
pm_ra_cosdec=0.0*u.mas/u.yr,
9790
+
pm_dec=0.0*u.mas/u.yr,
9791
+
radial_velocity=0.0*u.km/u.s,
9792
+
galcen_distance=8.3*u.kpc,
9793
+
z_sun=0.025*u.kpc,
9794
+
# galcen_v_sun=[-11.1, 220.0, 7.25] * u.km / u.s,
9795
+
)
9796
+
withpytest.warns(galpyWarning) asrecord:
9797
+
o=Orbit(vxvv)
9798
+
raisedWarning=False
9799
+
forrecinrecord:
9800
+
# check that the message matches
9801
+
raisedWarning+= (
9802
+
str(rec.message.args[0])
9803
+
=="Supplied SkyCoord does not contain (galcen_v_sun) and this was not explicitly set in the Orbit initialization using the keywords (vo, solarmotion); this is required for Orbit initialization; proceeding with default value"
9804
+
)
9805
+
assertraisedWarning, (
9806
+
"Orbit initialization without galcen_v_sun should have thrown a warning, but didn't"
9807
+
)
9808
+
# Missing galcen_distance and z_sun
9809
+
vxvv=SkyCoord(
9810
+
ra=1*u.deg,
9811
+
dec=1*u.deg,
9812
+
distance=20.8*u.pc,
9813
+
pm_ra_cosdec=0.0*u.mas/u.yr,
9814
+
pm_dec=0.0*u.mas/u.yr,
9815
+
radial_velocity=0.0*u.km/u.s,
9816
+
# galcen_distance=8.3 * u.kpc,
9817
+
# z_sun=0.025 * u.kpc,
9818
+
galcen_v_sun=[-11.1, 220.0, 7.25] *u.km/u.s,
9819
+
)
9820
+
withpytest.warns(galpyWarning) asrecord:
9821
+
o=Orbit(vxvv)
9822
+
raisedWarning=False
9823
+
forrecinrecord:
9824
+
# check that the message matches
9825
+
raisedWarning+= (
9826
+
str(rec.message.args[0])
9827
+
=="Supplied SkyCoord does not contain (galcen_distance, z_sun) and these were not explicitly set in the Orbit initialization using the keywords (ro, zo); these are required for Orbit initialization; proceeding with default values"
9828
+
)
9829
+
assertraisedWarning, (
9830
+
"Orbit initialization without galcen_distance and z_sun should have thrown a warning, but didn't"
9831
+
)
9832
+
# Missing galcen_distance and galcen_v_sun
9833
+
vxvv=SkyCoord(
9834
+
ra=1*u.deg,
9835
+
dec=1*u.deg,
9836
+
distance=20.8*u.pc,
9837
+
pm_ra_cosdec=0.0*u.mas/u.yr,
9838
+
pm_dec=0.0*u.mas/u.yr,
9839
+
radial_velocity=0.0*u.km/u.s,
9840
+
# galcen_distance=8.3 * u.kpc,
9841
+
z_sun=0.025*u.kpc,
9842
+
# galcen_v_sun=[-11.1, 220.0, 7.25] * u.km / u.s,
9843
+
)
9844
+
withpytest.warns(galpyWarning) asrecord:
9845
+
o=Orbit(vxvv)
9846
+
raisedWarning=False
9847
+
forrecinrecord:
9848
+
# check that the message matches
9849
+
raisedWarning+= (
9850
+
str(rec.message.args[0])
9851
+
=="Supplied SkyCoord does not contain (galcen_distance, galcen_v_sun) and these were not explicitly set in the Orbit initialization using the keywords (ro, vo, solarmotion); these are required for Orbit initialization; proceeding with default values"
9852
+
)
9853
+
assertraisedWarning, (
9854
+
"Orbit initialization without galcen_distance and galcen_v_sun should have thrown a warning, but didn't"
9855
+
)
9856
+
# Missing z_sun and galcen_v_sun
9857
+
vxvv=SkyCoord(
9858
+
ra=1*u.deg,
9859
+
dec=1*u.deg,
9860
+
distance=20.8*u.pc,
9861
+
pm_ra_cosdec=0.0*u.mas/u.yr,
9862
+
pm_dec=0.0*u.mas/u.yr,
9863
+
radial_velocity=0.0*u.km/u.s,
9864
+
galcen_distance=8.3*u.kpc,
9865
+
# z_sun=0.025 * u.kpc,
9866
+
# galcen_v_sun=[-11.1, 220.0, 7.25] * u.km / u.s,
9867
+
)
9868
+
withpytest.warns(galpyWarning) asrecord:
9869
+
o=Orbit(vxvv)
9870
+
raisedWarning=False
9871
+
forrecinrecord:
9872
+
# check that the message matches
9873
+
raisedWarning+= (
9874
+
str(rec.message.args[0])
9875
+
=="Supplied SkyCoord does not contain (z_sun, galcen_v_sun) and these were not explicitly set in the Orbit initialization using the keywords (zo, vo, solarmotion); these are required for Orbit initialization; proceeding with default values"
9876
+
)
9877
+
assertraisedWarning, (
9878
+
"Orbit initialization without z_sun and galcen_v_sun should have thrown a warning, but didn't"
=="Supplied SkyCoord does not contain (galcen_distance, z_sun, galcen_v_sun) and these were not explicitly set in the Orbit initialization using the keywords (ro, zo, vo, solarmotion); these are required for Orbit initialization; proceeding with default values"
9900
+
)
9901
+
assertraisedWarning, (
9902
+
"Orbit initialization without galcen_distance, z_sun, and galcen_v_sun should have thrown a warning, but didn't"
0 commit comments