TUgridCut TCL UTILITIES USER MANUAL TUdgridCut
SYNOPSIS
Returns the intensities along a cut through a data grid.
PACKAGE
TCLUTILS
NAME
TUgridCut
USAGE
TUgridCut  Grid gInfo X1 Y1 X2 Y2 nP X Y V {Expand} {Inc}
INPUT DEFINITIONS
Grid - The data grid.
gInfo - The grid information array.
X1, Y1 - The x,y end point of one end of the cut line.
X2, Y2 - The x,y end point of the opposite end of the cut line.
nP - The number of points along the cut line at which to return the grid intensity. This value may be superceded if >Inc is greater than 0.
X - The output array of X values at which the grid intensities are returned.
Y - The output array of Y values at which the grid intensities are returned
V - The output array of grid intensities for each specified (X,Y) value on the line.
Expand - An optional input value which if 1 (the default setting) clips or expands the cut line at or to the grid boundaries. If not 1 the line is processed as specified.
Inc - An optional input value. If -1 (the default setting) the procedure uses the number of input points specified in nP to compute the step size between data values on the line. If larger than 0.0 then this value is taken as the step size to use when determining grid values along the line. In the latter case the number of points along the cut becomes the number of points at which the grid intensity was determined.
RETURN DEFINITION
Returns the array length of X,Y,V
DESCRIPTION
TUgridCut returns the intensity along a cut through a 2D data grid at nP evenly spaced points. The (X,Y,V) at each point along the cut are returned in the arrays X, Y, and Z. The grid should be one which was built using the TUdataGrid procedure. Both the Grid and the grid information array (gInfo) are passed into the procedure. The cut line is specified by supplying both its end points. These do not necessarily need to lie on the grid edges. The default is for the procedure to either truncate or expand the cut so that it terminates at the grid edges. This can be overridden by setting Expand to 0. The distance between the locations at which the grid intensity is determined along the cut can be set manually through Inc rather than let it be determined from the number of points input nP. In this case the output array sizes should be determined by the procedure return value which gives the returned array sizes.
ERRORS
None Generated
C BACKING
Yes
EXAMPLE(S)
EXAMPLE 1: Cut through a grid.
# SET up a synthetic data set or two separated Gaussians.

set nP 0
for { set X -6.0 } { $X <= 6.0 } { set X [expr $X + .1] } {
   for { set Y -6.0 } { $Y <= 6.0 } { set Y [expr $Y + .1] } {
       set Yy($nP) $Y
       set Xx($nP) $X
       set rA [expr ($X - 3.0) * ($X - 3.0) + $Yy($nP) * $Yy($nP)]
       set rB [expr ($X + 3.0) * ($X + 3.0) + $Yy($nP) * $Yy($nP)]
       set Vv($nP) [expr 2.0 * exp(-$rA / 8.0) + 1.5 * exp(-$rB / 8.0)]
       incr nP
   }
}

# SET up the grid information array. 

set gInfo(0) -6.0
set gInfo(1) 6.0
set gInfo(2) -6.0
set gInfo(3) 6.0
set gInfo(4) 100
set gInfo(5) 100
set gInfo(6) POINT
set gInfo(7) POINT
set gInfo(8) COLUMN
set gInfo(9) IGNORE
set gInfo(10) NEW:ADD:END
set gInfo(11) -1
set gInfo(12) -5
set gInfo(13) -1.0e30
set gInfo(14)  1.0e30
set gInfo(15)  NO
set gInfo(16)  NO

# GRID the data

TUdataGrid $nP 1 Xx Xx 1 Yy Yy Vv Grid Norm gInfo

# START up the plotting basics.  Define an upper an lower plot

set GphInfo(xScrL) 500
set GphInfo(yScrL) 800

GraphicsOn TK ETones SWAP

GenWindow 1 0.0 0.0 0.0 1.0 1.0 0.0  0. 0. 0. 1. 1. 0. XY
set WinInfo(8,corFmt) 1
RelWindow 8 1 75.0 375.0 0. 475. 775. 0. -6. -6. 0. 6. 6. 0.
DefinePlot 8 8 $gInfo(4) $gInfo(5)
set WinInfo(9,corFmt) 1
RelWindow 9 1 75.0 75.0 0. 475. 275. 0. -6. 0. 0. 6. 2. 0.
DefinePlot 9 9 -1 -1

# SET up the color mapping

PLTcolorMap 0.0 2.0 LINEAR 0 cA

# PLOT the grid in the upper plot

Plot3D 8 Xb Yb Dummy Dummy Grid AUTO Dummy cA
PlotOutlines 8 [list "X" 1.0 "Y" 1.0] [list BOT BOT BOTH BOTH]

# MAKE a horizontal cut through the grid at Y = 0.0.  Show the cut
#   in black (white will be black since we reversed black and white in the
#   GraphOn call) through the grid and plot the intensity along the cut
#   in the lower plot.

set nE [expr [TUgridCut Grid gInfo -6.0 0.0 6.0 0.0 500 Xc Yc Vc] - 1]
PlotColor HOLD $GphInfo(White) OFF
Line 8 -6.0 0.0 0.0 6.0 0.0 0.0
Plot2D 9 Xb Yb Xc Vc 0 $nE  LINE [list $GphInfo(White) NONE]

# MAKE a vertical cut through the grid at X = -3.0.  Show the cut
#   in red through the grid and plot the intensity in red along the cut
#   in the lower plot.  Line plot used Y values since X will be constant.

set nE [expr [TUgridCut Grid gInfo -3.0 -6.0 -3.0 6.0 500 Xc Yc Vc] - 1]
PlotColor HOLD $GphInfo(Red) OFF
Line 8 -3.0 -6.0 0.0 -3.0 6.0 0.0
Plot2D 9 Xb Yb Yc Vc 0 $nE  LINE [list $GphInfo(Red) NONE]

# MAKE a vertical cut through the grid at X = 0.0.  Show the cut
#   in green through the grid and plot the intensity in green along the cut
#   in the lower plot.

set nE [expr [TUgridCut Grid gInfo 0.0 -6.0 0.0 6.0 500 Xc Yc Vc] - 1]
PlotColor HOLD $GphInfo(Green) OFF
Line 8 0.0 -6.0 0.0 0.0 6.0 0.0
Plot2D 9 Xb Yb Yc Vc 0 $nE  LINE [list $GphInfo(Green) NONE]

# MAKE a vertical cut through the grid at X = 3.0.  Show the cut
#   in cyan through the grid and plot the intensity in cyan along the cut
#   in the lower plot.

set nE [expr [TUgridCut Grid gInfo 3.0 -6.0 3.0 6.0 500 Xc Yc Vc] - 1]
PlotColor HOLD $GphInfo(Cyan) OFF
Line 8 3.0 -6.0 0.0 3.0 6.0 0.0
Plot2D 9 Xb Yb Yc Vc 0 $nE  LINE [list $GphInfo(Cyan) NONE]

PlotOutlines 9 [list "X or Y" 1.0 "V" 1.0] [list BOT BOT BOTH BOTH]
update
      
Sept 20, 2006