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
3
votes
1 answer

astropy.io.fits read row from large fits file with mutliple HDUs

I have a fits file with ~50GB, containing multiple HDUs, which all have the same format: an (1E5 x 1E6) array with 1E5 objects and 1E6 time stamps. The HDUs describe different physical properties such as Flux, RA, DEC etc. I want to read just 5…
MaxG
  • 243
  • 4
  • 8
3
votes
2 answers

Adding columns to a FITS table with PyFITS

Let's assume I have a fits file with one extension, and the data consists of a table of two columns with 100 elements each data = pyfits.open('path2myfile')[1].data head = pyfits.open('path2myfile')[1].header print data['field1'] # print an array…
Cehem
  • 83
  • 1
  • 5
3
votes
1 answer

Add a column to fits file with Astropy

I have a fits files of event data, and I need to modify one of the tables by adding a new column of data derived by the data stored in a preexisting column of the same table. The problem I have is in closing the modified file. This is the code: data…
Py-ser
  • 1,860
  • 9
  • 32
  • 58
2
votes
1 answer

How to turn a list of files into a parfive.results.Results type?

I'm downloading a list of .fits files through the Fido.fetch() function from sunpy, and in the end of the process they are grouped in a parfive.results.Results type. The next step of the process takes this type and applies the sunpy.map.Map()…
2
votes
1 answer

How to display a 16 bit colour FITS image using python

I want to display a FITS image in python. I have all this working using astropy (the FITS loader) and matplotlib and a greyscale image. However I have images that are 16 bit colour with a Bayer matrix of RGGB and I don't know how to display this…
Magic Bullet Dave
  • 9,006
  • 10
  • 51
  • 81
2
votes
0 answers

Problem with astropy.wcs : PCi_ja matrix is singular

I am currently working on a astronomy project, I trying to know the coordinate of each pixel in a fits file. I've tried to use astropy.wcs, this is the code that I tried. from astropy.io import fits from astropy import wcs file =…
2
votes
1 answer

Read FITS files

I have some experience in several programming languages, but I would like to try APL. I'm doing some tutorials, but I want to work in a practical example. I would like to read astronomical images from a file, in FITS format (a very common format for…
J C Gonzalez
  • 861
  • 10
  • 23
2
votes
3 answers

.FITS file/table to csv?

Any suggestions on how to convert a .fits file (or table) to a csv? I tried to and the code was running for over 12 hours. I currently used pandas and read the table and tried to save as csv: dr_file = get_pkg_data_filename('/users/...data.fits') …
Lily
  • 43
  • 1
  • 6
2
votes
2 answers

Preserving the WCS information of a FITS file when rebinned

Aim : Rebin an existing image (FITS file) and write the new entries into a new rebinned image (also a FITS file). Issue : Rebinned FITS file and the original FITS file seem to have mismatched co-ordinates (figure shown later in the…
Astronomer
  • 99
  • 1
  • 1
  • 7
2
votes
1 answer

Combining Astropy FITS files?

So I have some Astropy fits tables that I save (they have all have the same format, column names, etc.). I want to take all these fits files and combine them to make one large fits file. Currently, I am playing around with the astropy.io append and…
Patrick
  • 161
  • 8
2
votes
2 answers

How do you extract a point spread function from a fits image?

I'm new to python coding and I have a .fits image of a star and I want to extract the PSF from it. How would i go about doing this? After that how would I fit a Gaussian curve to it?
p. jlenp
  • 23
  • 1
  • 5
2
votes
2 answers

Scale axis tick labels for coordinates plot

I am working with VLBI data (Very Long Baseline Interferometry, like one that was used to make a recently trended black hole shadow image). I am plotting an image which is taken from a FITS file. By the means of a WCS transformation, it is…
Mikhail Lisakov
  • 1,600
  • 1
  • 9
  • 7
2
votes
1 answer

How do you log stretch a FITS image and change its contrast?

I'm trying to use astropy 2.0.11 with python 2.7.15 to edit a fits image by applying a log stretch to it and change the contrast, and I have't been able to figure it out. I've been trying to follow the tutorials on the astropy website for opening…
SPYBUG96
  • 1,089
  • 5
  • 20
  • 38
2
votes
1 answer

How to plot an image from a FITS file with real coordinates?

The astropy documentation has an example on how to plot an image from a FITS file. The axis on the resulting plot correspond to the number of pixels, or data points. I would like the axis to indicate galactic coordinates instead. Note that the…
usernumber
  • 1,958
  • 1
  • 21
  • 58
2
votes
2 answers

Making an Image Cube using multiple fits images

I have a bunch of fits files that can be read using the below script from astropy.io import fits hdu = fits.open('file.fits') data = hdu[0].data I am trying to make an image cube using the data read from multiple fits files. (An image cube is a 3D…
Mc Missile
  • 715
  • 11
  • 25
1 2
3
22 23