Contour Spectrum
The following python script will calculate the contour spectrum of a data set. Call it with:
visit -cli -o myfile.silo -s generate.py > output.curve
This script has parameters at the top you should fill in -- the minimum and maximum range to calculate the spectrum over, the number of steps in that range, a variable name, and a boolean flag whether to calculate the surface are for the spectrum or a raw triangle count.
lower=1
upper=6
steps=20
var="hardyglobal"
usearea=True
for i in range(steps):
alpha = i / (steps-1.0)
value = lower + alpha*(upper-lower)
DeleteAllPlots()
AddPlot("Contour", var)
c=ContourAttributes()
c.contourValue=(value)
c.contourMethod=c.Value
SetPlotOptions(c)
DrawPlots()
SetQueryFloatFormat("%g")
if usearea:
Query("3D surface area")
else:
Query("NumZones", use_actual_data=1)
result = GetQueryOutputValue()
if not result:
result = 0
print value, result
import sys
sys.exit()