Beispiel #1
0
 def isosurfacePlot(self, stay=False, samples=100, contours=50):
     visit.AddWindow()
     returned = []
     if len(visit.ListPlots()) > 0:
         visit.SetActivePlots(0)
         visit.HideActivePlots()
     p = visit.PseudocolorAttributes()
     q = visit.ResampleAttributes()
     r = visit.IsosurfaceAttributes()
     q.samplesX = samples
     q.samplesY = samples
     q.samplesZ = samples
     r.contourNLevels = contours
     plot = visit.AddPlot("Pseudocolor", "Heat")
     visit.AddOperator("Resample")
     # visit.AddOperator("Isosurface")
     visit.SetOperatorOptions(q)
     visit.SetOperatorOptions(r)
     visit.SetPlotOptions(p)
     visit.DrawPlots()
     returned.append(visit.SaveWindow())
     count = 0
     visit.AddOperator("Isosurface")
     visit.DrawPlots()
     time.sleep(60)
     returned.append(visit.SaveWindow())
     return returned
Beispiel #2
0
def plane_slice_plotting(window_number, axis_number, label, images, timestamp):
    """
    Copy the Mesh, Pseudocolor, and Contour plots into a new VisIt window and
    slice through the proper axis.

    Input:
    ______
      window_number: int
          The number of the window to open (2,3, or 4).
      axis_number: int
          The number of the axis to slice through (0 for X, 1 for Y, 2 for Z).
      label: str
          The title of the plane slice.
      images: boolean
          Whether or not to save images of the plot windows.
      timestamp: boolean
          Whether or not to keep the timestamp on plot window images.

    Returns:
    ________
      none
    """

    # Open a new window with all three plots.
    Vi.AddWindow()
    Vi.CopyPlotsToWindow(1, window_number)

    # Create the plane slice plot by activating the mesh, pseudocolor, and contour plots.
    Vi.SetActiveWindow(window_number)
    Vi.SetActivePlots((0, 1, 2))

    # Remove the clip and slice operators from previous plot windows.
    Vi.RemoveAllOperators()

    # Add a slice through the proper axis.
    Vi.AddOperator("Slice", 1)
    s = Vi.SliceAttributes()
    s.axisType = axis_number
    Vi.SetOperatorOptions(s)

    # Include a label for each plane slice plot.
    banner = Vi.CreateAnnotationObject("Text2D")
    banner.position = (0.45, 0.92)
    banner.text = label
    banner.height = 0.05

    # Include the CNERG logo in the bottom left corner of the plot.
    image = Vi.CreateAnnotationObject("Image")
    image.image = os.path.dirname(os.path.abspath(__file__)) + "/cnerg.jpg"
    image.position = (0.02, 0.02)
    image.width = 10
    image.height = 10

    Vi.DrawPlots()
    if images:
        if timestamp:
            attributes = Vi.GetAnnotationAttributes()
            attributes.userInfoFlag = 0
            Vi.SetAnnotationAttributes(attributes)
        Vi.SaveWindow()
Beispiel #3
0
    def addWindow(self):
        """Adds a window to VisIt and makes it active"""
        if len(self.windows) != 0:
            v.AddWindow()

        win = VisItWindow(len(self.windows)+1)
        self.windows.append(win)
        self.setActiveWindow(len(self.windows))
        v.ToggleLockTime()
Beispiel #4
0
 def pseudocolorPlot(self):
     visit.AddWindow()
     returned = []
     if len(visit.ListPlots()) > 0:
         visit.SetActivePlots(0)
         visit.HideActivePlots()
     p = visit.PseudocolorAttributes()
     plot = visit.AddPlot("Pseudocolor", "Heat")
     visit.SetPlotOptions(p)
     visit.DrawPlots()
     return visit.SaveWindow()
Beispiel #5
0
 def register_window(cls, win):
     if len(cls.registered_windows()) > 0:
         # visit will always have one valid window
         # when more than one Window instance is registered
         # we need to add an addtional window.
         visit.AddWindow()
     # get active window id from global atts
     gatts = visit.GetGlobalAttributes()
     rid = gatts.windows[gatts.activeWindow]
     visit.SetActiveWindow(rid)
     cls.__windows[rid] = win
     return rid
