pro hr_blk_intrp,hrb,logtn,logln,teffi,logli,lnprob,bias=bias
; This routine accepts the HR diagram probability block data hrb, defined on a
; grid with coordinates logtn, logln
; (typically obtained from a file written by mk_hrblock.pro
; and two vectors of length npt of parameters
; teffi, logli, for which probability densities are desired.  
; It interpolates into
; the hrb table to generate the ln of the corresponding probabilities 
; lnprob(npt)
; If keyword bias is set, its value multiplies an additive linear
; function that (if bias is positive) makes giants relatively more
; probable than dwarfs, a priori.  Reasonable values of bias (which do not
; distort the a priori probabilities in a crazy way) are roughly 1 to 10.
 
; constants
tsun=5777.
bt=-0.992      ; coeff of logT for bias function
bl=0.128       ; coeff of logL for bias function

; find indices into the HR block for the desired inputs
sz=size(hrb)
nt=sz(1)
nl=sz(2)
iit=findgen(nt)
iil=findgen(nl)
npt=n_elements(teffi)
lteffi=alog10(teffi/tsun)

jt=interpol(iit,logtn,lteffi)
jl=interpol(iil,logln,logli)

lnprob=fltarr(npt)

lnprob=interpolate(hrb,jt,jl,/cubic)

if(keyword_set(bias)) then lnprob=lnprob+bias*(bt*lteffi+bl*logli)

end