我只是說明如何使用numpy的索引與一些arbitary布爾口罩座標:
from astropy.coordinates import SkyCoord
import astropy.units as u
import numpy as np
phi = np.linspace(0,2*np.pi,20)
theta = np.linspace(0, np.pi, 20)
radecs = SkyCoord(ra=phi*u.rad, dec=(0.5*np.pi - theta)*u.rad)
radecs
給我radecs
:
<SkyCoord (ICRS): (ra, dec) in deg
[(0.0, 90.0), (18.94736842, 80.52631579), (37.89473684, 71.05263158),
(56.84210526, 61.57894737), (75.78947368, 52.10526316),
(94.73684211, 42.63157895), (113.68421053, 33.15789474),
(132.63157895, 23.68421053), (151.57894737, 14.21052632),
(170.52631579, 4.73684211), (189.47368421, -4.73684211),
(208.42105263, -14.21052632), (227.36842105, -23.68421053),
(246.31578947, -33.15789474), (265.26315789, -42.63157895),
(284.21052632, -52.10526316), (303.15789474, -61.57894737),
(322.10526316, -71.05263158), (341.05263158, -80.52631579),
(0.0, -90.0)]>
得到dec
(赤緯)你的radecs
你可以訪問的財產:
radecs.dec > - 10 * u.degree
,然後指標滿足這個面具的所有目標:
radecs2 = radecs[radecs.dec > - 10 * u.degree]
給我下面radecs2
radecs.dec
[90, 80.526316, 71.052632, 61.578947, 52.105263, 42.631579, 33.157895, 23.684211, 14.210526, 4.7368421, −4.7368421, −14.210526, −23.684211, −33.157895, −42.631579, −52.105263, −61.578947, −71.052632, −80.526316, −90]
,所以我們可以通過創建一個面具與偏角訪問上述-10
度所有目標:
<SkyCoord (ICRS): (ra, dec) in deg
[(0.0, 90.0), (18.94736842, 80.52631579), (37.89473684, 71.05263158),
(56.84210526, 61.57894737), (75.78947368, 52.10526316),
(94.73684211, 42.63157895), (113.68421053, 33.15789474),
(132.63157895, 23.68421053), (151.57894737, 14.21052632),
(170.52631579, 4.73684211), (189.47368421, -4.73684211)]>
基本上你所做的是最後一步(radecs2 = radecs[radecs.dec > - 10 * u.degree]
),所有其他步驟只是解釋性的。
非常感謝@ MSeifert,我知道這很簡單,但我不確定Ra座標是否會帶着「蒙面」的赤緯座標。 – Dean
這是否也適用於astropy.Table?我在這張表中爲Ra&Dec增加了第三個值,這是明星的明顯量級。我意識到,當我嘗試新的「radecs2」座標列表時,這個列表的長度比我在表格中的對應的列表的長度短,所以掩碼不會轉置到我的第三列。 – Dean
@Dean:這是一個不同的問題。請打開另一個問題,說明您如何創建該表以及您想要執行的操作。 :) – MSeifert