pro starmass,logti,loggi,logmass
; This routine estimates the mass of a star given its log(Teff)
; and log(g). Algorithm is to interpolate in a 2D table of values,
; with these derived from a weighted average of masses found on
; isochrones for a variety of ages. Weights are a function of the
; isochrone age, and of the distance from each grid point to the
; various isochrone points.
; get data for doing interpolation
masstbl='/home/tbrown/d/stardat/masstable.sav'
restore,masstbl
npt=n_elements(logti)
; get logt, logg in terms of indep var coordinates
t0=logt(0)
dt=logt(1)-logt(0)
g0=logg(0)
dg=logg(1)-logg(0)
iit=(logti-t0)/dt
iig=(loggi-g0)/dg
; do the interpolation
logm=interpolate(logmass,iit,iig)
logmass=logm
end