SkyCoord.separation 更快的替代方案?
我正在使用 SkyCoord.separation 从数组中查找给定坐标周围的像素。我注意到分离功能花费的时间太长。我必须在一个巨大的数据集上重复计算,并且使用这个函数似乎不太实用。是否有比处理数组的 SkyCoord.separation 更快的替代方案?其他类似的函数似乎不接受数组输入,只能计算两组坐标之间的间隔。
例如: 我有经度和纬度数组(大小 50,331,648)。我需要找到每一行与数组其余部分的分离。所以我循环运行了 50,331,648 次。
任何建议都会有很大帮助! 谢谢
更新: 现在使用笛卡尔坐标和点积来计算角度。速度快了大约 7 倍。
I am using SkyCoord.separation to find the pixels around a given coordinate from an array. I have noticed the separation function takes too long. I have to repeat the calculation on a huge data set and using this function does not seem practical. Is there a faster alternative to SkyCoord.separation which handles arrays? The other similar functions do not seem to take array inputs and can only calculate separation between two sets of coordinates.
For example:
I have longitude and latitude arrays (size 50,331,648). I need to find the separation of each row with the rest of the array. So I run a loop 50,331,648 times.
Any suggestions would be of great help!
Thank you
update:
Using cartesian coordinates and dot product for the angle now. It is around 7 times faster.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个相当快的实现,它使用 numexpr 来提高速度。您也可以使用普通的 numpy 来完成此操作,但速度没有那么快。
Here is a pretty fast implementation that uses
numexpr
for extra speed. You can also do this with plain numpy but it isn't as fast.