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
4
votes
0 answers

What to do with: ValueError: x and y can be no greater than 2-D, but have shapes (1L,) and (1L, 28L, 28L)

My goal is to plot a profile of a 2D FITS file that I already asked the user for with a try/except. I want to slice a part of this FITS file and then plot this part. I will just put my whole code here. I don't think there is anything wrong with the…
Thomas
  • 53
  • 1
  • 6
4
votes
2 answers

Astropy Fits: How to write out a table with rows sliced out?

I'm currently working with some fits tables and I'm having trouble with outputting in Astropy.io.fits. Essentially, I am slicing out a bunch of rows that have data for objects I'm not interested in, but when I save the new table all of those rows…
AshleyNova
  • 55
  • 4
4
votes
1 answer

How to remove stars and other objects from a galaxy FITS image using Matlab?

I have the following image in fits format. I want to remove all the stars and other smaller dots from that image using matlab. I performed the following matlab operations to remove stars in it. I = imread('NGC_0253.jpg'); if size(I,3)==3 …
An student
  • 392
  • 1
  • 6
  • 16
4
votes
2 answers

Radial Profile from a .fits image

I have been trying to plot a radial profile of a fits image using a modified script I found on-line. I always get y axis units which are completely different to what's expected. I'm not even sure what the y axis units are. I have attached the fits…
BubbleGum
  • 53
  • 1
  • 4
4
votes
2 answers

How to change the dtype of a numpy recarray when one of the columns is an array?

In previous posts I've seen that changing dtype of a recarray can be performed using astype. However I cannot manage to do it with a recarray which has an array in one of its columns. My recarray comes from a FITS file record: > f =…
mtc
  • 43
  • 1
  • 4
4
votes
2 answers

astropy.io.fits - HIERARCH keywords don't work with CONTINUE cards: Bug or "Feature" of the FITS standard?

The astropy.io.fits manual states, that we can use header keywords longer than 8-characters. In this case HIERARCH cards will be created. The manual also states, that if we want to store keyword-value pairs longer than 80-characters, continue cards…
Christian Herenz
  • 505
  • 5
  • 18
4
votes
0 answers

canvas image and svg overlay

I use the astrojs library (precisely webfits and fitsjs) to load a FITS file in a canvas. I would like to add an overlay to encircle stars, trace paths and so on, and I decided to do it with d3.js This is my current test (it takes a while to…
leonard vertighel
  • 1,058
  • 1
  • 18
  • 37
3
votes
1 answer

How to convert .fits file/ astropy table to pandas df and reverse?

I need to frequently convert pandas df to .fits files and also the reverse - I am given .fits files for which is easier for me to process them as pandas dfs. What is the most straightforward way for doing the conversions between these file types?
NeStack
  • 1,739
  • 1
  • 20
  • 40
3
votes
2 answers

Opening fits files with no SIMPLE keyword in python

I have a large number of fits files that I'm unable to open becuase of a missing SIMPLE keyword. When I try to open them using astropy's fits.open() it gives the following error: OSError: No SIMPLE card found, this file does not appear to be a valid…
orange
  • 41
  • 4
3
votes
1 answer

Converting pixels into wavelength using 2 FITS files

I am new to python and FITS image files, as such I am running into issues. I have two FITS files; the first FITS file is pixels/counts and the second FITS file (calibration file) is pixels/wavelength. I need to convert pixels/counts into…
3
votes
1 answer

Coordinate conversion problem of a FITS file

I have loaded and plotted a FITS file in python. With the help of a previous post, I have managed to get the conversion of the axis from pixels to celestial coordinates. But I can't manage to get them in milliarcseconds (mas) correctly. The code is…
Wara
  • 304
  • 2
  • 11
3
votes
1 answer

CSharpFits: Writing FITS-file results in wrong image

I am currently working on a C#-project to reduce echelle spectra, which are basically 2D 16bit images in FITS format. The end result, for now, should be another FITS-file, but one-dimensional. For this task I am using the CSharpFits-library…
kinarf
  • 41
  • 4
3
votes
1 answer

Get pixel coordinates from ra, dec after oversampling FITS image

I'm looking for a way to locate the pixel coordinates on my FITS image that correspond to ra and dec positions of an object in degrees, after oversampling. This would be simple if I wasn't oversampling, but I need to. Given an unaltered FITS image,…
curious_cosmo
  • 1,184
  • 1
  • 18
  • 36
3
votes
1 answer

Saving masked image as FITS

I've constructed an image from some FITS files, and I want to save the resultant masked image as another FITS file. Here's my code: import numpy as np from astropy.io import fits import matplotlib.pyplot as plt #from astropy.nddata import…
Jim421616
  • 1,434
  • 3
  • 22
  • 47
3
votes
1 answer

How to change the header after resizing a submap?

I load a full map from astropy.io import fits from astropy.wcs import wcs mapheader = fits.getheader(MapFile, 0) mapdata = fits.getdata(MapFile, 0) w = wcs.WCS(mapheader) and I take a squared submap from it assuming the center is in RA,DEC in…
1
2
3
22 23