I'm trying to write a script that not only reads in FITS files, but will then print and save the data to a table. So far my code does not seem to have a problem reading the files; printing them seems to be the issue. This is my code so far (when I run this I get the error message "no valid lines found for this format":
;Planck File read (used to read in and print individual fits files)
pro planck_file_read
readcol,'COM_PCCS_857_R1.20.fits',name,glon,glat,ra,dec,detflux,detflux_err,aperflux,aperflux_err,psfflux,psfflux_err,gauflux,gauflux_err,gau_semi1,gau_semi1_err,gau_semi2,gau_semi2_err,gau_theta,gau_theta_err,gau_fwhm_eff,extended,cirrus_n,ext_val,ercsc
openw,lun,'fits_857.tbl',/get_lun,width=400
printf,lun,'; ; name GLON GLAT RA DEC DETFLUX DETFLUXERR APERFLUX APERFLUXERR PSFFLUX PSFFLUXERR GAUFLUX GAUFLUXERR GAUSEMI1 GAUSEMI1ERR GAUSEMI2 GAUSEMI2ERR GAUTHETA GAUTHETAERR GAUFWHMEFF EXTENDED CIRRUSN EXTVAL ERCSC
printf,lun,'; ; DEG DEG DEG DEG MJY MJY MJY MJY MJY MJY MJY MJY ARCMIN ARCMIN ARCMIN ARCMIN DEG DEG ARCMIN NONE NONE NONE NONE
for i=0,n_elements(fits_name)-1 do printf,lun,name[i],glon[i],glat[i],ra[i],dec[i],detflux[i],detflux_err[i],aperflux[i],aperflux_err[i],psfflux[i],psfflux_err[i],gauflux[i],gauflux_err[i],gau_semi1[i],gau_semi1_err[i],gau_semi2[i],gau_semi2_err[i],gau_theta[i],gau_theta_err[i],gau_fwhm_eff[i],extended[i],cirrus_n[i],ext_val[i],ercsc[i]
free_lun,lun
end
That error message is coming from
READCOL
.READCOL
is designed to read ASCII files, not FITS files. Use FITS routines likeFITS_OPEN
,FITS_READ
, andFITS_CLOSE
to read the data.