Questions tagged [pyfits]

PyFITS provides an interface to FITS formatted files in the Python scripting language.

Note: PyFITS has been superseded by Astropy via the astropy.io.fits package. Please only the tag for questions that involve directly using older versions of PyFITS, as opposed to Astropy (in which case the tag should be used).

PyFITS provides an interface to FITS formatted files in the Python scripting language. It is useful both for interactive data analysis and for writing analysis scripts in Python using FITS files as either input or output. PyFITS was a development project of the Science Software Branch at the Space Telescope Science Institute.

86 questions
0
votes
1 answer

Copying fits-file data and/or header into a new fits-file

Similar question was asked before, but asked in an ambigous way and using a different code. My problem: I want to make an exact copy of a .fits-file header into a new file. (I need to process a fits file in way, that I change the data, keep the…
NeStack
  • 719
  • 6
  • 20
0
votes
1 answer

Accessing a .fits file and plotting its columns

I'm trying to access a .fits file and plotting two columns (out of many!). I used pyfits to access the file, and plt.plotfile('3XMM_DR5.fits', delimiter=' ', cols=(0, 1), names=('x-axis','y-axis')) but that's not working. Are there any…
Diana
  • 1
  • 1
0
votes
1 answer

Write pixel data to FITS file Cfitsio

I am trying to write and fill the image with pixel data to new fits file using cfitsio. I am not sure where I am doing wrong but all of the data are not being written to the fits file. I used binary vi to check out the data and image data is not…
pseudo
  • 365
  • 2
  • 16
0
votes
2 answers

How to Use Data From a FITS File Directly (Not converting it to a text file)

I have a bunch of values written in a FITS file. There's like 320,000 points in each column... The columns that I need are 3 columns called, detx, dety, and energy. I need to use this data for my program. I know how to convert this FITS file into…
0
votes
1 answer

Lost information when converting from fits rec to ndaray

I loaded a fits file and converted the fitsrec data in a numpy ndarray: import pyfits import os, numpy as np dataPath ='irac1_dataset.fits' hduTab=pyfits.open(dataPath) data_rec =…
Giuseppe Angora
  • 740
  • 1
  • 9
  • 23
0
votes
1 answer

pyfits and mayvi installed package in astroconda but not visible by spyder

I have installed astroconda. After activating astroconda by command source activate astroconda I typed spyder. Then in Spyder I imported some package import pyfits and from mayavi import mlab I see this error: Traceback (most recent call last): …
Ellla
  • 41
  • 3
0
votes
2 answers

Open/edit utf8 fits header in python (pyfits)

I have to deal with some fits files which contain utf8 text in their header. This means basically all functions of the pyfits package do not work. Also .decode does not work as the fits header is a class not a list. Does someone know how to decode…
brium-brium
  • 487
  • 1
  • 5
  • 15
0
votes
1 answer

Resizing NVSS FITS format file in Python and operating on this file in astropy

this questions is probably mainly for more or less advances astronomers. Do you know how to transform NVSS fits file to the fits with only 2 (NOT 4!) axes? Or how to deal with the file which has 4 axis and generates the following errors in Python…
Ela
  • 19
  • 1
0
votes
1 answer

Change projection of a fits image

This is my first question here, so I'll try to explain it well. I am working with some all-sky fits astronomical images, which are in galactic coordinates (in the AITOF projection). I would like to transform these fits images into RA,Dec…
Pere Munar
  • 51
  • 6
0
votes
1 answer

Save 2 fits files with 3 headers astropy or pyfits

I am trying to make a fits file with two images inside of it, and i want to give them both a header. There should also be a basic header for the both of them. What I have found until now is this, but I don't know how to add the headers properly.…
Coolcrab
  • 2,287
  • 9
  • 31
  • 51
0
votes
2 answers

Crop FITS data Cube image through PyFITS

I have looked to find a solution for my issue, but couldn't. I have a FITS data cube, and I need to crop it by PyFITS. When I do it by my script, finally I'll have a 2-D FITS image! The first dimension is energy, and the second and thirds are…
0
votes
2 answers

read many files and create animation-python

I wrote script which create animation (movie) from fits files. One file has size 2.8 MB and the no. of files is 9000. Here is code import numpy as np import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt import…
Franta Konopnik
  • 169
  • 1
  • 7
  • 19
0
votes
1 answer

Cannot read a large FITS file using Astropy.io.fits

I am currently attempting to read data from a large data FITS format data file using astropy.io.fits for Python 3.4. While I can successfully open the file using the memmapper mode, I cannot access the data within the file. Here is my code from…
Snyder005
  • 214
  • 2
  • 8
0
votes
1 answer

Superimpose on FITS image on another with PyWCSGrid2

I've got 2 .FITS images. One is an image of some stars and galaxies. The other is a significance map that I want to plot over it, as a contour. PyWCSGrid2 is the python module to do this in, but I've tried to overlay one on the other for a while and…
Astro_Dart
  • 175
  • 1
  • 1
  • 7
0
votes
1 answer

Append columns to table, while preserving header

I am trying to update a FITS table extension by appending some new columns to it. I am following the method given at http://pyfits.readthedocs.org/en/latest/users_guide/users_table.html#merging-tables. However, the header of the merged table…
TheBigH
  • 504
  • 3
  • 13