pro pfi_movy_loc, item1, item2, bin=bin, pfi_struct=pfi_struct, qstop=qstop, $ used_pfi=pfi, hours=hours, qdebug=qdebug, color=color, quiet=quiet ;+ ;NAME: ; pfi_loc ;PURPOSE: ; To overlay the PFI location on an image of the sun, or to display a line ; plot of the sun and show the PFI location. ;SAMPLE CALLING SEQUENCE: ; pfi_loc, item1 ; pfi_loc, '1-jun-93 1:00' ; pfi_loc, index(30), /hour ; pfi_loc, index(30), pfi_struct=pfi_index ; pfi_loc, pfi_struct=pfi_index ; pfi_loc, index, '6-nov-93 12:00',color=128 ;OPTIONAL INPUTS: ; item1 - The index for a full frame image which was just displayed ; (in which case the box location is overlayed on the image) ; (OR) ; A string time and date (in which case a line plot is made) ; item2 - The time for the PFI images to be displayed. This option is ; only relevant when "item1" is the full frame index. ; The routine will correct for any commanded S/C offpoints, but ; will not correct for solar rotation effects, so the delta time ; between item1 and item2 should be less than a couple of days ; to be very useful. ;OPTIONAL KEYWORD INPUT: ; bin - If the full frame image was rebinned, then the binning factor ; must be passed in. ; hours - If set to 1, then get the PFI locations +/- 1 one hour on ; either side of the input time. If set to 2, then +/1 2 hours. ; pfi_struct - The PFI location is determine by reading the observing ; log by default. A SXT PFI roadmap or index can be passed ; directly using pfi_struct. ; color - color of box for pfi drawn on image, default=255 ; /quiet, don't print time of PFI image. ;HISTORY: ; Written 10-Jan-94 by M.Morrison ; 11-Jan-94 (MDM) - Added HOURS option ; - Added second parameter option for the time of ; the PFI(s) that should be displayed ; 21-Mar-94 (MDM) - Corrected an error which was causing PFI images ; that were not FR to be displayed in the wrong ; place. ; - Corrected so that FFI images that are not full ; frame are displayed properly. ; 9-Dec-94 (LWA) - Added color keyword. ; 12-May-09 (LWA) - Created from pfi_loc.pro for use with movie_review. ;- ; if (n_elements(bin) eq 0) then bin = 1 if NOT keyword_set(color) then color=255 else color=color quiet=keyword_set(quiet) ; qlineplot = 1 if (data_type(item1) eq 8) then begin ;a structure is passed in qlineplot = 0 ;overlay it on an image end ; del = 0.5 ;read 1/2 hour either side by default if (keyword_set(hours)) then del = hours if (n_elements(pfi_struct) eq 0) then begin if (n_elements(item2) eq 0) then tim = anytim2ints(item1(0)) $ else tim = anytim2ints(item2) sttim = anytim2ints(tim, off=-60.*60.*del) ;back up an hour entim = anytim2ints(tim, off= 60.*60.*del) ;forward an hour rd_obs, sttim, entim, bcs, sxtf, pfi, /sxtp, status=status,/quiet if (get_nbytes(pfi(0)) gt 10) then begin if (not keyword_set(hours)) then begin idset = tim2dset(pfi, tim) pfi = pfi(idset) if not quiet then print, 'Displaying PFI image: ' + fmt_tim(pfi) end else begin print, 'Displaying PFI Images for the time span:' fmt_timer, pfi end end else begin print, 'PFI_LOC: Cannot read the observing log for time: ' + fmt_tim(tim) print, 'Returning...' return end end else begin pfi = pfi_struct end ; if (keyword_set(qstop)) then stop ; if (qlineplot) then begin plot_fov, pfi, /box end else begin ; cen0 = sxt_cen(item1(0), /cmd) ; cen = sxt_cen(pfi, /cmd) cen0 = sxt_cen(item1(0)) ;Center of FFI in FR pix. cen = sxt_cen(pfi) ;Center of PFI in FR pix. fxy = shift_res(cen0,/xy,/fh) ;FFI center in HR pixels xcen0 = (gt_center(pfi,/x)-(cen(0)-cen0(0))-gt_corner(item1(0),/x)) ;PFI location in FR pixels ycen0 = (gt_center(pfi,/y)-(cen(1)-cen0(1))-gt_corner(item1(0),/y)) xyh = shift_res([xcen0,ycen0],/xy,/fh) ;PFI center in HR pixels mxy = [item1(0).crpix1-1,item1(0).crpix2-1] ;Center of movie image xcen = xyh(0) + (mxy(0) - fxy(0)) ;Movie shift in X ycen = xyh(1) + (mxy(1) - fxy(1)) ;Movie shift in Y ; xfov = gt_shape(pfi, /x) * (2^gt_res(pfi)) ;xfov in FR pixels ; yfov = gt_shape(pfi, /y) * (2^gt_res(pfi)) ;yfov in FR pixels xfov = gt_shape(pfi, /x) * (2^gt_res(pfi,/orig)) / 2. ;xfov in HR pixels yfov = gt_shape(pfi, /y) * (2^gt_res(pfi,/orig)) / 2. ;yfov in HR pixels ; ; fact = 1./(2^gt_res(item1)) * bin fact = float(bin) ; ;help,xcen0,ycen0 ;print,xcen0,ycen0 ;help,xcen,ycen,fact,xfov,yfov for i=0,n_elements(pfi)-1 do begin draw_boxcensiz, xcen(i)*fact, ycen(i)*fact, xfov(i)*fact,yfov(i)*fact, $ /dev,color=color end end end