import pdb import numpy as np import matplotlib.pyplot as plt import my_isochrones from astropy.io import ascii from astropy.io import fits ''' Purpose: import isochrone module to read in data and plot a Hess diagram for data at an age of one Gyr and solar metallicity. ''' # Read in data data=my_isochrones.read('zp00.dat',columns=['logTe','mbol','z','imf'],age=9) # Call the 'hess' function to plot the hess diagram my_isochrones.hess(data['logTe'],data['mbol'],data['imf']) # Syntax: fits.writeto('out.fits',data,header) # fits.append('out.fits',data,header) #fits.writeto('hess.fits',data['logTe'])
# Read data age=[] temp=[] grav=[] mag=[] z=[] n=21 # number of files to be read for i in range (1,n+1): if i < 10: file = '/home/holtz/analysis/apogee/dist/isochrones/zm0'+str(i)+'.dat' else: file = '/home/holtz/analysis/apogee/dist/isochrones/zm'+str(i)+'.dat' #file = 'zp00.dat' data = my_isochrones.read(file,columns=('age','logTe','logG','mbol','z')) age.append(data['age']) temp.append(data['logTe']) grav.append(data['logG']) mag.append(data['mbol']) z.append(data['z']) # Note that each of these contains 19 elements, and each of those # contains several thousand lines of data. age=np.array(age) temp=np.array(temp) grav=np.array(grav) mag=np.array(mag) z=np.array(z) # Create axes objects
import numpy as np import math import my_isochrones filename = "zp00.dat" data = my_isochrones.read(filename, age=9) fout = open('output.dat','w') print >> fout, data # Example for writing to file: # print >> fout, 'Filename:', filename # or f.write('...\n') fout.close()