我需要用python绘制一些SDSS图像.我从SDSS DR7下载了原始帧,并尝试使用WCS坐标投影显示(缩放)图像.

原始图像的北边在右边,东边在上面.根据DS9,对齐方式并不完美.

我想最终的图像是北上,左上.

我的尝试是这样的:

import numpy as np

import matplotlib.pyplot as plt

import astropy.visualization as vis

import astropy.units as un

from astropy.io import fits

from astropy.wcs import WCS

from astropy.nddata.utils import Cutout2D

def open_image(imagename):

hdu = fits.open(imagename)

image = hdu[0].data

header = hdu[0].header

wcs = WCS(header)

return image, header, wcs

def plot_image(imagename):

image, header, wcs = open_image(imagename) #loading image

print(wcs)

#selecting a region centered on the target

zoom = Cutout2D(image,(412,559),51*un.pixel, wcs = wcs, copy=True)

#setting axis format

fig,ax = plt.subplots(1,1, subplot_kw=dict(projection=zoom.wcs))

ra = ax.coords[0]

dec = ax.coords[1]

ra.set_major_formatter('hh:mm:ss.s')

dec.set_major_formatter('dd:mm:ss')

#setting image scale

interval = vis.PercentileInterval(99.9)

vmin,vmax = interval.get_limits(zoom.data)

norm = vis.ImageNormalize(vmin=vmin, vmax=vmax, stretch=vis.LogStretch(1000))

ax.imshow(zoom.data, cmap =plt.cm.Reds, norm = norm, origin = 'lower')

ax.set_ylabel('Dec.')

ax.set_xlabel('RA')

plt.show()

if __name__ == '__main__':

imagename = '../SDSS_g_orig.fits'

plot_image(imagename)

您可以在附件中找到结果.坐标轴上不存在.图像也保持其原始方向.我假设WCS投影会自动旋转图像以使其对齐,但是显然这是不正确的.

如何将图像与北上和左上对齐?

附言:这是print(wcs)行的输出:

Number of WCS axes: 2

CTYPE : 'RA---TAN' 'DEC--TAN'

CRVAL : 195.77014030000001 16.47383778

CRPIX : 1024.5 744.5

CD1_1 CD1_2 : 6.1883041204266702e-06 0.000109834787851833

CD2_1 CD2_2 : 0.000109820625 -6.2125672043002999e-06

NAXIS : 2048 1489

编辑:我尝试使用SkyView模块,但结果并不令人满意.图像的强度等值线(图像等值线是我的最终目标)不同,而天空视图图像恰好在目标中间显示出某种伪像.

python画图像_使用python绘制SDSS图像相关推荐

  1. python画图模块_学习python画图模块plotnine:第一步安装

    官网链接 https://plotnine.readthedocs.io/en/stable/index.html 知乎介绍的文章 https://zhuanlan.zhihu.com/p/47814 ...

  2. python画图模糊_使用python matplotlib 画图导入到word中如何保证分辨率

    在写论文时,如果是菜鸟级别,可能不会花太多时间去学latex,直接用word去写,但是这有一个问题,当我们用其他工具画完实验彩色图时,放到word中会有比较模糊,这有两个原因导致的. 原因一:图片导入 ...

  3. python画图包_「Python量化」股票分析入门

    目前,获取股票数据的渠道有很多,而且基本上是免费的,比如,行情软件有同花顺.东方财富等,门户网站有新浪财经.腾讯财经.和讯网等.Python也有不少免费的开源api可以获取交易行情数据,如pandas ...

  4. python画图猪_用Python的turtle画一只小猪乔治【刚学python两天,记念一下】

    import turtle as t ''' t.pu() 提起画笔 t.pd() 移动时绘制图形,缺省时也为绘制 t.seth 设置当前朝向为angle角度 t.begin_fill() 准备开始填 ...

  5. python 画图 平滑曲线_用Python平滑曲线

    我有两个数据点列表:list_x = [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 1 ...

  6. python 时间序列预测_使用Python进行动手时间序列预测

    python 时间序列预测 Time series analysis is the endeavor of extracting meaningful summary and statistical ...

  7. python 概率分布模型_使用python的概率模型进行公司估值

    python 概率分布模型 Note from Towards Data Science's editors: While we allow independent authors to publis ...

  8. python渐变色代码_使用python画图怎么设置渐变色

    Python中渐变的实现: 使用turtle库画一条渐变的蛇的代码:from turtle import * setup(500, 400, 200, 200) penup() fd(-250) pe ...

  9. 用python实现点阵屏_用Python代码来绘制彭罗斯点阵的教程

    这里是显示彭罗斯点阵的Python的脚本.是的,这是可以运行的有效Phython代码. 译注:彭罗斯点阵,物理学术语.上世纪70年代英国数学家彭罗斯第一次提出了这个概念,称为彭罗斯点阵(Pen-ros ...

  10. python画图代码七彩蟒蛇-Python实现七彩蟒蛇绘制实例代码

    本文主要研究的是Python编程turtle的实例,绘制一个七彩蟒蛇..具体如下. 第2周的课后练习里,有一道题目,要求修改"蟒蛇绘制"程序,对Python 蟒蛇的每个部分采用不同 ...

最新文章

  1. import static
  2. 团队-团队编程项目中国象棋-项目进度
  3. how is view embedded via component usage being initialized
  4. Ubuntu   root密码
  5. websocket协议中获取 http 请求字符串
  6. LOAM: Lidar Odometry and Mapping in Real-time
  7. mysql 排查问题一些小技巧
  8. wechart image标签
  9. 主曲率、平均曲率、高斯曲率、法曲率、主方向
  10. 学习记录:python快递价格计算器练习7.12
  11. 工商银行c语言笔试题,【中国工商银行研发软件笔试试题及答案】 - 面试网
  12. JDBC获取数据库(mysql)四种连接方式(connection)
  13. C语言,C++,C#发展的回顾与展望
  14. 深度Linux的安装
  15. pythonstdin_理解Python中的stdin stdout stderr - The Hard Way Is Easier
  16. 计算机的供电方式,电脑主板电源供电方式
  17. latex集合的包含_latex 集合相关符号:实数集,整数集,并,包含,真包含
  18. AndroidAPP用邮件收集用户上报日志
  19. python绝技运用python成为顶级pdf_python绝技:运用python成为顶级黑客 中文pdf完整版[42MB]...
  20. QWebView到QWebEngineView

热门文章

  1. 计算机操作者权限恢复,win10系统提示“需要管理员权限”的还原方案
  2. 深入理解Flash Player的安全域(Security Domains)
  3. GitLab 如何删除 Forked from
  4. WebView网页打不开原因之一(及自己遇到的一些WebView问题记录)
  5. #define 喵 int_【吃鸡大作战第三季】第12集 告白小雪喵
  6. tfs php,TFS的原理及应用
  7. SAP BAPI_EXCHANGERATE_GETDETAIL 读取货币汇率
  8. 随机子空间(RSM)
  9. 前端 网络三剑客之html 02
  10. 最保险的“跳槽理由”