人生的意义就是思考其意义分享 http://blog.sciencenet.cn/u/qianlivan 天体物理工作者,家乡云南昆明。

博文

FITS文件的旋转问题

已有 3335 次阅读 2013-8-6 15:07 |个人分类:总结|系统分类:科研笔记| 文件, 旋转, FITS

     之前讨论过FITS文件的投影问题(http://blog.sciencenet.cn/blog-117333-604768.html),这是处理天文观测数据时常见的问题。除了投影,还有一个重要的问题,就是旋转。在观测的时候,探测器的竖直边并不一定总是保持在南北方向,有时会与南北方向有一定夹角,这个时候得到的数据除了有投影的问题,还有旋转的问题。
      在没有投影的情况下,旋转的问题是简单的(http://blog.sciencenet.cn/home.php?mod=space&uid=117333&do=blog&id=258897),因为球面上的旋转是非常明确的,有明确的表达式可以计算。于是,在有投影的情况下,通常需要先将投影过的数据去投影(变换为球面上的数据),在球面上进行旋转,然后再进行投影,这样就可以得到竖直边为南北方向的投影数据。

基本程序如下:

theta=90.0-dec_p
phi=ra_p

tempx=sin(theta*convert)*cos(phi*convert)
tempy=sin(theta*convert)*sin(phi*convert)
tempz=cos(theta*convert)
vect=[tempx,tempy,tempz]
vect=transpose(vect)

theta0=90.0-crvaly
phi0=crvalx

matrix1=[[cos((90.0-phi0)*convert),-sin((90.0-phi0)*convert),0],$
        [sin((90.0-phi0)*convert),cos((90.0-phi0)*convert),0],$
        [0,0,1]]
matrix1t=transpose(matrix1)
matrix2=[[1,0,0],$
        [0,cos(theta0*convert),-sin(theta0*convert)],$
        [0,sin(theta0*convert),cos(theta0*convert)]]
matrix2t=transpose(matrix2)
matrix3=[[cos((-crotay24)*convert),-sin((-crotay24)*convert),0],$
        [sin((-crotay24)*convert),cos((-crotay24)*convert),0],$
        [0,0,1]]
vect_f=matrix1t##matrix2t##matrix3##matrix2##matrix1##vect

tempx=vect_f(0)
tempy=vect_f(1)
tempz=vect_f(2)
if (abs(tempx) lt 1.0e-8) then begin
 if (tempy ge 0.0) then tempra=!pi/2.0
 if (tempy lt 0.0) then tempra=3.0*!pi/2.0
endif else begin
 if (tempy gt 0.0) then begin
   if (tempx gt 0.0) then begin
     tempra=atan(tempy/tempx)
   endif else begin
     tempra=atan(tempy/tempx)+!pi
   endelse
 endif else begin
   if (tempx gt 0.0) then begin
     tempra=atan(tempy/tempx)+2.0*!pi
   endif else begin
     tempra=atan(tempy/tempx)+!pi
   endelse
 endelse
endelse


tempdec=asin(tempz)

ra=tempra/convert
dec=tempdec/convert



https://blog.sciencenet.cn/blog-117333-714614.html

上一篇:三通道伪彩色图
下一篇:【5000A】(一)查错
收藏 IP: 159.226.169.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...
扫一扫,分享此博文

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-9-27 09:33

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部