;/* ---------------------------------------------------------------------- ; Find real value of lower or upper bound at a given column. ; mode=1 : lower bound. ; mode=2 : upper bound. ; The lower bound is offset for some orders to align profiles. ; NOTE: Shifting polynomials by 'yvoff' pixels inward (fudge).. -tab 14mar2017 ;*/ function nsxng_find_real_image_row, mode, icol, nso, NCP, SlitOffset ; common nsx if n_params() lt 5 then SlitOffset = 0. if n_params() lt 4 then ncp = nsxng_load_ncp() yvoff_lo = [ 0.d, 0., 0., 2., 1., 0., 0., 0., 0. ] yvoff_up = [ 0.d, 0., 0., 5., 4., 3., 3., 3., 0. ] if (mode eq 1) then begin xv = icol - NCP[nso].xoffa ; yv = poly(xv,NCP[nso].coefa) ; yv = yv + yvoff_lo[nso] ; endif else begin xv = icol - NCP[nso].xoffb ; yv =poly(xv,NCP[nso].coefb) ; yv = yv - yvoff_up[nso] ; endelse yv = yv + SlitOffset ; return, yv end