function psf_1_gauss_arg, d, xcen, ycen, rad nxnyn, d, nx, ny ; ----------- isolate the data to fit, prepare depend. var. structure ; find the bounding x and y indices of the bounding box x0 = 0>(floor(xcen)-rad) x1 = (ceil(xcen)+rad) < (nx-1) y0 = 0>(floor(ycen)-rad) y1 = (ceil(ycen)+rad) < (ny-1) mx = 1L + x1 - x0 my = 1L + y1 - y0 ; make the indices x = lindgen(mx, my) y = lindgen(mx, my) for i = 0,my-1 do x[*,i] = findgen(mx) + x0 for i = 0,mx-1 do y[i,*] = findgen(my) + y0 ok = where( ( (x-xcen)^2. + (y-ycen)^2.) lt rad^2, nok) if nok eq 0 then begin print, 'psf_1_gauss_arg: no points in fit radius' stop end x = x[ok] y = y[ok] indx = x + y * nx arg = {nx:nx, ny:ny, indx:indx} return, arg end