FUNCTION qView_TMO_tracksky, state, data, box, center, p_axis, nearest=nearest, rfov=rfov, pfov=pfov ;+ ; NAME: ; qView_TMO_tracksky ; PURPOSE: ; ; CATEGORY: ; CALLING SEQUENCE: ; box_data = qView_TMO_tracksky(state, nimg, data, box, center, p_axis) ; INPUTS: ; state array[1]; type: structure ; qView state structure ; nimg scalar; type: integer ; # images stored in data ; data array[nx,ny,nimg]; type: float ; image cube ; box array[2,2]; type: integer ; square box in image of size [nx,ny] ; box[0:1,0] is the lower left corner ; box[0:1,1] is the upper right corner ; center array[2]; type: float ; x- and y-coordinate of center of SMEI fov arc ; p_axis array[2]; type: float ; azimuth and radius of optical axis relative to 'center' ; OPTIONAL INPUT PARAMETERS: ; /nearest calculates data values using nearest neighbours instead of ; bilinear interpolation. ; OUTPUTS: ; box_data array[n,m,nimg] ; array of data values obtained by interpolating on 'data' ; n,m correspond to the size of 'box' ; OPTIONAL OUPUT PARAMETERS: ; rfov=rfov array[2,n,m,nimg] ; x- and y-coordinates for all pixels as they move ; across the sky through the 'nimg' images in the image cube. ; Only coordinates inside the field of view are returned. ; When a pixel moves outside the fov BadValue(0.0) is returned. ; pfov=pfov array[2,n,m,nimg] ; polar coordinates for all pixels. ; When a pixel moves outside the fov BadValue(0.0) is returned. ; INCLUDE: @compile_opt.pro ; On error, return to caller ; CALLS: ; BadValue, qView_ImageInfo, TMO_tracksky, SetFileSpec, GetFileSpec ; InitVar ; SIDE EFFECTS: ; PROCEDURE: ; The x- and y-coordinates in 'center' and 'box' are measured relative ; to the same origin, e.g. the lower left corner of the image on display, ; or the lower left corner of the original image if only a portion of ; an image is loaded. The output values in 'rfov' also are relative to ; this origin. ; ; The input 'box' is applied to the image on display (not necessarily the ; first image in the sequence). All pixels of this box inside the field of ; view (stored in 'ifov') are tracked as they move across the field of view. ; The changing coordinates are returned in 'rfov'. ; Function values are calculated by linear interpolation. ; MODIFICATION HISTORY: ; FEB-2001, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ;- InitVar, nearest, /key n = size(data, /dim) dim = n[0:1] nimg = n[2] nx = box[2]-box[0]+1 ny = box[3]-box[1]+1 bad = BadValue(data) box_data = replicate(bad, nx*ny, nimg) frame = qView_ImageInfo(state, /display, /list) frame = frame[1:*]-frame[0] widget_control, state.wid_pick, get_uvalue=allfiles, /no_copy file = allfiles[0,0] widget_control, state.wid_pick, set_uvalue=allfiles, /no_copy SetFileSpec, file file = strlowcase( GetFileSpec(part='name') ) n = strlen('tmo71') IF strlen(file) GE n THEN BEGIN CASE strmid(file,0,n) OF 'tmo70': north = 1 ; 10 January 2002 'tmo71': south = 1 ; 11 January 2002 ELSE : ENDCASE ENDIF rfov = TMO_tracksky(box, center=center, p_axis=p_axis, frame=frame, pfov=pfov, south=south, north=north) FOR i=0,nimg-1 DO BEGIN x = rfov[0,*,*,i] ngood = where( finite(x) ) nbad = where( 1-finite(x) ) IF ngood[0] NE -1 THEN BEGIN y = rfov[1,*,*,i] CASE nearest OF 0: box_data[ngood,i] = interpolate(data[*,*,i], x[ngood], y[ngood], missing=bad) 1: BEGIN x = x[ngood] y = y[ngood] m = where( 0 LE x AND x LE dim[0]-1 AND 0 LE y AND y LE dim[1]-1 ) IF m[0] NE -1 THEN box_data[ngood[m],i] = (data[*,*,i])[round(x[m]), round(y[m])] END ENDCASE ; if nbad[0] ne -1 then $ ; box_data[nbad,i] = mean(box_data[ngood,i]) ENDIF ENDFOR box_data = reform(box_data, nx, ny, nimg, /overwrite) RETURN, box_data & END