Home > matutils > fitsget.m

fitsget

PURPOSE ^

[x_tic,y_tic,data,key]=fitsget(filename)

SYNOPSIS ^

function [x_tic,y_tic,data,key]=fitsget(filename)

DESCRIPTION ^

 [x_tic,y_tic,data,key]=fitsget(filename)

 Get a fits image with axis information

 Uses fitsread function in Matlab 6.1
 (fitsread I got off net previously is broken in 6.1.)

 eg: [x,y,img]=fitsget('dmap');
     imagesc(x,y,img); skyplot;

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [x_tic,y_tic,data,key]=fitsget(filename)
0002 % [x_tic,y_tic,data,key]=fitsget(filename)
0003 %
0004 % Get a fits image with axis information
0005 %
0006 % Uses fitsread function in Matlab 6.1
0007 % (fitsread I got off net previously is broken in 6.1.)
0008 %
0009 % eg: [x,y,img]=fitsget('dmap');
0010 %     imagesc(x,y,img); skyplot;
0011 
0012 dat=fitsinfo(filename);
0013 
0014 n=find(strcmp(dat.PrimaryData.Keywords(:,1),'CDELT1'));
0015 delx=dat.PrimaryData.Keywords{n,2};
0016 n=find(strcmp(dat.PrimaryData.Keywords(:,1),'CDELT2'));
0017 dely=dat.PrimaryData.Keywords{n,2};
0018 
0019 n=find(strcmp(dat.PrimaryData.Keywords(:,1),'CRPIX1'));
0020 refx=dat.PrimaryData.Keywords{n,2};
0021 n=find(strcmp(dat.PrimaryData.Keywords(:,1),'CRPIX2'));
0022 refy=dat.PrimaryData.Keywords{n,2};
0023 
0024 n=find(strcmp(dat.PrimaryData.Keywords(:,1),'CRVAL1'));
0025 valx=dat.PrimaryData.Keywords{n,2};
0026 n=find(strcmp(dat.PrimaryData.Keywords(:,1),'CRVAL2'));
0027 valy=dat.PrimaryData.Keywords{n,2};
0028 
0029 data=fitsread(filename);
0030 
0031 xsiz=size(data,2);
0032 ysiz=size(data,1);
0033 
0034 x_tic=(1:xsiz)-refx;
0035 y_tic=(1:ysiz)-refy;
0036 x_tic=x_tic*delx+valx;
0037 y_tic=y_tic*dely+valy;
0038 
0039 key=dat.PrimaryData.Keywords;
0040 
0041 return

Generated on Sun 14-Jun-2015 17:12:45 by m2html © 2005