















































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!
















































































#!/usr/bin/env python import numpy as np import matplotlib.mlab as mlab import matplotlib.pyplot as plt mu, sigma = 100, 15 x = mu + sigma*np.random.randn(10000)
n, bins, patches = plt.hist(x, 50, normed=1, facecolor='green', alpha=0.75)
y = mlab.normpdf( bins, mu, sigma) l = plt.plot(bins, y, 'r--', linewidth=1) plt.xlabel('Smarts') plt.ylabel('Probability') plt.title(r'$\mathrm{Histogram\ of\ IQ:}\ \mu=100,\ \sigma=15$') plt.axis([40, 160, 0, 0.03]) plt.grid(True) plt.show()
>>> import pyfits >>> hdulist = pyfits.open(’input.fits’) >>> hdulist.info() Filename: test1.fits No. Name Type Cards Dimensions Format 0 PRIMARY PrimaryHDU 220 () Int 1 SCI ImageHDU 61 (800, 800) Float 2 SCI ImageHDU 61 (800, 800) Float 3 SCI ImageHDU 61 (800, 800) Float 4 SCI ImageHDU 61 (800, 800) Float >>> hdulist[0].header[’targname’] ’NGC121’ >>> scidata = hdulist[1].data >>> scidata.shape (800, 800) >>> scidata.dtype.name ’float32’ >>> scidata[30:40,10:20] = scidata[1,4] = 999