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

Copy FITS file HDUs and data

I am trying to update a FITS file with a new column of data. My file has a Primary HDU, and two other HDUs, each one including a table. Since adding a new column to the table of an already existing FITS file is a pain (unsolvable, see here and…
Py-ser
  • 1,475
  • 6
  • 24
  • 46
0
votes
1 answer

Condtionally selecting values from a Numpy array returned from PyFITS

I have opened a FITS file in pyfits. The HEADER file reads XTENSION='BINTABLE' with DIMENSION= 52989R x 36C with 36 column tags like, 'ZBEST', 'ZQUALITY', 'M_B', 'UB', 'PGAL' etc. Now, I have to choose objects from the data with 'ZQUALITY' greater…
Chicku
  • 1
  • 2
  • 2
0
votes
1 answer

Read FITS binary table one row at a time using pyfits

I have a 60GB FITS file containing a binary table. I would like to read (and process) this table one row/entry/line/block* at a time. (*I'm unsure of the correct nomenclature) I am using pyfits and what I would like to do boils down to…
alexabate
  • 143
  • 2
  • 10
0
votes
1 answer

How does one update a FITS data array with PyFITS?

I'm trying to create a new FITS file out of two older ones using PyFITS. import pyfits from sys import stdout from sys import argv import time file1 = argv[1] file2 = argv[2] hdu1 = pyfits.open(file1) hdu2 = pyfits.open(file2) new0 = hdu1[0] new1…
Adam Smith
  • 20
  • 3
0
votes
1 answer

fitting an image with 2D equation in python

I have an image and I want to fit it to 2D equation in order to extract nx and ny parameters. First I defined 2D function and residuals from fit then I read the image file and then I tried to fit it using leastsq method, this is my code: …
user3395817
  • 23
  • 1
  • 6
0
votes
0 answers

Saving FITS images for use in Maxim DL

I am using pyfits to open, edit, and save fits images. The saved images will not open into Maxim DL, but they will open into SAO DS9. So my question is, is there some formatting change the the images are undergoing when i open, and save them and if…
user3282375
  • 95
  • 1
  • 1
  • 7
0
votes
1 answer

Cannot read raw data from a fits file using PyFITS

I'm trying to open a .fits file and read data from it using the pyFITS module for Python 2.7. Below is the code snippet which I'm running to try to attain the data from the file: location = raw_input("Locaiton of FITS file: ") """user input…
manan
  • 1,290
  • 12
  • 23
0
votes
2 answers

pyfits not working for windows 64 bit

I am using windows 7 home basic 64 bit. I wanted to work with FITS file in python 3.3 so downloaded pyfits and numpy for 64 bit. When I import pyfits I get the following error: Traceback (most recent call last): File "", line 1, in import…
Srivatsan
  • 7,913
  • 6
  • 45
  • 76
0
votes
1 answer

Making a 3 Colour FITS file using aplpy

I am trying to make a three colour FITS image using the $aplpy.make_rgb_image$ function. I use three separate FITS images in RGB to do so and am able to save a colour image in png, jpeg.... formats, but I would prefer to save its as a FITS file.…
firefly
  • 673
  • 2
  • 9
  • 17
0
votes
1 answer

PyFITS installation error python version 3.3 is needed, which was not found in registry

When I try to install PyFITS I get the following error python version 3.3 is needed, which was not found in registry But I do have python 3.3 installed as well as numpy and Scipy. I would appreciate any help sorting this out. Thanks OS---Windows 7…
Stripers247
  • 2,055
  • 10
  • 34
  • 40
0
votes
2 answers

writing a range output lists into a text file or four array

I have a function and its output is a selection of lists [a,b,c,d] [a,b,c,d] [a,b,c,d] [a,b,c,d] and I want [a,a,a,a] [b,b,b,b] [c,c,c,c] [d,d,d,d] def meanarr(image, res=None): "construct code which runs over a single ccd to get the means" …
astrochris
  • 1,546
  • 5
  • 18
  • 35
0
votes
2 answers

Combining values and putting them in an array

I have multiple input files from which I produce mean values. I want to combine these mean values into a single array with them all in. Here is my code, #! /usr/bin/env python #peice of code to find the information from a star catalog for the…
astrochris
  • 1,546
  • 5
  • 18
  • 35
-1
votes
1 answer

Is something wrong with my fits file?

I am currently trying to display this fits image, but I keep running into different errors. At first it couldn't print the non-ASCII characters in the header so I went ahead and deleted them (they seemed like just blank spaces in the header, it…
-1
votes
1 answer

Pyfits reordering axis

I am having a problem, with python, pyfits and numpy. I am opening a fits file with the usual file = pyfits.open('file.fits', memap = True) when calling file.info() It shows me, that the dataset contained has the shape (2,1024,1024,546): No. …
HenrikWolf
  • 21
  • 4
-1
votes
1 answer

Copy header into new file astropy

I have this script that makes a file with multiple extensions, but I would like to add headers from the old files to the extensions. new_hdul = fits.HDUList() new_hdul.append(fits.PrimaryHDU(header=headermain)) new_hdul.append(fits.ImageHDU(nod1,…
Coolcrab
  • 2,287
  • 9
  • 31
  • 51