问题标签 [astropy]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
1030 浏览

astronomy - Getting latitude and longitude of the Sun on a world map with PyEphem

I'm trying to determine the latitude and longitude of say the Sun, the Moon and Mars. I need the result relative to the Earth's equator and the Prime Meridian in order to produce a result similar to this map.

I believe that's also what the author of this question wanted, however the answer there doesn't add up for me (comparing with values from the first link).

Expected result, obtained from the page linked to earlier:

On Thursday, 1 January 2015, 00:00:00 UTC the Sun is at its zenith at Latitude: 23° 02' South, Longitude: 179° 29' West

So the latitude/declination seems about right, but no 180° wraparound will fix that right ascension, probably because it starts at the Vernal Equinox.

I have also unsuccessfully tried to use an observer at 0,0.

Can this be done using PyEphem, Skyfield or astropy? It seems odd that artificial satellites in PyEphem have the convenient sublat and sublong attributes, but it's so hard for celestial bodies.

0 投票
1 回答
188 浏览

python - 宇宙学天文学中的距离是否包含因子 h?

我正在使用 astropy cosmology 包,想知道是否使用方法返回的单位,例如 comoving_distance 或 kpc_comoving_per_arcmin 以 h^-1 Mpc 和 h^-1 kpc 或直接 Mpc 和 kpc 返回?

0 投票
1 回答
785 浏览

python - 使用python将fits文件中的低信号像素归零

我正在尝试编写一个简单的脚本,该脚本将读取适合的图像文件,将低于某个阈值(我将根据背景统计数据输入)的所有像素设置为零或 nan。我在下面包含了我正在使用的代码。这将写入一个类似于原始文件的新拟合文件,但像素值似乎被重新缩放(即,我希望新文件中的最小值是我指定的最小值,但事实并非如此)。我认为这是我如何将标题写入新文件的问题,但不知道如何修复它,并且欢迎任何做过类似事情的天文学家的建议或片段。谢谢!

0 投票
0 回答
458 浏览

python - Python:使用 pyinstaller 编译 astropy

目前我正在尝试使用 pyinstaller 编译一个 python 应用程序进行分发。不幸的是,编译后的版本没有运行,似乎是因为 astropy 的依赖项之一:六个。Astropy 在启动时遇到导入错误,尽管我什至尝试在应用程序的规范文件中将六个添加到“隐藏导入”中。然而奇怪的是,在编译过程中,pyinstaller 注意到我的隐藏导入“六”已经被发现(这也是唯一一次提到六),但在构建后它仍然没有出现在我的 distr 目录中。

这是一个已知的错误?我找不到任何与使用 astropy/six 和 pyinstaller 相关的信息。或者有没有更好的解决方案?

0 投票
0 回答
820 浏览

python - Astroquery python:使用对象列表查询 NED

我从 VizieR 目录中提取了 Simbad 名称列表,并希望从 NED 的直径表中找到对象的轴比。代码如下。

simNames 中的第四个对象没有直径表,因此会产生错误:

所以我尝试了:

产生:

所以很明显来自 core.py 的 RemoteServiceError 是无法识别的。处理此问题的最佳方法是什么,或者是否有更好的方法来使用对象列表查询 NED?

0 投票
1 回答
801 浏览

python - 使用 PyWCSGrid2 将 FITS 图像叠加到另一个图像上

我有 2 个 .FITS 图像。一个是一些恒星和星系的图像。另一个是我想在它上面绘制的重要性图,作为轮廓。PyWCSGrid2 是执行此操作的 python 模块,但我尝试将一个叠加在另一个上一段时间,但我无法让它们同时显示。任何想法为什么这不起作用?

更新:问题似乎是这两个图像具有不同的比例,所以它实际上是在绘制轮廓,但它们很小并且在左下角。我需要以某种方式重新调整它们。

0 投票
1 回答
810 浏览

python - 在 Astropy 中使用 FITS 文件进行表连接操作

这个是专门为天文界设计的。

我有两个 .fit 格式的表,其中两个表都可能包含一个共同的列/标题(即“SDSS 标识符”)。现在,我想连接这些表,以便它生成一个新表,其中仅包含在两个表中找到的对象。这样,任何仅在一个表中的对象都将被丢弃。

我已经阅读了关于 table join astropy operations tutorials 的文档,但我想知道是否支持 .fit 文件(或者我是否需要 HDU 拟合、csv 或 ascii 等)以及某些不匹配的对象是否包含在最终合并表。

如果有人能就如何实现这一目标向我提出建议,那就太好了。

0 投票
1 回答
338 浏览

astropy - 如何使用 Astropy ascii 表格阅读器跳过行尾注释?

我想将包含行尾注释的 ascii 文件读入 Astropy 表。像这样的东西:

如此处所示,不符合我的要求:

我必须传递哪些选项才能完成Table.read这项工作?

0 投票
1 回答
578 浏览

python - 如何将 3d 天文表写入文件

我有一个 3d 天文表,我想将其写入文件。我通过将 3d numpy 数组转换为 astropy 表并添加一些列名来创建它。

这是我的表的示例输出。每行每列中的数组表示第三维。

我将 2d astropy 表写入文件的方式是

但是当我尝试将 3d astropy 表写入文件时,我收到错误:

关键是能够通过另一个模块读取文件并检索 astropy 表。

0 投票
0 回答
138 浏览

python - astropy.io.fits 在 Python 3 下无法正常工作

我有这个代码:

尝试在 Python 2.7 下运行时,一切正常。但是在 Python 3.4 下存在这个问题:

在此警告之后,我无法对我的文件执行操作。任何想法如何处理这个问题?