pro im_con_tog, array1a, array2a, x_arg, y_arg, follow=follow, $ xstyle=xstyle, ystyle=ystyle, subtitle=subtitle, $ nlevels=nlevels, c_color=c_color,color=color,xticklen=xticklen, $ yticklen=yticklen,xmargin=xmargin,ymargin=ymargin,title=title, $ xtitle=xtitle,ytitle=ytitle,c_linestyle=c_linestyle,thick=thick,c_thick=c_thick, $ levels=levels,noerase=noerase,background=background,scale=scale, $ charsize=charsize, position=position, xticks=xticks, yticks=yticks, $ xtickformat=xtickformat, ytickformat=ytickformat, $ xtickname=xtickname, ytickname=ytickname, c_charsize=c_charsize, $ c_annotation = c_annotation,xgridstyle=xgridstyle,ygridstyle=ygridstyle, $ xminor = xminor, yminor = yminor, sample = sample, $ fit_window = fit_window, resize = resize, xtickv = xtickv, ytickv = ytickv ;+ ; NAME: ; IM_CON_TOG ; ; PURPOSE: ; Displays simultaneously two 2-dimensional arrays, one in brightness ; representation, and another is shown by contours (IMage and CONtour TOGether) ; ; If the dimensions of one array larger than those of another array, then ; the arrays are intended to have the same center, and subarrays with the ; same dimensions are displayed. ; ; CATEGORY: ; General graphics. ; ; CALLING SEQUENCE: ; ; IM_CON_TOG, Image1, Image2 [, X_arg, Y_arg] ; ; INPUTS: ; Image1: Array to be displayed in brightness representation. ; Image2: Array to be displayed by contours. ; These arrays may be of any type. ; ; OPTIONAL INPUT PARAMETERS: ; X_arg: Argument along X axis. If supplied, then Y_arg must be supplied also. ; The dimensions of X_arg, Y_arg must correspond to the dimensions of ; the smallest array of Image1 and Image2. Usage of the IM_CON_TOG ; routine is similar to that of the CONTOUR routine. ; ; Y_arg: Argument along Y axis. If supplied, then X_arg must be supplied also. ; The dimensions of X_arg, Y_arg must correspond to the dimensions of ; the smallest array of Image1 and Image2. ; ; KEYWORD PARAMETERS: ; ; Scale: If set and is zero, then the array Image1 is displayed as is, without scaling ; of brigthness (TV). Otherwise (by default), scaling is performed (TVSCL). ; ; Sample: If set and nonzero, then the array Image1 is resized without interpolation. ; Usage of this keyword parameter is the same as for the REBIN routine. ; ; Resize: Scalar integer or floating-point number specifying the number of pixels ; to resize the Image1 when output to PostScript is performed. By default, ; the Image1 is not resized if its least dimension exceed 500, otherwise ; its dimensions are resized in such a way that the least dimension becomes 500. ; This enhances the quality of the image in the printout. ; ; If many images are sent to the PostScript file, then its size can become huge ; when all of them are resized in such a way. To prevent this, set Resize to a ; less value. ; ; Fit_window: If set and nonzero, then the plotting region fits displayable area similar to ; setting xmargin = [0,0] and ymargin = [0,0] ; ; ; Usage of the remainder keyword parameters is the same as for the CONTOUR routine. ; ; OUTPUTS: ; None. ; ; COMMON BLOCKS: ; None. ; ; SIDE EFFECTS: ; Both arrays are displayed on the current graphics device. ; ; RESTRICTIONS: ; If either of supplied, then both X_arg and Y_arg must present. ; The dimensions of X_arg, Y_arg must correspond to the dimensions of the smallest ; array of Image1 and Image2. ; ; The images always fit the displayable region of the graphics device, and the aspect ratio ; is not maintained. ; ; PROCEDURE: ; TV(SCL) + CONGRID are used for one array, and CONTOUR for the ; other array. In case of PostScript device, pixels of the Image1 are ; scaled, instead of use the CONGRID routine. ; ; ; MODIFICATION HISTORY: ; ; ISTP SD RAS, Dec, 1996. ; Victor Grechnev (grechnev@iszf.irk.ru): ; Initially written. ; ; ISTP SD RAS, Jan, 2000. ; Victor Grechnev (grechnev@iszf.irk.ru): ; Keywords C_ANNOTATION and SAMPLE are added. ; ; UMD, 2001. ; Vladimir Garaimov (gvi@astro.umd.edu): ; Resizing of the Image1 is added when output to PostScript file is performed. ; Processing of arrays with different dimensions is added. ; ;- Sz=size(array1a) Sz2=size(array2a) nx_arg=n_elements(x_arg) ny_arg=n_elements(y_arg) Np=n_params() if (Np lt 2) or (Np eq 3) or (Np gt 4) $ then message, 'Incorrect number of arguments' if Sz(0) ne 2 then message, 'Input arguments must be 2d arrays' if (Sz(0) ne Sz2(0)) then message, 'Arrays are incompatible' if (Sz(1) mod 2 - Sz2(1) mod 2) ne 0 then message, 'Use ROT for correction on 0.5 point' if (Sz(1) ne Sz2(1)) or (Sz(2) ne Sz2(2)) then begin if Sz(1) gt Sz2(1) then begin array2=array2a xo=(Sz(1)-1)/2. - (Sz2(1)-1)/2. yo=(Sz(2)-1)/2. - (Sz2(2)-1)/2. array1=array1a(xo:(xo+(Sz2(1)-1)),yo:(yo+Sz2(2)-1)) if nx_arg ne 0 and nx_arg eq Sz(1) then begin x_arg_s=x_arg x_arg=x_arg(xo:(xo+(Sz2(1)-1))) end if ny_arg ne 0 and ny_arg eq Sz(2) then begin y_arg_s=y_arg y_arg=y_arg(yo:(yo+(Sz2(2)-1))) end endif else begin array1=array1a xo=(Sz2(1)-1)/2. - (Sz(1)-1)/2. yo=(Sz2(2)-1)/2. - (Sz(2)-1)/2. array2=array2a(xo:(xo+(Sz(1)-1)),yo:(yo+Sz(2)-1)) if nx_arg ne 0 and nx_arg eq Sz2(1) then begin x_arg_s=x_arg x_arg=x_arg(xo:(xo+(Sz(1)-1))) end if ny_arg ne 0 and ny_arg eq Sz2(2) then begin y_arg_s=y_arg y_arg=y_arg(yo:(yo+(Sz(2)-1))) end end Sz=size(array1) Sz2=size(array2) endif else begin array1=array1a array2=array2a end if Np eq 4 then begin if ((Size(x_arg))(1) ne Sz(1)) or ((Size(y_arg))(1) ne Sz(2)) then $ message, 'Arguments are incompatible' endif if nx_arg le 0 then x_arg=findgen(Sz(1)) if ny_arg le 0 then y_arg=findgen(Sz(2)) if n_elements(follow) le 0 then follow=0 if n_elements(xstyle) le 0 then xstyle=!x.style if n_elements(ystyle) le 0 then ystyle=!y.style if n_elements(nlevels) le 0 then nlevels=6 if n_elements(c_color) le 0 then c_color=!P.color if n_elements(color) le 0 then color=!P.color if n_elements(xticklen) le 0 then xticklen=!x.ticklen if n_elements(yticklen) le 0 then yticklen=!y.ticklen if n_elements(xmargin) le 0 then xmargin=!x.margin if n_elements(ymargin) le 0 then ymargin=!y.margin if n_elements(ytitle) le 0 then ytitle=!y.title if n_elements(xtitle) le 0 then xtitle=!x.title if n_elements(subtitle) le 0 then subtitle=!p.subtitle if n_elements(title) le 0 then title=!p.title if n_elements(c_linestyle) le 0 then c_linestyle=!P.linestyle if n_elements(thick) le 0 then thick=!p.thick if n_elements(c_thick) le 0 then c_thick=!p.thick if n_elements(noerase) le 0 then noerase=!p.noerase if n_elements(background) le 0 then background=!p.background if n_elements(scale) le 0 then scale=1 if n_elements(charsize) le 0 then charsize=!P.charsize if n_elements(xticks) le 0 then xticks=!x.ticks if n_elements(yticks) le 0 then yticks=!y.ticks if n_elements(xtickv) le 0 then xtickv=!x.tickv if n_elements(ytickv) le 0 then ytickv=!y.tickv if n_elements(xtickformat) le 0 then xtickformat=!x.tickformat if n_elements(ytickformat) le 0 then ytickformat=!y.tickformat if n_elements(xtickname) le 0 then xtickname=!x.tickname if n_elements(ytickname) le 0 then ytickname=!y.tickname if n_elements(c_charsize) le 0 then c_charsize=!p.charsize if n_elements(c_annotation) le 0 then begin c_annotation=string(replicate('20'xb,1,30)) c_charsize=1e-6 end if n_elements(xgridstyle) le 0 then xgridstyle=0 if n_elements(ygridstyle) le 0 then ygridstyle=0 if n_elements(xminor) le 0 then xminor=!x.minor if n_elements(yminor) le 0 then yminor=!y.minor int = 1-(keyword_set(sample)) SzN = Sz(1:2) if max(SzN/500.) lt 1 or n_elements(resize) gt 0 then begin if n_elements(resize) le 0 then resize = 500. if SzN(0) gt SzN(1) then SzN = SzN*float(resize(0))/SzN(0) else SzN = SzN*float(resize(0))/SzN(1) endif if keyword_set(fit_window) then begin xmargin = [0,0] ymargin = [0,0] endif Pmsave=!P.multi if n_elements(position) le 0 then $ plot, x_arg, y_arg, xst=5,yst=5,/nodata,xmargin=xmargin,ymargin=ymargin, $ noerase=noerase,charsize=charsize, xticks=xticks, yticks=yticks, $ xtickformat=xtickformat, ytickformat=ytickformat, $ xtickname=xtickname, ytickname=ytickname, $ xgridstyle=xgridstyle,ygridstyle=ygridstyle, xtickv = xtickv, ytickv = ytickv else $ plot, x_arg, y_arg, xst=5,yst=5,/nodata,xmargin=xmargin,ymargin=ymargin, $ noerase=noerase,charsize=charsize, position=position, xticks=xticks, $ yticks=yticks, xtickformat=xtickformat, ytickformat=ytickformat, $ xtickname=xtickname, ytickname=ytickname,xgridstyle=xgridstyle, $ ygridstyle=ygridstyle, xtickv = xtickv, ytickv = ytickv Pmsave1=!P.multi !P.multi=Pmsave if scale then begin if !d.name ne 'PS' then $ ;!! tvscl, congrid(array1, !d.x_size*(!x.window(1)-!x.window(0)), $ !d.y_size*(!y.window(1)-!y.window(0)),int=int,/minus),$ !d.x_size*!x.window(0),!d.y_size*!y.window(0) else $ tvscl, congrid(array1, SzN(0), SzN(1), int = int), $ xsize=!d.x_size*(!x.window(1)-!x.window(0)), $ ysize=!d.y_size*(!y.window(1)-!y.window(0)), $, !d.x_size*!x.window(0),!d.y_size*!y.window(0),/dev endif else begin if !d.name ne 'PS' then $ ;!! tv, congrid(array1, !d.x_size*(!x.window(1)-!x.window(0)), $ !d.y_size*(!y.window(1)-!y.window(0)), int=int, /minus),$ !d.x_size*!x.window(0),!d.y_size*!y.window(0) else $ tv, congrid(array1, SzN(0), SzN(1), int = int), $ xsize=!d.x_size*(!x.window(1)-!x.window(0)), $ ysize=!d.y_size*(!y.window(1)-!y.window(0)), $, !d.x_size*!x.window(0),!d.y_size*!y.window(0),/dev endelse IF n_elements(position) le 0 then begin if n_elements(levels) le 0 then $ contour, array2, x_arg, y_arg, xst=(1 or xstyle), yst=(1 or ystyle), $ /noerase, follow=follow, subtitle=subtitle, $ nlevels=nlevels,c_color=c_color,color=color,xticklen=xticklen, $ yticklen=yticklen,xmargin=xmargin,ymargin=ymargin,title=title, $ xtitle=xtitle,ytitle=ytitle,c_linestyle=c_linestyle,thick=thick,c_thick=c_thick, $ background=background,charsize=charsize, xticks=xticks, yticks=yticks, $ xtickformat=xtickformat, ytickformat=ytickformat, $ xtickname=xtickname, ytickname=ytickname, c_charsize=c_charsize, $ c_annotation = c_annotation,xgridstyle=xgridstyle,ygridstyle=ygridstyle, $ xminor = xminor, yminor = yminor, xtickv = xtickv, ytickv = ytickv $ else contour, array2, x_arg, y_arg, xst=(1 or xstyle), yst=(1 or ystyle), $ /noerase,follow=follow, subtitle=subtitle, $ nlevels=nlevels,c_color=c_color,color=color,xticklen=xticklen, $ yticklen=yticklen,xmargin=xmargin,ymargin=ymargin,title=title, $ xtitle=xtitle,ytitle=ytitle,c_linestyle=c_linestyle,thick=thick,c_thick=c_thick, $ levels=levels,background=background,charsize=charsize, xticks=xticks, $ yticks=yticks, xtickformat=xtickformat, ytickformat=ytickformat, $ xtickname=xtickname, ytickname=ytickname, c_charsize=c_charsize, $ c_annotation = c_annotation,xgridstyle=xgridstyle,ygridstyle=ygridstyle, $ xminor = xminor, yminor = yminor, xtickv = xtickv, ytickv = ytickv endif else begin if n_elements(levels) le 0 then $ contour, array2, x_arg, y_arg, xst=(1 or xstyle), yst=(1 or ystyle), $ /noerase,follow=follow, subtitle=subtitle, $ nlevels=nlevels,c_color=c_color,color=color,xticklen=xticklen, $ yticklen=yticklen,xmargin=xmargin,ymargin=ymargin,title=title, $ xtitle=xtitle,ytitle=ytitle,c_linestyle=c_linestyle,thick=thick,c_thick=c_thick, $ background=background,charsize=charsize, position=position, $ xticks=xticks, yticks=yticks, xtickformat=xtickformat, ytickformat=ytickformat, $ xtickname=xtickname, ytickname=ytickname, c_charsize=c_charsize, $ c_annotation = c_annotation,xgridstyle=xgridstyle,ygridstyle=ygridstyle, $ xminor = xminor, yminor = yminor, xtickv = xtickv, ytickv = ytickv $ else contour, array2, x_arg, y_arg, xst=(1 or xstyle), yst=(1 or ystyle), $ /noerase,follow=follow, subtitle=subtitle, $ nlevels=nlevels,c_color=c_color,color=color,xticklen=xticklen, $ yticklen=yticklen,xmargin=xmargin,ymargin=ymargin,title=title, $ xtitle=xtitle,ytitle=ytitle,c_linestyle=c_linestyle,thick=thick,c_thick=c_thick, $ levels=levels,background=background,charsize=charsize, position=position, $ xticks=xticks, yticks=yticks, xtickformat=xtickformat, ytickformat=ytickformat, $ xtickname=xtickname, ytickname=ytickname, c_charsize=c_charsize, $ c_annotation = c_annotation,xgridstyle=xgridstyle,ygridstyle=ygridstyle, $ xminor = xminor, yminor = yminor, xtickv = xtickv, ytickv = ytickv endelse !P.multi=Pmsave1 if n_elements(x_arg_s) ne 0 then x_arg=x_arg_s if n_elements(y_arg_s) ne 0 then y_arg=y_arg_s end