Accessing lineout data

You may use the GetPlotInformation() function in VisIt's CLI to access data from a Curve plot. GetPlotInformation returns a dictionary and each plot type returns different key/value pairs of data that make sense for the plot. Most plots don't yet return any data but Curve and Volume do. You will need to make the Curve plot active using SetActivePlots() or the results of GetPlotInformation will be empty. For Curve plots, the dictionary returned by GetPlotInformation contains one entry called "Curve" that contains a tuple of x,y,x,y,x,y,... values that comprise the curve.

xy = GetPlotInformation()

Example

Sometimes you'll want to extract the sampled x,y values in addition to the sampled variable. This can be achieved by telling VisIt to also sample the x and y values from the coordinates using expressions. The following example extracts the sampled x, y, and variable values and prints them as a set of triples.

# Change these parameters
DB = "/usr/gapps/visit/data/noise.silo"
Mesh = "Mesh"
Var = "hardyglobal"
p0 = (-10,-10,-10)
p1 = (10, 10, 10)

#########################################################################

OpenDatabase(DB)
AddPlot("Pseudocolor", Var)
DrawPlots()
DefineScalarExpression("xc", "coord(%s)[0]" % Mesh)
DefineScalarExpression("yc", "coord(%s)[1]" % Mesh)
DefineScalarExpression("zc", "coord(%s)[2]" % Mesh)

# Do a lineout on all 4 variables to produce 4 curves.
Lineout(p0, p1, ("default", "xc", "yc", "zc"))

# Get the data
SetActiveWindow(2)
SetActivePlots(0)
vals = GetPlotInformation()["Curve"]
SetActivePlots(1)
xc = GetPlotInformation()["Curve"]
SetActivePlots(2)
yc = GetPlotInformation()["Curve"]
SetActivePlots(3)
zc = GetPlotInformation()["Curve"]

# Write it as "x y z val"
for i in range(len(vals) / 2):
    idx = i*2+1
    print "%g %g %g %g" % (xc[idx], yc[idx], zc[idx], vals[idx])

Output:

-9.79592 -9.79592 -9.79592 2.12651
-9.38776 -9.38776 -9.38776 2.21382
-8.97959 -8.97959 -8.97959 2.3091
-8.57143 -8.57143 -8.57143 2.41422
-8.16327 -8.16327 -8.16327 2.53024
-7.7551 -7.7551 -7.7551 2.65624
-7.34694 -7.34694 -7.34694 2.7897
-6.93878 -6.93878 -6.93878 2.92723
-6.53061 -6.53061 -6.53061 3.06409
-6.12245 -6.12245 -6.12245 3.19271
-5.71429 -5.71429 -5.71429 3.3009
-5.30612 -5.30612 -5.30612 3.37191
-4.89796 -4.89796 -4.89796 3.39291
-4.4898 -4.4898 -4.4898 3.37773
-4.08163 -4.08163 -4.08163 3.36329
-3.67347 -3.67347 -3.67347 3.34131
-3.26531 -3.26531 -3.26531 3.26412
-2.85714 -2.85714 -2.85714 3.10379
-2.44898 -2.44898 -2.44898 2.88095
-2.04082 -2.04082 -2.04082 2.68191
-1.63265 -1.63265 -1.63265 2.63275
-1.22449 -1.22449 -1.22449 2.76836
-0.816326 -0.816326 -0.816326 2.99018
-0.408163 -0.408163 -0.408163 3.20463
0 0 0 3.37884
0.408163 0.408163 0.408163 3.51158
0.816326 0.816326 0.816326 3.60979
1.22449 1.22449 1.22449 3.68051
1.63265 1.63265 1.63265 3.72927
2.04082 2.04082 2.04082 3.76073
2.44898 2.44898 2.44898 3.78059
2.85714 2.85714 2.85714 3.79879
3.26531 3.26531 3.26531 3.82944
3.67347 3.67347 3.67347 3.87762
4.08163 4.08163 4.08163 3.92348
4.4898 4.4898 4.4898 3.93296
4.89796 4.89796 4.89796 3.88185
5.30612 5.30612 5.30612 3.77066
5.71429 5.71429 5.71429 3.62785
6.12245 6.12245 6.12245 3.48688
6.53061 6.53061 6.53061 3.35531
6.93878 6.93878 6.93878 3.2196
7.34694 7.34694 7.34694 3.07073
7.7551 7.7551 7.7551 2.91386
8.16327 8.16327 8.16327 2.75945
8.57143 8.57143 8.57143 2.61483
8.97959 8.97959 8.97959 2.4828
9.38776 9.38776 9.38776 2.36341
9.79592 9.79592 9.79592 2.25556