-- JeanDuffy - 25 Oct 2013

Extraction of useful information from a fit file

#Change directory

import os


# Import fits from astropy.io

from astropy.io import fits

# Open the fit file "Atlas_pleione_1sec.fit" which

# opens it as an HDU (Header Data Unit) list and set to f.


# Set i to be an HDU object.


# Set d to be an array of data.


# Imports matplotlib.pyplot module

import matplotlib.pyplot as plt

# Plots the array


# Creates a figure and shows the plot

# Not needed in the kernel (for some reason)

# Gets all the Header information from the fit file

print fits.getheader("Atlas_pleione_1sec.fit")

# These can be run in the kernel

print d.mean()

print d.std()

print d.sum()

print d.sum(0)

print d.sum(1)

# Create a sub area


# Plot the subarea on a new figure

plt.figure(1), plt.imshow(d2)


Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions...

Physics WebpagesRHUL WebpagesCampus Connect • Royal Holloway, University of London, Egham, Surrey TW20 0EX; Tel/Fax +44 (0)1784 434455/437520

Topic revision: r1 - 25 Oct 2013 - JeanDuffy

  • Edit
  • Attach
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding RHUL Physics Department TWiki? Send feedback