Beispiel #6
0
def TimeSeriesS1():
    visit.AddPlot('Curve', 's1')
    visit.AddPlot('Curve', 's2')
    visit.DrawPlots()
    visit.AddWindow()
    visit.AddPlot('Curve', 'pAverage')
    visit.DrawPlots()
    visit.SetActiveWindow(1)
    AnnotationAtts = visit.AnnotationAttributes()
    AnnotationAtts.axes2D.yAxis.grid = 1
    AnnotationAtts.axes2D.xAxis.grid = 1
    AnnotationAtts.axes2D.xAxis.title.userTitle = 1
    AnnotationAtts.axes2D.xAxis.title.userUnits = 1
    AnnotationAtts.axes2D.xAxis.title.title = "Position along the machine s"
    AnnotationAtts.axes2D.xAxis.title.units = "m"
    visit.SetAnnotationAttributes(AnnotationAtts)
    visit.DrawPlots()
Beispiel #7
0
def PhaseSpace(x1, x2, dumpNo):
    visit.AddWindow()
    ScatAttrs = visit.ScatterAttributes()
    ScatAttrs.var1 = x1
    ScatAttrs.var2 = x2
    #   ScatAttrs.var1Role = visit.ScatterAtts.Coordinate0
    #   ScatAttrs.var2Role = visit.ScatterAtts.Coordinate1
    #   ScatAttrs.var3Role = visit.ScatterAtts.None
    #   ScatAttsr.var4Role = visit.ScatterAtts.None
    ScatAttrs.SetVar1Role(0)  #coord 0
    ScatAttrs.SetVar2Role(1)  #coord 1
    ScatAttrs.SetVar3Role(4)  #none
    ScatAttrs.SetVar4Role(4)  #none
    ScatAttrs.scaleCube = 0
    visit.AddPlot('Scatter', x1, 1, 1)
    visit.SetPlotOptions(ScatAttrs)
    visit.SetTimeSliderState(dumpNo)
    visit.DrawPlots()
Beispiel #8
0
    def updateVisIt(self, inputPorts):
        global viswin
        global viswinmapper
        global availWindows
        global VisItLaunched

        if VisItLaunched == False:
            LaunchVisIt()
            VisItLaunched = True

        (self.cdms_var,self.location,self.params) = inputPorts

        windowkey = self.getKey()
        windowid  = 0

        if self.view is None:
            a = set(viswin.GetRenderWindowIDs())
            if len(availWindows) > 0:
                (self.view,windowid) = availWindows[0]
                availWindows = availWindows[1:]
            else:
                a = set(viswin.GetRenderWindowIDs())
                visit.AddWindow()
                b = set(viswin.GetRenderWindowIDs())
                res = tuple(b - a)
                windowid = res[0]
                self.view = viswin.GetRenderWindow(windowid)  

            self.layout.addWidget(self.view)
            self.view.show()
            viswinmapper[windowkey] = windowid

        if "Pseudocolor" in self.params.renderType :
            self.LoadPseudocolorPlot()

        if "Contour" in self.params.renderType :
            self.LoadContourPlot()

        if "Extreme Value Analysis" in self.params.renderType :
            self.LoadExtremeValueAnalysisPlot()

        QCellWidget.updateContents(self, inputPorts)
