Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
Deleted: | ||||||||
< < | ||||||||
Extraction of useful information from a fit file#Change directory | ||||||||
Line: 65 to 64 | ||||||||
plt.figure(1), plt.imshow(d2) | ||||||||
Added: | ||||||||
> > | y=d.sum(1) import numpy as np x=np.arange(0,len(y),1) xmean=(x[600:]*y[600:]).sum()/y[600:].sum() print xmean plt.figure(2),plt.plot(x,y) | |||||||
plt.show() |
Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
Added: | ||||||||
> > |
Extraction of useful information from a fit file#Change directory import os os.chdir("C:/Users/Jean/Desktop/Python/Bsc/Fits") # 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. f=fits.open("Atlas_pleione_1sec.fit") # Set i to be an HDU object. i=f[0] # Set d to be an array of data. d=i.data # Imports matplotlib.pyplot module import matplotlib.pyplot as plt # Plots the array plt.figure(0),plt.imshow(d) # 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 d2=d[700:800,850:950] # Plot the subarea on a new figure plt.figure(1), plt.imshow(d2) plt.show() |