-- 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)


This topic: Students/UnderGraduates > UserList > JeanDuffy > JeanDuffyBScProject > JeanDuffyPythonCode
Topic revision: r1 - 25 Oct 2013 - JeanDuffy
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2022 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