; docformat = 'rst' ; ; NAME: ; plotAperture2D ; PURPOSE: ; Plot parameter variations from multiAperture2D for source characterization. ;+ ; :Description: ; Plot parameter variations from multiAperture2D for source characterization. ; ; :Categories: ; Images ; ; :Params: ; param: in, required, type=structure ; The peak parameters, from multiAperture2D. Fields are: ; .id: Parameter simple identifyer ; .name: Name of the parameter ; .unit: Unit of the parameter ; .val: An array of N values, one per aperture ; .mean: Average value for N apertures ; .dev: Standard deviation for N apertures ; label: in, required, type=string ; Parameter ID. Possible values are:: ; radius base peak sigx sigy xc yc tilt EE RMS ; ; :Keywords: ; select: in, optional, type=intarr ; Indices of selected value (see selectAperture2d). ; ; :Examples: ; ; :Uses: ; ; :Author: ; B.Carry (OCA) ; ; :History: ; Change History:: ; Written in April 2015, B. Carry (IMCCE) ; 2017 Nov. - B. Carry (OCA) - Added charsize, idl2 option ;- pro plotAperture2D, param, label, select=select, overplot=overplot, symSize=symSize, $ position=position, normal=normal, device=device, noerase=noerase, $ xTitle=xTitle, yTitle=yTitle, axescolor=axescolor, verbose=verbose, $ charSize=charSize COMPILE_OPT hidden, idl2 ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- I -- Initialization And Input Verification -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--I.1-- Check Input Parameters --------------------------------------------------------------; if not keyword_set(param) or not keyword_set(label) then begin message, 'Syntax: plotAperture2d, param, label' return endif ;--I.2-- Peak Model: Gauss or Moffat ---------------------------------------------------------; nbParam = n_elements( param ) nbMPF = nbParam - 3 ;--I.3-- Parameter Indices -------------------------------------------------------------------; indRad = getAperture2d( param, 'radius', /index ) indPar = 1+indgen(nbMPF) indEE = getAperture2d( param, 'EE', /index ) indRMS = getAperture2d( param, 'RMS', /index ) ;--I.4-- Data Unit Definition ----------------------------------------------------------------; if not keyword_set(normal) and not keyword_set(device) then device=1 if keyword_set(normal) and keyword_set(device) then normal=1 ;--I.5-- Look'n'Feel -------------------------------------------------------------------------; if not keyword_set(axescolor) then axescolor='black' if not keyword_set(symsize) then symsize =1 if not keyword_set(charSize) then charSize =1 ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- II -- Define Plot Parameters -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--II.1-- Determine Parameter Index ----------------------------------------------------------; case strLowCase(strTrim(label,2)) of 'radius': kPar = indRad 'base' : kPar = indPar[0] 'peak' : kPar = indPar[1] 'sigx' : kPar = indPar[2] 'sigy' : kPar = indPar[3] 'xc' : kPar = indPar[4] 'yc' : kPar = indPar[5] 'tilt' : kPar = indPar[6] 'index' : kPar = indPar[7] 'ee' : kPar = indEE 'rms' : kPar = indRMS else: endcase ;--II.2-- Determine X/Y Range ----------------------------------------------------------------; ;--II.2.1-- Parameter Ranges minX = min(param[indRad].val) maxX = max(param[indRad].val) lenX = maxX-minX xRang = [minX, maxX + 0.15*lenX] yRang = param[kPar].mean + param[kPar].dev*[-4,4] ;--II.2.2-- Axes Label if not keyword_set(xTitle) then xTitle= param[indRad].name if not keyword_set(yTitle) then yTitle= param[kPar].name if strCmp(xTitle,' ') then xName = replicate(' ',25) if strCmp(yTitle,' ') then yName = replicate(' ',25) ;--II.3-- Quartiles Look'n'Feel --------------------------------------------------------------; boxX = [-1,1,1,-1,-1]* 0.015*lenX xBox = xRang[0]+ 0.05*lenX ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- III -- Plot Functions -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--III.1-- Simple Plot -----------------------------------------------------------------------; ;--III.1.1-- Second Plot: Overlay if keyword_set(OverPlot) then begin cgPlot, param[indRad].val, param[kPar].val, color=param[kPar].color, /OverPlot ;--III.1.2-- First Plot endif else begin ;--III.1.2/A-- Position Provided if keyword_set(position) then begin cgPlot, param[indRad].val, param[kPar].val, color=param[kPar].color, $ xStyle=1, xRange=xRang, xTitle=xTitle, xMinor=4,$ yStyle=1, yRange=yRang, yTitle=yTitle, yMinor=4, $ xTickName=xName, xTickformat=param[indRad].format, $ yTickName=yName, yTickFormat=param[kPar].format, $ normal=keyword_set(normal), device=keyword_set(device), $ position=position, NoErase=keyword_seT(noerase), $ axescolor=axescolor, charSize=charSize ;--III.1.2/B-- Position Free endif else begin cgPlot, param[indRad].val, param[kPar].val, color=param[kPar].color, $ xStyle=1, xRange=xRang, xTitle=xTitle, xMinor=4, $ yStyle=1, yRange=yRang, yTitle=yTitle, yMinor=4, $ xTickName=xName, xTickFormat=param[indRad].format, $ yTickName=yName, yTickFormat=param[kPar].format, $ axescolor=axescolor, charSize=charSize endelse endelse ;--III.2-- Overlay Selection if Provided -----------------------------------------------------; if keyword_set(select) then $ cgPlot, /OverPlot, param[indRad].val[select], param[kPar].val[select], $ psym=param[kPar].sym, color=param[kPar].color, symsize=symsize ;--III.3-- Overlay Parameter Statitics -------------------------------------------------------; ;--III.3.1-- Average, Min & Max cgPlot, /OverPlot, xRang, [0,0] + param[kPar].mean, color=param[kPar].color cgPlot, /OverPlot, xRang, [0,0] + param[kPar].mean+param[kPar].dev, color=param[kPar].color, linestyle=2 cgPlot, /OverPlot, xRang, [0,0] + param[kPar].mean-param[kPar].dev, color=param[kPar].color, linestyle=2 ;--III.3.2-- Quartiles cgErrPlot, xBox, param[kPar].box[0], param[kPar].box[4], width=0.05, thick=2 cgPlot, xBox+boxX, [param[kPar].box[1],param[kPar].box[1],param[kPar].box[3],param[kPar].box[3],param[kPar].box[1]], color='Black', /OverPlot, thick=4 cgColorFill, xBox+boxX, [param[kPar].box[1],param[kPar].box[1],param[kPar].box[2],param[kPar].box[2],param[kPar].box[1]], /Data cgColorFill, xBox+boxX, [param[kPar].box[2],param[kPar].box[2],param[kPar].box[3],param[kPar].box[3],param[kPar].box[2]], /Data cgPlot, xBox+boxX[0:1], [param[kPar].box[2],param[kPar].box[2]], /OverPlot, thick=2 ;--III.3.3-- Values if keyword_set(verbose) then begin cgText, maxX+0.01*lenX, param[kPar].mean, strTrim(string(param[kPar].mean,format='(F15.3)'),2), color=param[kPar].color cgText, minX+0.08*lenX, param[kPar].box[2], strTrim(string(param[kPar].box[2],format='(F15.3)'),2), color=param[kPar].color endif end