pro half_power,x,y,lhpp,uhpp,cen,wid ;------------------------------------------------------------------------------------- ; Find the half power points for the input curve, X vs. Y. ; This routine is useful for things like RSR & FOV curves. ; ; Input: ; x.........x-axis of the function ; y.........the function (same dimension as x) ; ; Output: ; lhpp......lower half-power point ; uhpp......upper half-power point ; cen.......center of the function (units of X, midway between half-power points) ; wid.......width (units of X, distance between half-power points) ; ; Source: Mark Hervig, GATS Inc. ;------------------------------------------------------------------------------------- nx = n_elements(x) k = where(y eq max(y)) & kp =k(0) ; find the peak haf = max(y) * 0.5 hpp1 = interpol(x(0:kp), y(0:kp), haf) hpp2 = interpol(x(kp:nx-1), y(kp:nx-1), haf) lhpp = min( [hpp1,hpp2] ) ; this step is in case x was decreasing, not increasing uhpp = max( [hpp1,hpp2] ) cen = (lhpp + uhpp) * 0.5 ; band center wid = abs(lhpp - uhpp) ; band width ;- done return end