Beispiel #9
0
 def scatterPlot(self,
                 coords=["var00", "var01", "var02", "var03"],
                 colorTable="hot",
                 pixelSize=5,
                 stay=False):
     visit.AddWindow()
     if len(visit.ListPlots()) > 0:
         visit.SetActivePlots(0)
         visit.HideActivePlots()
     plot = visit.AddPlot("Scatter", coords[0])
     p = visit.ScatterAttributes()
     # Variables
     if coords[1]:
         p.var2 = coords[1]
     if coords[2]:
         p.var3 = coords[2]
     if coords[3]:
         p.var4 = coords[3]
     #Role Variable Roles take intergers as inputs, not strings
     p.var1Role = 0
     p.var2Role = 1
     p.var3Role = 2
     p.var4Role = 3
     p.scaleCube = 0
     #p.colorType = "ColorByColorTable"
     p.pointSizePixels = pixelSize
     p.colorTableName = colorTable
     #p.colorScaling = "Log"
     v = visit.GetView3D()
     v.viewNormal = (-0.571619, 0.405393, 0.713378)
     v.viewUp = (0.308049, 0.911853, -0.271346)
     visit.SetPlotOptions(p)
     visit.SetView3D(v)
     visit.DrawPlots()
     count = 0
     time.sleep(5)
     return visit.SaveWindow()
Beispiel #10
0
#  visit.SetViewAxisArray(ViewAxisArrayAtts)

visit.Launch(vdir=localVisItDir)

# if runRemotely:
#   p2=SetupPhase2()
# #  data2=visit.OpenDatabase(remoteTimeSeriesAstraDB,0,'Vs')
#   data2=visit.OpenDatabase(remoteTimeSeriesEleSigmaDB,0,'Vs')
#
# else:
#   data=visit.OpenDatabase(localPowerAllDB,0,'Vs')

plotEnergyLinear.plotEnergyLinear(localPowerAllDB)

visit.AddWindow()
plotEnergy.plotEnergy(localPowerAllDB)

visit.AddWindow()
plotPowNorm.plotPowNorm(localPowerAllDB)

visit.AddWindow()
binPhase.binPhase(eDB)

visit.AddWindow()
bunching()

visit.AddWindow()
current()
visit.SetWindowLayout(6)
#TimeSeriesS1()
Beispiel #11
0
def MultipleWindows(Files, OperatorSet=None, Windows=False, SliceProject=1):
    """
    Attain multiple windows for different applied operators.
    Data other than mesh are plotted individually as well.
    """

    if Windows is False:
        It.Iterator(Files, OperatorSet)

    if Windows is True:
        Pa.PathCreator()  # Creates necessary folders.

        Count = 1

        # Load the plots without operators.
        for item in Files:
            Vi.SetActiveWindow(Count)  # Select window to be worked in.
            Image = Mk.MakeImages([item])
            Image.Plot()
            Image.Save()
            Vi.ToggleLockViewMode()  # Lock the view perspective.
            Vi.AddWindow()  # Add another window for next iteration.
            Count += 1

        try:
            # Display plots with operators if defined.
            for item in OperatorSet:
                Vi.SetActiveWindow(Count)  # Select window to be worked in.
                It.Iterator(Files, [item], SliceProject=0)
                Vi.DrawPlots()  # Draw plots with operator.
                Wi.WindowSettings()
                Vi.ToggleLockViewMode()  # Lock the view perspective.
                Vi.AddWindow()  # Add another window for next iteration.
                Count += 1

        except Exception:
            pass

        # Last window is always empty.
        Vi.SetActiveWindow(Count)
        Vi.DeleteWindow()  # Delete last window.

        # Compensate for odd number of windows.
        if (Count - 1) < 2:
            Vi.SetWindowLayout(1)
        elif (Count - 1) == 2:
            Vi.SetWindowLayout(2)
        elif 2 < (Count - 1) <= 4:
            Vi.SetWindowLayout(4)
        elif 4 < (Count - 1) <= 6:
            Vi.SetWindowLayout(6)
        elif 6 < (Count - 1) <= 8:
            Vi.SetWindowLayout(8)
        elif (Count - 1) == 9:
            Vi.SetWindowLayout(9)
        elif 9 > (Count - 1) <= 16:
            print "Too many windows to view nicely."
        else:
            print "Too many windows for ViSit to Support."

        # Alternate saving scheme for multiple windows is used.
        i = 0
        while os.path.exists("../Sessions/XML_Original/sampleMulti%s.session" %
                             i):
            i += 1

        Vi.SaveSession("../Sessions/XML_Original/sampleMulti%s.session" % i)
Beispiel #12
0
 def resamplePlot(self):
     visit.AddWindow()