Пример #1
0
    def __init__(self,starsfile,var='stars'):
        junk = idlsave.read(starsfile)
        self.stars = junk[var]
        self.star = self.stars[0]
        self.fields = np.array(self.stars.dtype.names)
        
        #make fields lowercase
        for i in range(len(self.fields)):
            self.fields[i] = self.fields[i].lower()

        #assign attributes to class
        for field in self.fields:
            if type(self.star[field]) is np.ndarray:
                unpackedfield = savunpack.savunpack(self.stars[field])
                exec('self.'+field+' = unpackedfield')
            else:
                exec('self.'+field+' = self.stars["'+field+'"]')
Пример #2
0
import idlsave
import numpy as np
import matplotlib.pyplot as plt
import savunpack
import matplotlib.mlab as mlab


junk = idlsave.read('Stars/keck-fit-lite.sav')
stars = junk['stars']

o_staterr = savunpack.savunpack(stars.o_staterr)
c_staterr = savunpack.savunpack(stars.c_staterr)
smeabund  = savunpack.savunpack(stars.smeabund)
goodidx = np.where( (stars.o_abund > 0) & (stars.c_abund > 0) &
                        (o_staterr[:,0] > -0.3) &(c_staterr[:,0] > -0.3))

stars.o_abund = stars.o_abund - 8.7
stars.c_abund = stars.c_abund - 8.5
stars = stars[goodidx]
o_staterr = o_staterr[goodidx]
c_staterr = c_staterr[goodidx]
smeabund = smeabund[goodidx,:]
smeabund = smeabund.reshape(619,100)
#oulstars = stars[np.where((o_staterr[:,0] < -0.3) & (c_staterr[:,0] > -0.3))]
#culstars = stars[np.where((c_staterr[:,0] < -0.3) & (o_staterr[:,0] > -0.3))]

#put errorbars into a form that staterr likes

o_staterr = np.abs(o_staterr.transpose())
c_staterr = np.abs(c_staterr.transpose())
ni_abund  = smeabund[:,27]  + np.log10(smeabund[:,0])