pro align_prep, index, xx, yy, sc, code, $ ;------------------------- Alignment parameters ref_image=ref_image0, $ helio=helio0, date_helio=date_helio, $ suncoord=suncoord0, $ ccdcoord=ccdcoord0, $ qroll=qroll, $ roll=roll, $ qdebug=qdebug, qstop=qstop ; if (n_elements(ref_image0) ne 0) then begin siz = size(ref_image0) typ = siz( siz(0)+1 ) if (typ ne 8) then ref_image = index(ref_image0) else ref_image = ref_image0 end ;---------------------------------------- Figure out the pointing coordinates to register to ; code = 2 ;default is to register relative to sun center if (keyword_set(helio0)) then code = 1 ;using heliocentric coorinates if (keyword_set(suncoord0)) then code = 2 ;using coordinates relative to sun center if (keyword_set(ccdcoord0)) then code = 3 ;using fixed IDL coordinates ; ;roll_use = 0 if (code eq 1) or (code eq 2) then begin sc = sxt_cen(index, roll=roll) ;need the sun center locations (in FR pixels) ; roll_use = roll * keyword_set(qroll) ;zero or the true roll end case code of 1: begin ;heliocentric if ((n_elements(helio0) lt 2) or (n_elements(date_helio) eq 0)) then begin ;did not come in defined if (n_elements(ref_image) eq 0) then begin ; helio = gt_center(index(0), /helio, roll=roll_use) ;use the coordinates of the first image helio = gt_center(index(0), /helio) ;use the coordinates of the first image date_helio = anytim2ints(index(0)) end else begin ; helio = gt_center(ref_image, /helio, roll=roll_use) helio = gt_center(ref_image, /helio) date_helio = anytim2ints(ref_image) end end else begin helio = helio0 end end 2: begin ;coordinates relative to sun center if (n_elements(suncoord0) lt 2) then begin ;did not come in defined if (n_elements(ref_image) eq 0) then begin ; sunc = gt_center(index, /angle, roll=roll_use) sunc = gt_center(index, /angle) suncoord = fltarr(2) suncoord(0) = total(sunc(0,*)) / n_elements(index) ;take the sun center position for all PFI images suncoord(1) = total(sunc(1,*)) / n_elements(index) ;and average them to get the center position end else begin ; suncoord = gt_center(ref_image, /angle, roll=roll_use) suncoord = gt_center(ref_image, /angle) end end else begin suncoord = suncoord0 end end 3: begin if (n_elements(ccdcoord0) lt 2) then begin ;did not come in defined if (n_elements(ref_image) eq 0) then begin ccd = gt_center(index) ccdcoord = intarr(2) ccdcoord(0) = total(ccd(0,*)) / n_elements(index) ;take the sun center position for all PFI images ccdcoord(1) = total(ccd(1,*)) / n_elements(index) ;and average them to get the center position end else begin ccdcoord = gt_center(ref_image) end end else begin ccdcoord = ccdcoord0 end end endcase ; ;---------------------------------------- Figure out the offsets ; fs = gt_sxt_axis(index, /rel_xray) ;filter shift in full resolution pixels relative to the x-ray axis (2xN) ;NB = (-0.36, 1.47) and NB image is NE of X-ray image ;so we need to start farther left, and higher on the CCD to compensate ==> + fs arcsec_per_pix = gt_pix_size() case code of 1: begin ; h_ang = track_h2a(index, helio, date_helio) ;need heliocentric motion (in arcsec) ; h_ang = h_ang / gt_pix_size() ;converted to pixels from sun center ; xx = sc(0,*) + h_ang(0,*) + fs(0,*) ;center of the FOV in FR IDL coordinates ; yy = sc(1,*) + h_ang(1,*) + fs(1,*) suncoord = reform(track_h2a(index, helio, date_helio)) ;need heliocentric motion (in arcsec) xy = conv_a2p(suncoord, index) ; Added call to conv_a2p for correct xx = xy(0,*) ; coordinate conversion (GLS - 25-Apr-99) yy = xy(1,*) end 2: begin ;;sc = sxt_cen(index, roll=roll) ;need the sun center locations (in FR pixels) ; xy = suncoord/ARCSEC_PER_PIX ;FR pixels relative to sun center ; xx = xy(0) + sc(0,*) + fs(0,*) ;center of the FOV in FR IDL coordinates ; yy = xy(1) + sc(1,*) + fs(1,*) suncoord = reform(rebin(suncoord,2,n_elements(index),/sample)) xy = conv_a2p(suncoord, index) ; Added call to conv_a2p for correct xx = xy(0,*) ; coordinate conversion (GLS - 25-Apr-99) yy = xy(1,*) end 3: begin xx = ccdcoord(0) + fltarr(n_elements(index)) yy = ccdcoord(1) + fltarr(n_elements(index)) end endcase end