- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我有一个适合格式的 Gamma 射线图(具有表面亮度的图像)以及阿拉丁转换器输出的 .hpx 格式。
我希望计算角功率谱。如何创建一个可读的文件healpy.anafast
?我的数据格式似乎错误 (TypeErrors
)。
我尝试过的 Gamma 射线图像之一是费米银河漫反射。文件是一个名为 gll_iem_v02_P6_V11_DIFFUSE.fit
的公共(public) LAT 银河漫反射贴图,位于:
http://fermi.gsfc.nasa.gov/ssc/data/access/lat/BackgroundModels.html
我在使用时粘贴了下面的代码,但它本质上是 astroml 上名为 plot_wmap_power_spectra
的脚本。 :
"""
WMAP power spectrum analysis with HealPy
----------------------------------------
This demonstrates how to plot and take a power spectrum of the WMAP data
using healpy, the python wrapper for healpix. Healpy is available for
download at the `github site <https://github.com/healpy/healpy>`_
"""
# Author: Jake VanderPlas <vanderplas@astro.washington.edu>
# License: BSD
# The figure is an example from astroML: see http://astroML.github.com
import numpy as np
from matplotlib import pyplot as plt
# warning: due to a bug in healpy, importing it before pylab can cause
# a segmentation fault in some circumstances.
import pylab
import healpy as hp
###
from astroML.datasets import fetch_wmap_temperatures
###
#------------------------------------------------------------
# Fetch the data
###
wmap_unmasked = fetch_wmap_temperatures(masked=False)
#PredictedSurfaceFluxFromModelMap = np.arange(hp.read_map('PredictedSurfaceFluxFromModelMap.hpx[1]'))
PredictedSurfaceFluxFromModelMap = hp.read_map('gll_iem_v02_p6_V11_DIFFUSE.fit',dtype=np.float,verbose=True)
#PredictedSurfaceFluxFromModelMap = hp.read_map('all.fits',dtype=np.float,verbose=True)
#cl_out = hp.read_cl('PredictedSurfaceFluxFromModelMap.hpx',dtype=np.float)#,verbose=True)
wmap_masked = fetch_wmap_temperatures(masked=True)
###
white_noise = np.ma.asarray(np.random.normal(0, 0.062, wmap_masked.shape))
len(cl_out)
#------------------------------------------------------------
# plot the unmasked map
fig = plt.figure(1)
#hp.mollview(wmap_unmasked, min=-1, max=1, title='Unmasked map',
# fig=1, unit=r'$\Delta$T (mK)')
########----------------
##hp.mollview(PredictedSurfaceFluxFromModelMap, min=-1, max=1, title='Unmasked map',
## fig=1, unit=r'$\Delta$T (mK)')
########----------------
#------------------------------------------------------------
# plot the masked map
# filled() fills the masked regions with a null value.
########----------------
#fig = plt.figure(2)
#hp.mollview(wmap_masked.filled(), title='Masked map',
# fig=2, unit=r'$\Delta$T (mK)')
########----------------
#------------------------------------------------------------
# compute and plot the power spectrum
########----------------
#cl = hp.anafast(wmap_masked.filled(), lmax=1024)
cl = hp.anafast(PredictedSurfaceFluxFromModelMap, lmax=1024)
#cl = cl_out
########----------------
ell = np.arange(len(cl))
cl_white = hp.anafast(white_noise, lmax=1024)
fig = plt.figure(3)
ax = fig.add_subplot(111)
ax.scatter(ell, ell * (ell + 1) * cl,
s=4, c='black', lw=0,
label='data')
ax.scatter(ell, ell * (ell + 1) * cl_white,
s=4, c='gray', lw=0,
label='white noise')
ax.set_xlabel(r'$\ell$')
ax.set_ylabel(r'$\ell(\ell+1)C_\ell$')
ax.set_title('Angular Power (not mask corrected)')
ax.legend(loc='upper right')
ax.grid()
ax.set_xlim(0, 1100)
plt.show()
最佳答案
I have uploaded your map also to Figshare ,将来可能会出现。
一旦您获得了 HEALPix 格式的 map ,就可以使用 healpy
轻松读取它:
import healpy as hp
m = hp.ma(hp.read_map("gll_iem_v02_p6_V11_DIFFUSE.hpx"))
掩码 NaN 像素:
m.mask = np.isnan(m)
绘制它:
hp.mollview(m, min=-1e-5, max=1e-5, xsize=2000)
title("gll_iem_v02_p6_V11_DIFFUSE")
计算并绘制角功率谱:
plt.loglog(hp.anafast(m))
另请参阅 IPython 笔记本:http://nbviewer.ipython.org/7553252
关于python - 在 Gamma 射线图上使用healpy.anafast,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20080176/
过去几天我一直在研究这个问题,但一直被困住。我需要能够触摸屏幕并返回模型上最接近与拾取点生成的射线相交的近平面的点的 x,y,z 坐标。我认为我的问题的一部分是我在模型的整个渲染代码中进行了一系列矩阵
我有一个由两点 A 和 B 以及半径 r 定义的胶囊。射线由等式定义:X = O + D*t。现在我需要获取所有 (0-2) 个交点的 t。 一种可能的解决方案是计算在 A 和 B 处与球体的交点以及
我看到了Fast Minimum Storage Ray/Triangle Intersection经常推荐 Moller 和 Trumbore 的作品。 问题是,我不介意预先计算和存储任何数量的数据
我知道如何计算光线平面交点,但如何测试交点是否在该平面上的正方形内?我正在测试该点是否在距正方形中心一定距离内,但我不确定这是否正确。 最佳答案 这是一种适用于任何凸多边形的方法:(请参阅答案末尾的方
我知道如何计算光线平面交点,但如何测试交点是否在该平面上的正方形内?我正在测试该点是否在距正方形中心一定距离内,但我不确定这是否正确。 最佳答案 这是一种适用于任何凸多边形的方法:(请参阅答案末尾的方
我想实现 Moller & Trumbore 算法,解释为 http://geomalgorithms.com/a06-_intersect-2.html 进入我的 openframeworks 项目
我正在测试射线是否与三角形相交。目前,我正在使用以下代码来测试三角形与从原点到三角形中点的射线之间是否存在交点: Ray *ray = new Ray(Vec3(0), chosenTriangle-
我们可以在 matplotlib 中使用 plt.axline() ( https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.axli
我的光线拾取代码有问题。我的代码 我正在使用此代码进行选择计算: /*----------------------------------------------------------- Funct
使用 ray 框架时,有一个选项可以选择此任务所需的 CPU 数量,如解释的那样 here . 例如: @ray.remote(num_cpus=4) def f(): return 1 然而
我正在尝试对 Meteor 使用 X 射线,但到目前为止还没有成功。 这是我正在测试的示例(它在基本 Node 应用程序上运行良好) import Xray from 'x-ray'; var xra
我正在我的游戏中编写 C++ 碰撞检测程序,并试图提出一种算法:我有一个由两个中心点(C1、C2)、长度和半径定义的胶囊。然后我有一条用两点(R1,R2)定义的射线。我已经知道它们相交了。我只需要找到
我目前正在研究 Path Tracer,我正在寻找优化光线-三角形相交的方法。我目前使用 Moller-Trumbore 算法的以下 sse4 实现: bool Ray::intersectTrian
我有一个基于 PPO 策略的模型,我使用 RLLib 在一些标准健身房环境中使用 Ray Tune API 进行训练(没有花哨的预处理)。我保存了模型检查点,我可以从中加载和恢复以进行进一步训练。 现
我目前在我的 lambda 中使用 postgresql-node import { Client } from 'pg' 我想使用 AWS X-ray 检测 Postgresql 库。 Nodejs
我正在尝试使用 X 射线来跟踪使用 SNS-SQS fanout pattern 的请求. 请求来自 API GW、lambda 代理集成、发布到 SNS 并传送到订阅的 SQS,该 SQS 具有接收
我需要使用以下输入/输出编写一个 python 函数或类 输入: X 射线源的位置(仍然不确定为什么需要它) 董事会的职位(仍然不确定为什么需要) 三维 CT 扫描 输出: 二维 X 射线扫描(模拟
我有一个 Flask 应用程序作为与 Zappa 一起部署的 AWS Lambda 函数运行,我想激活 X-Ray 以获取有关不同函数的更多信息。 使用 Zappa 激活 X-Ray 非常简单 - 只
我已将 X 射线检测添加到我的 lambda(Node.js) 中,并且可以在跟踪中看到它周围的所有服务,但仍然无法将调用它的 API 网关添加到跟踪和服务映射中。有什么办法吗? 最佳答案 几天前AW
我正在构建一个简单的 3D 模型来绘制 3D 长方体。在这个模型中,没有特殊的循环情况,例如 A 在 B 之前,C 在 A 之前,或者 A 的一部分在 B 之前,但 B 的一部分在 A 之前。 现在给
我是一名优秀的程序员,十分优秀!