pro hrb_adjust,hrbin,t0,lu0,slope,hwid,st,sl,ht,hrbout ; This routine restores the hrblock file hrbin. It then adds to hrb ; an adjustment constructed as follows. ; A line of points passing through (t0,lu0) with given slope (dlnL/dlnT) ; and halfwidth in log(t0) equal to hwid is generated. The intensity along ; the line is constant for the central half of its length, with a cosine ; taper to zero at both ends. This is smoothed with ; a gaussian having sigma equal to gt, gl in the teff and lum directions. ; The whole thing is then scaled so that its maximum amplitude is ht. ; the result is added to hrb, and saved as a save file to hrbout. ; get the data restore,hrbin nt=n_elements(logtn) nl=n_elements(logln) it=findgen(nt) il=findgen(nl) cc=poly_fit(it,logtn,1) tt0=cc(0) dt=cc(1) cc=poly_fit(il,logln,1) ll0=cc(0) dl=cc(1) ; make work arrays h0=fltarr(nt,nl) h1=fltarr(nt,nl) ; make the line s=where(logtn ge (t0-hwid) and logtn le (t0+hwid),ns) xx=logtn(s)-t0 yy=lu0+slope*xx ixx=xx/hwid ; a number in the range -1.,1. ; make amplitude of the line, on 1-pixel grid amp=fltarr(ns) aix=abs(ixx) s0=where(aix le 0.5,ns0) if(ns0 gt 0) then amp(s0)=1. s1=where(aix gt 0.5,ns1) if(ns1 gt 0) then amp(s1)=0.5*(1.+cos((aix(s1)-.5)*2.*!pi)) ; make pixel coords for line samples ix=s iy=(yy-ll0)/dl ; set values inside h0 array for i=0,ns-1 do begin sy=iy(i) mod 1. h0(ix(i),fix(iy(i)))=amp(i)*(1.-sy) h0(ix(i),fix(iy(i))+1)=amp(i)*sy endfor ; smooth it tt=rebin(logtn,nt,nl) ll=rebin(reform(logln,1,nl),nt,nl) for i=0,nt-1 do begin for j=0,nl-1 do begin arg=(tt-logtn(i))^2/st^2 + (ll-logln(j))^2/sl^2 arg=arg < 30. fun=exp(-arg) h1(i,j)=total(fun*h0) endfor endfor ; scale it mh1=max(h1) h1=ht*h1/mh1 ; add it to existing array hrba=hrb+h1 stop ; write it out hrb=hrba save,hrb,logln,logtn,file=hrbout end