c this file contains subroutine mask and checks c c::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: c c c subroutine mask(a,wa,m,error,etype) c c c c....................................................................... c c author: Christopher W. Churchill c c history: 15-Aug94 created, CWC c c purpose: create a bad pixel mask for the rejection of bad grid c points from the fit c c c input: reject = sigma rejection factor c Imin = 2D grid to fit [e-] at xmin locations c sig = Imin uncertainty ; fitting weights c xmin = interorder map [pixel locations] c gain = instrumental gain [e-/DN] c a = fitting coefficients c wa = working array for fit residuals c error = (logical) error flag c etype = error type c c output: sig = sigma set to 0. if rejected pixel c c I/O: none c c options: none c c routines called: linlsf c c description: this routine fits a polynomial of order yorder to c each interorder array Imin ; pixel locations with c fit residuals greater the reject times the fiting c sigma have their sigma set to zero ; the zero c sigma serve as flags for exclusion from the LSF c c NB: it would be very nice if this was iterative rejection c and the process be made interactive like icfit c c....................................................................... c implicit undefined (a-z) logical error integer j,icol,m,etype double precision chisq,fitsig,fsigma,a(1),wa(1) include 'hamscatt.par' include 'hamscatt.com' c c c c c c c loop over interorders do 11 j=1,ndata c c fit the interorder data to a yorder polynomial c on return, wa contains the fit residuals c on error, j is the error type call linlsf(j,a,wa,chisq,fitsig,error,2) if (error) then etype = j return end if c c loop over columns to flag rejects ; decrement the merit c function vector length, m do 10 icol=1,ncols fsigma = wa(icol)/fitsig if (abs(fsigma).gt.reject) then sig(j,icol) = 0. m = m - 1 end if 10 continue c c next interorder 11 continue c return end c c....................................................................... c c::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: c c c subroutine checks(n,m,tol,error,ecode) c c c c....................................................................... c c author: Christopher W. Churchill c c history: 15-Aug94 created, CWC c c purpose: create a bad pixel mask for the rejection of bad grid c points from the fit c c c input: norders = number of orders in image c toler = input tolerance common variable c ncols = number of columns in image c gamma = profile power law c nvec = max vector length of merit function c c output: n = sigma set to 0. if rejected pixel c m = working length of merit function c tol = tolerance parameter c error = (logical) error flag c ecode = type of error c termflag = (logical) high=global+local ; low=global c c I/O: none c c options: none c c routines called: none c c description: see subroutine comments c c....................................................................... c implicit undefined (a-z) logical error integer n,m,ecode double precision tol include 'hamscatt.par' include 'hamscatt.com' c c c c c c define the parameters tol, ndata, and m c it is advertised that the edges of the chip are fit, c this is not so (yet), so ndata is less than norders tol = toler ndata = norders - 1 m = ncols*ndata c c define n based upon gamma c gamma=0 means repress the local term if (gamma.eq.0.d0) then termflag = .false. n = xorder*yorder else termflag = .true. n = xorder*yorder + 1 end if c be sure that we have not exceeded work space limtations if (m.gt.nvec) then error = .true. ecode = 1 end if if (n.gt.nn) then error = .true. ecode = 2 end if c c return end c c....................................................................... c..eof