function gt_center, item, cmd=cmd, hxa=hxa, $ roll=roll, $ helio=helio, angle=angle, string=string, hxt=hxt, $ x=x, y=y, pfi_strip=pfi_strip, $ suncenter=suncenter, use_history=use_history, qstop=qstop ; ;+ ;NAME: ; gt_center ;PURPOSE: ; Return the center of an SXT Field of View (Observing region, ; not PFI strip) in either ; (1) Absolute IDL FR IDL pixel coordinates (DEFAULT) ; (2) heliocentric coordinates ; (3) angle relative to sun center in units of arcsec ; (4) HXT coordinates ; For (2) and (3) above, SXT_CEN is called to determine the ; absolute SXT coordinates of the sun center for the times ; in question. ;SAMPLE CALLING SEQUENCE: ; pix = gt_center(index) ; helio = gt_center(index, /helio) ; helio = gt_center(index, /helio, /cmd) ; ang = gt_center(roadmap) ; ang = gt_center(roadmap, /pfi_strip) ;INPUT: ; item - The SXT index or roadmap ;OUTPUT: ; pix - absolute IDL FR pixel coordinates (CCD pixel coordinate) ; (0,*) = E/W direction (larger pixel address to W) ; (1,*) = N/S direction (larger pixel address to N) ; This value is independent of the position on the sun or ; the S/C pointing. ;OPTIONAL KEYWORD INPUT: ; helio - If set, return heliocentric coordinates. Output: ; (0,*) = longitude (degrees) W positive ; (1,*) = latitude (degrees) N positive ; The S/C pointing is needed since these coordinates are ; relative to sun center (ATT or commanded pointing database). ; angle - If set, return relative to sun center in units of arcsec ; (0,*) = angle in E/W direction with W positive ; (1,*) = angle in N/S direction with N positive ; The S/C pointing is needed since these coordinates are ; relative to sun center (ATT or commanded pointing database). ; hxt - If set, return HXT coordiates ; (0,*) = E/W direction with W negative! ; NOTE: This is opposite of SXT and HELIO ; (1,*) = N/S direction with S negative ; The HXT and SXT are rigidly aligned to each other, so ; the S/C pointing is not needed for this conversion. ; There are orbital and seasonal variations between SXT and ; HXA (which is located on the front panel), but those same ; variations are seen between HXT and HXA. ; pfi_strip - If set, return the center for the PFI strip (not the ; assembled observing region) ; ; roll - This is the S/C roll value in degrees. If not passed in, ; the ATT database is used to determine the roll. ; hxa - If set, use HXA_SUNCENTER to determine the location of the ; sun center in pixels. Default is to use GET_SUNCENTER. ; cmd - If set, use SXT_CMD_PNT to determine the location of the ; sun center in pixels. Default is to use SXT_CEN. ; ; string - If set, convert the output to string format (only relevent ; with /HELIO option) ; ; suncenter- The sun center coordinates (in Full Resolution Equivalent ; pixels) ; use_history - If set, then extract the sun center coordinates from ; the history portion of the index if possible. This is not ; recommended since the ATT database may have been updated ; an improved since the history values were established. ;METHOD: ; When the S/C pointing information is needed (options /HELIO or ; /ANGLE) then the ATT database is checked first. If it is not there, ; the ATR or PNT is checked. If it is unavilable, then the commanded ; pointing history is used. If lower pointing resolution is acceptable, ; it is recommended to use the commanded pointing history by using ; the /CMD option. ; ; The CONV_ routines are used for all conversions between coordinate ; systems. ;HISTORY: ; Written Jun-93 by M.Morrison ; 14-Jul-93 (MDM) - Added /PFI_STRIP option ; - Made the default to return the observing region center ; not the PFI strip center ; 27-Jul-93 (MDM) - Updated header ; 28-Jul-93 (MDM) - Correced to call GT_SHAPE with /OBS_REGION ; 17-Aug-93 (MDM) - Modified so that the OR offset for OR exposure number ; is not performed if the input item is an index with ; a history record ; 16-Oct-93 (MDM) - Removed the tilt keyword input ; 28-Jul-94 (MDM) - Updated header ; 14-Nov-94 (MDM) - Put 28-Jul-94 version on-line - it was not online before!?!?! ; 9-Feb-95 (MDM) - Updated header ; 10-Mar-95 (MDM) - Added SUNCENTER and USE_HISTORY keyword options ; - Added SUNCENTER to CONV_P2H and CONV_P2A calls ; 2-Aug-2008 (Aki Takeda) - Modified to correct the relative alignment ; of X-ray and White light images. ;- ; corner = gt_corner(item) ;need to allow roadmap to be input for gt_corner shape = gt_shape(item, obs_region=1-keyword_set(pfi_strip) ) res = 2^gt_res(item) ; ;---- check if there are white light images (AkT, 1-Aug-2008) ---- ; (WL images have offset to the X-ray suncenter) ss_wl=where(((gt_filtb(item) eq 1) and (gt_filta(item) eq 2)) or $ ((gt_filtb(item) eq 1) and (gt_filta(item) eq 5))) if ss_wl(0) ne -1 then begin suncenter = sxt_cen(item, hxa=hxa, cmd=cmd, roll=roll0) offset=gt_sxt_axis(item,/rel) suncenter = suncenter + offset endif ;----------------------------------------------------------------- ; if ((not keyword_set(pfi_strip)) and (not his_exist(item))) then begin ins = gt_or_expnum(item) corner(1,*) = corner(1,*) - (ins-1)*64 ;move the Y corner back to the lower left of the whole observing region end ; out = corner out(0,*) = out(0,*) + res * (shape(0,*)-1) / 2. out(1,*) = out(1,*) + res * (shape(1,*)-1) / 2. ; if (keyword_set(use_history)) then suncenter = gt_sxt_cen(item) ; ;"corner" is address of the center of the lower left pixel ;for an image 3 pixels wide, the center is in the second pixel, which ;is only ONE pixel over. This explains the "shape-1". ; if (keyword_set(helio)) then out = conv_p2h(out, item, cmd=cmd, hxa=hxa, $ roll=roll, suncenter=suncenter, string=string) if (keyword_set(angle)) then out = conv_p2a(out, item, cmd=cmd, hxa=hxa, $ roll=roll, suncenter=suncenter) if (keyword_set(hxt)) then out = conv_p2hxt(out) ; if (keyword_set(x)) then out = reform(out(0,*)) if (keyword_set(y)) then out = reform(out(1,*)) ; if (keyword_set(qstop)) then stop return, out end