Saving Min Max and Average values over time

Revision as of 17:57, 24 August 2009 by BradWhitlock (talk | contribs) (category)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This function saves a plot's minimum, maximum, and average values over time to curve files that can be read in by VisIt.

def SaveMinMaxAvgCurves(minname, maxname, avgname):
     minfile = open(minname, "wt")
     maxfile = open(maxname, "wt")
     avgfile = open(avgname, "wt")
     w = GetWindowInformation()
     cts = w.timeSliderCurrentStates[w.activeTimeSlider]
     for i in range(TimeSliderGetNStates()):
         SetTimeSliderState(i)
         Query("Time")
         t = GetQueryOutputValue()
         Query("MinMax")
         minfile.write("%g %g\n" % (t, GetQueryOutputValue()[0]))
         maxfile.write("%g %g\n" % (t, GetQueryOutputValue()[1]))
         Query("Variable Sum")
         sum = GetQueryOutputValue()
         Query("NumZones")
         nzones = GetQueryOutputValue()
         avgfile.write("%g %g\n" % (t, sum/nzones))
     minfile.close()
     maxfile.close()
     avgfile.close()
     SetTimeSliderState(cts)

SaveMinMaxAvgCurves("min.curve", "max.curve", "avg.curve")