;+ ; ; NAME: ; CPSCAN ; ; ; PURPOSE: ; Plot a radial or azmuthal scan. ; ; ; CATEGORY: ; CP display ; ; ; CALLING SEQUENCE: ; CPSCANS, RULECONDITION=RULECONDITION, ONERSUN=ONERSUN, $ ; RCUR=RCUR, TCLICK=TCLICK, XCENTER=XCENTER, YCENTER=YCENTER, $ ; ROLL=ROLL, MULTI_PLOT=MULTI_PLOT, SIN_MOV=SIN_MOV, $ ; RADIALMAX=RADIALMAX, LINECOL=LINECOL ; ; ; CALLED BY: ; CPCURSOR ; ; ; CALLS TO: ; WINUP ; ; INPUTS: ; RULECONDITION : 3 means plot radial scan ; 4 means plot azmuthal scan ; ONERSUN : the sun's radius in pixels ; RCUR : the radius of click in pixels ; TCLICK : the theta of click in radians ; XCENTER : the x-axis coordinate of sun center ; YCENTER : the y-axis coordinate of sun center ; ROLL : solar north in degrees from "+x" axis ; MULTI_PLOT : the current plot number ; SIN_MOV : 0 means current display mode is for single images ; 1 means current display mode is for movies ; RADIALMAX : the largest radial extent for this image ; LINECOL : color table index used for plot ; ; ; OPTIONAL INPUTS: ; none ; ; OUTPUTS: ; none explicit, only through commons ; ; OPTIONAL OUTPUTS: ; none ; ; COMMON BLOCKS: ; CPLASTPASS to assing value to scan arrays ; CPWIDGBASES for the widget IDs of the informational windows ; ; SIDE EFFECTS: ; none ; ; RESTRICTIONS: ; none ; ; PROCEDURE: ; Draw radial or azmuthal line on image and save underlying values. ; ; MODIFICATION HISTORY: ; APR 93 - Elaine Einfalt (HSTX) ; ;- pro cpscans, rulecondition=rulecondition, onersun=onersun, $ rcur=rcur, tclick=tclick, xcenter=xcenter, ycenter=ycenter, $ roll=roll, multi_plot=multi_plot, sin_mov=sin_mov, $ radialmax=radialmax, linecol=linecol @cplastpass.common @cpwidgbases.common ; ; RULECONDITION 3 : Plot radial scan from 1 solar radii out to cursor. ; RULECONDITION 4 : Plot azmuthal scan at radius of cursor click. ; ; ; Determine loop values. ; case rulecondition of 3 : begin from = 0. ; suncenter (float) to = radialmax ; a maximum Rsun (in pixels) by_step = onersun /100. ; 100th of radii in pixels end 4 : begin ; from = 0. ; just do a full circle in radians ; to = 2. * !pi + from ; and won't plot the nonexistant ones from = roll * !dtor ; just do a full circle, radians ; starting at solar north to = 2. * !pi + from ; and won't plot the nonexistant ones ; ; Find angular step size so we get every pixel ; along the solar radii that was clicked. ; circum_r = (rcur/onersun) *961* (2*!pi) ; cicumference at ; cursor click ; in arcseconds num_pixels_r = circum_r / 12.7 ; # of pixel along this ; circumference ; 12.7 arcsec = pixel by_step = (2. * !pi ) / num_pixels_r ; angle to increment ; at radius (radians) end else: step = 0 endcase ; ; This is the loop to find the data array pixel coordinates for every ; pixel along the line (for rulecondition 3) or the arc (for ; rulecondition 4). ; cnt = -1 for i = from, to, by_step do begin ; ; For rulecondition 3, "I" is the Rsun value at each coordinate ; For rulecondition 4, "I" is the theta in degrees at coordinate ; case rulecondition of 3 : begin xpixel = float (xcenter + i * cos(tclick)) ypixel = float (ycenter + i * sin(tclick)) end 4 : begin xpixel = float (xcenter + rcur * cos(i)) ypixel = float (ycenter + rcur * sin(i)) end else : endcase ; ; Only want the visible coordinates. Remember all the plotting ; takes place in a 360 degree polar coordinate system and a ; radial maximum that is off the screen. ; if (xpixel ge 0) and (xpixel lt 448) and $ (ypixel ge 0) and (ypixel lt 448) $ then begin ; ; Draw a mark at each coordinate used in the scan. ; case rulecondition of 3 : oplot, [i,i], $ ; radii in pixels [tclick, tclick], $ ; theta in radians /polar, psym=3, color=!p.color-1 4 : oplot, [rcur, rcur], $ ; radii in pixels [i, i], $ ; theta in radians /polar, psym=3, color=!p.color-1 else : endcase cnt = cnt + 1 ; another valid value ; ; Save each Rsun or theta and their intensity value. ; Use CPDATA from the common block CPLASTPASS.PRO in order to ; get data values that have not been scaled to the color table. ; cpabscissa(cnt, multi_plot) = i cpintensity(cnt, multi_plot) = cpdata(xpixel,ypixel) endif endfor if cnt ge 1 then begin ; need 2 valid points for plot ; ; The independent value of this data array coordinate pair ; needs to be converted to output plot units. ; Rulecondition 3: convert from pixels to Rsun ; Rulecondition 4: convert from radians to degrees and correct roll ; case rulecondition of 3 : cpabscissa(0:cnt, multi_plot) = $ cpabscissa(0:cnt, multi_plot) / onersun 4 : begin cpabscissa(0:cnt, multi_plot) = $ cpabscissa(0:cnt, multi_plot) / !dtor - roll ; make value 0 to 359 degrees shiftneg = where(cpabscissa(0:cnt, multi_plot) lt 0) if shiftneg(0) ne -1 then cpabscissa(shiftneg, multi_plot) = $ cpabscissa(shiftneg, multi_plot) + 360 ; ; make values gt 180 into negative values ; shiftneg = where(cpabscissa(0:cnt, multi_plot) gt 180) ; if shiftneg(0) ne -1 then cpabscissa(shiftneg, multi_plot) = $ ; cpabscissa(shiftneg, multi_plot) - 360 end else : endcase cpnum_vals_n_scans(multi_plot) = cnt ; this many values endif else begin expl = 'Must have at least two valid data points.' if not(sin_mov) then widget_control, comment, set_value=expl,/append $ else widget_control, news, set_value=expl, /append endelse return end