# We want to iterate over X-slices. We'll need this expression for the
# data binning operator
DefineScalarExpression("X", "coord(Mesh)[0]")
# Set up a function to create a curve using the DataBinning operator.
# The reduction operator is an argument to the function.
def MakeCurve(operator):
AddPlot("Curve", "operators/DataBinning/1D/Mesh")
db = DataBinningAttributes()
db.numDimensions = db.One
db.dim1Var = "X"
db.reductionOperator = operator
db.varForReduction = "hardyglobal"
SetOperatorOptions(db)
DrawPlots()
def MakeSumCurve():
MakeCurve(DataBinningAttributes().Sum)
def MakeStdDevCurve():
MakeCurve(DataBinningAttributes().StandardDeviation)
# A function to create a slice Pseudocolor plot.
def AddSlicedPseudocolor():
AddPlot("Pseudocolor", "hardyglobal")
pc = PseudocolorAttributes()
pc.colorTableName = "bluehot"
SetPlotOptions(pc)
AddOperator("Slice")
DrawPlots()
# Tell VisIt there should be 4 total windows.
SetWindowLayout(4)
# Set up window #1
SetActiveWindow(1)
DeleteAllPlots()
AddSlicedPseudocolor()
# Set up window #2
SetActiveWindow(2)
DeleteAllPlots()
AddSlicedPseudocolor()
legend_name = GetAnnotationObjectNames()[0]
legend = GetAnnotationObject(legend_name)
legend.managePosition = 0
legend.position = (0.7, 0.95)
legend.orientation = legend.HorizontalBottom
legend.controlTicks = 0
legend.numTicks = 2
legend.suppliedValues = (2,5)
legend.suppliedLabels = ("cold", "hot")
legend.drawLabels = legend.Labels
legend.drawTitle = 0
legend.drawMinMax = 0
legend.fontHeight = 0.06
v = GetView3D()
v.viewNormal = (1,1,1)
SetView3D(v)
# Set up window #3
SetActiveWindow(3)
DeleteAllPlots()
MakeSumCurve()
# Set up window #4
SetActiveWindow(4)
DeleteAllPlots()
MakeStdDevCurve()
# Disable unpretty annotations for all windows
for i in range(1,5):
SetActiveWindow(i)
a = GetAnnotationAttributes()
a.axes2D.xAxis.title.visible = 0
a.axes2D.yAxis.title.visible = 0
a.axes3D.xAxis.title.visible = 0
a.axes3D.yAxis.title.visible = 0
a.axes3D.zAxis.title.visible = 0
a.databaseInfoFlag = 0
a.userInfoFlag = 0
SetAnnotationAttributes(a)
# Zoom in on the curve plots
for i in range(3,5):
SetActiveWindow(i)
v = GetViewCurve()
v.viewportCoords = (0.1, 0.95, 0.05, 0.95)
SetViewCurve(v)
# Zoom in on the 2D plot
SetActiveWindow(1)
v = GetView2D()
v.viewportCoords = (0.1, 0.95, 0.05, 0.95)
v.windowCoords = (-10,10,-10,10)
SetView2D(v)
# Turn off legend for window 1 pseudocolor plot
pc = PseudocolorAttributes(1)
pc.legendFlag = 0
SetPlotOptions(pc)
# Set up a border between window 1 and the others
l = CreateAnnotationObject("Line2D")
l.position = (1, 0)
l.position2 = (1, 1)
l.width = 3
# More borders and text annotation for smaller windows
SetActiveWindow(3)
l = CreateAnnotationObject("Line2D")
l.position = (0, 1)
l.position2 = (1, 1)
l.width = 3
t = CreateAnnotationObject("Text2D")
t.width = 0.5
t.text = "Average"
t.position = (0.12, 0.8)
SetActiveWindow(4)
l = CreateAnnotationObject("Line2D")
l.position = (0, 1)
l.position2 = (1, 1)
l.width = 3
t = CreateAnnotationObject("Text2D")
t.width = 0.4
t.text = "StdDev"
t.position = (0.12, 0.8)
# Set up the layout of the windows
sw = SaveWindowAttributes()
sw.advancedMultiWindowSave = 1
sw.resConstraint = sw.NoConstraint
sw.width = 1024
sw.height = 768
sw.subWindowAtts.win1.position = (0,0)
sw.subWindowAtts.win1.size = (768,768)
sw.subWindowAtts.win2.position = (768,512)
sw.subWindowAtts.win2.size = (256,256)
sw.subWindowAtts.win3.position = (768,256)
sw.subWindowAtts.win3.size = (256,256)
sw.subWindowAtts.win4.position = (768,0)
sw.subWindowAtts.win4.size = (256,256)
# Iterate over 50 cross sections
nsteps=50
for i in range(nsteps):
# Choose the x position
x=-10.0+20.0*i/(nsteps-1.0)
# set the slice position for the two sliced pseudocolor plots
s = SliceAttributes()
s.axisType = s.XAxis
s.originType = s.Intercept
s.originIntercept = x
SetActiveWindow(1)
SetOperatorOptions(s)
SetActiveWindow(2)
s.project2d = 0
SetOperatorOptions(s)
# set the cue for the curves
c = CurveAttributes()
c.doLineTimeCue = 1
c.timeForTimeCue = x
c.showLegend = 0
c.showLabels = 0
c.curveColor = (0, 0, 0, 255)
c.lineTimeCueColor = (255, 0, 0, 255)
SetActiveWindow(3)
SetPlotOptions(c)
SetActiveWindow(4)
SetPlotOptions(c)
# set up the image name and save
sw.family = 0
sw.fileName = "movie%03d" %(i)
SetSaveWindowAttributes(sw)
SaveWindow()