;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; This procedure will help determine the center of the images. ;; Modifications have been made as to the calling paramaters mainly for use with ;; the procedure allum.pro located in /home/puu/cordyn/idl_pros. ;; sol_cen_x and sol_cen_y are to return the center of the solar image. ;; pixX and pixY should be the image dimensions. ;; disk_1 should be the name of the file that you're trying to find the center of. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Install a pretty cool cursor ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; device, cursor_image=[0,1,2,4,40,48,56,64,0,64,56,48,40,4,2,1],cursor_xy=[15,7] PRO find_center, sol_cen_x, sol_cen_y, pX=pixX, pY=pixY, image = disk_1 ; Modified for use with other image sizes.. ;;;;;; pixX=1534 & pixY = 1029 if (pixX EQ 1534 ) then begin d1_image=intarr(pixX,pixY) head = bytarr(2880*2) ;;; Header on the fits files endif else $ d1_image=bytarr(pixX,pixY) ;disk_1=' ' ;infile = 'disk_infile' DONE = 0 ;;;;;;;; Variable used for controlling the while loop... if (pixX EQ 1534) then D_VAL = 300 $ else D_VAL = 230 ;;;D_VAL = 300 ;;;;; This value is used to determine the "edge" of the disk.. TRUE = 1 & FALSE = 0 ;;;;;;;;; BOOLEAN VALUES ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Using the first image ( and therefore assuming correct alignment ) the ;; solar center will be "determined" (there is margin for error here!!!!) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; if (pixX EQ 1534) then begin ;;; file is fits and has a header.... close,2 & openr,2,infile & readf,2,disk_1 while (strmid(disk_1,14,1) NE 'd') do readf,2,disk_1 close,2 close,3 & openr,3,disk_1 & readu,3,head & readu,3,d1_image & close,3 endif else begin close,3 & openr,3,disk_1 & readu,3,d1_image & close,3 endelse window, 3, xsize=pixX, ysize=pixY, title='Solar Center Test' wset,3 tv, bytscl(d1_image) print,'Please click the mouse on the solar disk.' print,'Try a position where the x,y-chords intersecting the' print,'point do not pass through a vignetted section of the disk.' print,' ' cursor,_x_temp, _y_temp, /DOWN, /DEV wdelete,3 ledge = _x_temp & WHILE(d1_image(ledge,_y_temp) GT D_VAL) $ DO ledge=ledge-1 redge = _x_temp & WHILE(d1_image(redge,_y_temp) GT D_VAL) $ DO redge=redge+1 top = _y_temp & WHILE(d1_image(_x_temp, top) GT D_VAL) $ DO top=top+1 bottom = _y_temp & WHILE(d1_image(_x_temp, bottom) GT D_VAL) $ DO bottom=bottom-1 ledge=ledge+1 redge=redge-1 top=top-1 bottom=bottom+1 XDIAM = redge - ledge YDIAM = top - bottom print, FORMAT='("XDIAM is: ", I)', XDIAM print, FORMAT='("YDIAM is: ", I)', YDIAM SOL_CEN_X = ( (redge - fix(XDIAM/2)) + (ledge + fix(XDIAM/2)) )/2 SOL_CEN_Y = ( (bottom + fix(YDIAM/2)) + (top - fix(YDIAM/2)) )/2 LEV=d1_image(ledge,SOL_CEN_Y) & REV=d1_image(redge,SOL_CEN_Y) TEV=d1_image(SOL_CEN_X,top) & BEV=d1_image(SOL_CEN_X,bottom) print,'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!' print,'Values and locations for the disk edges:' print,FORMAT='("Left Edge = ", I, " Right Edge = ", I)',LEV, REV print,FORMAT='("Left Edge at: ", I, " Right Edge at: ", I)', ledge, redge print,FORMAT='("Top EDGE = ", I, " Bottom Edge = ", I)', TEV, BEV print,FORMAT='("Top Edge at: ", I, " Bottom Edge at: ", I)',top, bottom print,'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!' print,' ' cen_x = SOL_CEN_X & cen_y = SOL_CEN_Y X_RAD = 0 & Y_RAD = 0 while(d1_image(cen_x, cen_y) GT D_VAL) do begin X_RAD = X_RAD + 1 cen_x = cen_x + 1 endwhile cen_x = SOL_CEN_X while(d1_image(cen_x, cen_y) GT D_VAL) do begin Y_RAD = Y_RAD + 1 cen_y = cen_y - 1 endwhile X_RAD = X_RAD - 1 & Y_RAD = Y_RAD - 1 ;; Subtract one to compensate for over counting above print, '********************************************************************' print, FORMAT='("X_RAD = ", I, " Y_RAD = ", I)', X_RAD, Y_RAD print, 'These should be equal!!!!!!!' print, '********************************************************************' if (X_RAD EQ Y_RAD) then SOL_RAD = X_RAD ;;; ALL'S WELL if (X_RAD GT Y_RAD) then begin print, ' ' print, 'Right side is brighter than the bottom' print, ' ' right_mag = d1_image(SOL_CEN_X + X_RAD, SOL_CEN_Y) bottom_mag = d1_image(SOL_CEN_X, SOL_CEN_Y - Y_RAD) print,'FOR NOW, TAKING AN AVERAGE OF THE TWO RADII.....' print,' ' SOL_RAD = (X_RAD + Y_RAD)/2 endif else begin print, 'Bottom is brighter than the right side.' print, ' ' bottom_mag = d1_image(SOL_CEN_X, SOL_CEN_Y - Y_RAD) right_mag = d1_image(SOL_CEN_X + X_RAD, SOL_CEN_Y) SOL_RAD = (Y_RAD + X_RAD)/2 endelse left_mag = d1_image(SOL_CEN_X-X_RAD,SOL_CEN_Y) top_mag = d1_image(SOL_CEN_X,SOL_CEN_Y+Y_RAD) print, FORMAT='("Bottom MAG = ", I, " Right MAG = ", I)', bottom_mag, right_mag print, FORMAT='("Top MAG = ",I, " Left MAG = ", I)',top_mag, left_mag print, ' ' ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Since the point picked was not "exactly" center (XDIAM NE YDIAM) on of the ;; values for the center is "incorrect". Assuming the larger value to be the ;; correct center of the sun properly adjust the other value. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; print, FORMAT='("The solar radius is: ", I)', SOL_RAD print, FORMAT='("The center is at x= ", I ," y= ", I)', sol_cen_x, sol_cen_y print, ' ' end