Questions tagged [fits]

FITS is an image data file format used commonly for astronomical data.

FITS is an image data file format used commonly for astronomical data. It supports metadata for many photometric and calibration information.

See also: http://en.wikipedia.org/wiki/FITS

Please use publicly available data from MAST, or link to files in a GitHub repo, so code examples are easily reproducible.

338 questions
2
votes
0 answers

astropy.io.fits does not work properly under Python 3

I have this code: from astropy.io import fits filename = tkinter.filedialog.askopenfilename() file = fits.open(filename) When trying to run under Python 2.7, everything works fine. But under Python 3.4 there is this problem: WARNING: An exception…
Laszlowaty
  • 1,295
  • 2
  • 11
  • 19
2
votes
3 answers

IDL - Struct of Arrays to Array of Structs

From a FITS-Table I read data, and get a Struct containing the table, where each tag represents a column. Is there a way to reformat the Struct of Arrays to an Array of Structs? So that one Struct in the Array represents a Row? General solution…
Matty
  • 63
  • 1
  • 9
2
votes
1 answer

Giving labels to BinTableHDU data in astropy.io.fits

So I've been collating FITS table data into an HDUlist in astropy.io.fits. I would like to provide labels to the objects in the list such that they are easily distinguishable, and not just: No. Name Type Cards Dimensions Format 0…
George P
  • 69
  • 1
  • 1
  • 8
2
votes
3 answers

c++ reading fits file using ccfits

So... can anyone see what I'm doing wrong here?!? I'm trying to read a *.fits file in C++ using CCfits following their example at http://heasarc.gsfc.nasa.gov/fitsio/CCfits/html/readimage.html. #include #include #include…
razvanc
  • 930
  • 2
  • 11
  • 18
2
votes
1 answer

Adding a new column to a FITS file via python

I have created an array named distance that contains 1242 values. I want to add this array as the 11th column in an already existing FITS file that contains 10 columns. I am using pyfits. I tried pyfits.append(filename, distance) which showed no…
Srivatsan
  • 9,225
  • 13
  • 58
  • 83
2
votes
3 answers

Collapsing / Flattening a FITS data cube in python

I've looked all over the place and am not finding a solution to this issue. I feel like it should be fairly straightforward, but we'll see. I have a .FITS format data cube and I need to collapse it into a 2D FITS image. The data cube has two…
Teachey
  • 549
  • 7
  • 18
1
vote
0 answers

How to plot a FITS image with world coordinates of RA DEC on galactic coordinates

I use the following code to plot a fits image with ra dec wcs onto a galactic coordinate: import matplotlib.pyplot as plt from astropy.io import fits from astropy.wcs import WCS fig = plt.figure() path_galactic = "w40_c18o.fits" wcs_galactic =…
ming
  • 11
  • 2
1
vote
1 answer

WCS not appearing in generated FITS files

I am trying to generate a FITS file with random stars. For some reason, when I open the file in SAO DS9, the mouse-over doesn't display the on-sky coordinates, but instead only shows the pixel locations to which I am mousing over. Below I'm showing…
anakha272
  • 55
  • 2
  • 6
1
vote
0 answers

Check if FITS file has valid WCS

I am looking for a way to check if there is valid WCS data in the FITS file header or not. When creating a WCS from FITS file with no WCS inside (ds9 does not see any WCS for example) I surprisingly had no warnings or errors. from astropy import…
Viktor
  • 313
  • 2
  • 11
1
vote
0 answers

Is this a fits header problem or something to do with astropy?

I tried a simple example in astropy, like the one bellow: from astropy import wcs from astropy.io import fits # Load the FITS hdulist using astropy.io.fits hdulist = fits.open('abell.fits') # Parse the WCS keywords in the primary HDU w =…
Adrian
  • 177
  • 9
1
vote
1 answer

Is there a way to recover a .FITS file that got saved to .CSV extension?

I have accidentally saved a .fits file with a .csv extension and now can not open it. This is a very important data for us I wonder if there is anyway to recover it? Thank you so so much for your help! I've tried to change the extension back to…
Vanimiaou
  • 11
  • 2
1
vote
1 answer

Handling WCS error appeared with different fits file

I am handling two fits file (the header in the following), EXEMPLE case where it does work and the Orion case where it does not work. The few lines necessary to read and handle the fits. from astropy.io import fits from astropy.wcs import WCS hdul…
Raizen
  • 99
  • 2
  • 10
1
vote
1 answer

What does 'ZScaleInterval()' do in AstroPy?

I have looked at the documentation but I didn't find what I was looking for. All the explanations I could find on the web states that this is used to improve contrasts in images. Look at this code for example(that is made to run on an astronomical…
1
vote
0 answers

Can't convert FITS data (FITS_rec type) to multidimensional numpy array

I am attempting to read in a FITS file and convert the data into a multidimensional numpy array (So i can easily index the data). The FITS data is structured like: FITS_rec([(time, [rate, rate, rate, rate], [ERROR, ERROR, ERROR, ERROR], TOTCOUNTS,…
1
vote
1 answer

How to resize a column in a astropy.io.fits BinTableHDU

I'm attempting to resize a column in a FITS BinTableHDU column after it has been created, but I can't seem to find a way to do this in the astropy documentation. For example, suppose a simple fits file was created with a BinTableHDU containing a…
spacemanjosh
  • 641
  • 1
  • 5
  • 14