# state file generated using paraview version 5.13.0 import paraview paraview.compatibility.major = 5 paraview.compatibility.minor = 13 #### import the simple module from the paraview from paraview.simple import * #### disable automatic camera reset on 'Show' paraview.simple._DisableFirstRenderCameraReset() # ---------------------------------------------------------------- # setup views used in the visualization # ---------------------------------------------------------------- # Create a new 'Render View' renderView1 = CreateView('RenderView') renderView1.ViewSize = [432, 733] renderView1.AxesGrid = 'Grid Axes 3D Actor' renderView1.OrientationAxesVisibility = 0 renderView1.CenterOfRotation = [0.7733228206634521, 0.8970721662044525, 4.6205607652664185] renderView1.StereoType = 'Crystal Eyes' renderView1.CameraPosition = [23.272381554100093, -35.17841635119482, 17.0208663979609] renderView1.CameraFocalPoint = [0.7733228206634513, 0.8970721662044528, 4.6205607652664185] renderView1.CameraViewUp = [-0.11869497208863593, 0.2557595945997649, 0.9594261479504517] renderView1.CameraFocalDisk = 1.0 renderView1.CameraParallelScale = 8.00603984662868 renderView1.CameraParallelProjection = 1 renderView1.LegendGrid = 'Legend Grid Actor' renderView1.PolarGrid = 'Polar Grid Actor' renderView1.UseColorPaletteForBackground = 0 renderView1.Background = [1.0, 1.0, 1.0] SetActiveView(None) # ---------------------------------------------------------------- # setup view layouts # ---------------------------------------------------------------- # create new layout object 'Layout #1' layout1 = CreateLayout(name='Layout #1') layout1.AssignView(0, renderView1) layout1.SetSize(432, 733) # ---------------------------------------------------------------- # restore active view SetActiveView(renderView1) # ---------------------------------------------------------------- # ---------------------------------------------------------------- # setup the data processing pipelines # ---------------------------------------------------------------- # create a new 'CSV Reader' atomcsv = CSVReader(registrationName='atom.csv', FileName=['/home/chn/repo/SiC-2nd-paper/画图/拉曼整体图/atom.csv']) # create a new 'CSV Reader' a3csv = CSVReader(registrationName='3.csv', FileName=['/home/chn/repo/SiC-2nd-paper/画图/拉曼整体图/mode/z/3.csv']) # create a new 'Table To Points' atom = TableToPoints(registrationName='atom', Input=atomcsv) atom.XColumn = 'x' atom.YColumn = 'y' atom.ZColumn = 'z' # create a new 'CSV Reader' framecsv = CSVReader(registrationName='frame.csv', FileName=['/home/chn/repo/SiC-2nd-paper/画图/拉曼整体图/frame.csv']) # create a new 'Programmable Filter' frame = ProgrammableFilter(registrationName='frame', Input=framecsv) frame.OutputDataSetType = 'vtkPolyData' frame.Script = """input_data = self.GetInput() # 创建输出数据结构(vtkPolyData) output = self.GetOutput() points = vtk.vtkPoints() lines = vtk.vtkCellArray() # 遍历CSV的每一行(每条线段) for row_idx in range(input_data.GetNumberOfRows()): # 获取起点坐标(假设列名格式) start_x = input_data.GetValueByName(row_idx, "x0").ToDouble() start_y = input_data.GetValueByName(row_idx, "y0").ToDouble() start_z = input_data.GetValueByName(row_idx, "z0").ToDouble() # 获取终点坐标 end_x = input_data.GetValueByName(row_idx, "x1").ToDouble() end_y = input_data.GetValueByName(row_idx, "y1").ToDouble() end_z = input_data.GetValueByName(row_idx, "z1").ToDouble() # 添加点到点集 start_id = points.InsertNextPoint(start_x, start_y, start_z) end_id = points.InsertNextPoint(end_x, end_y, end_z) # 创建线段 line = vtk.vtkLine() line.GetPointIds().SetId(0, start_id) line.GetPointIds().SetId(1, end_id) lines.InsertNextCell(line) # 设置输出数据 output.SetPoints(points) output.SetLines(lines)""" frame.RequestInformationScript = '' frame.RequestUpdateExtentScript = '' frame.PythonPath = '' # create a new 'Table To Points' mode = TableToPoints(registrationName='mode', Input=a3csv) mode.XColumn = 'vx' mode.YColumn = 'vy' mode.ZColumn = 'vz' mode.KeepAllDataArrays = 1 # create a new 'Append Attributes' appendAttributes1 = AppendAttributes(registrationName='AppendAttributes1', Input=[atom, mode]) # create a new 'Calculator' velocity = Calculator(registrationName='velocity', Input=appendAttributes1) velocity.ResultArrayName = 'velocity' velocity.Function = 'iHat*vx + jHat*vy + kHat*vz' # create a new 'Calculator' radius = Calculator(registrationName='radius', Input=velocity) radius.ResultArrayName = 'radius' radius.Function = '(type == 0)*1.18 + (type == 1)*0.77' # create a new 'Glyph' atom_1 = Glyph(registrationName='atom', Input=radius, GlyphType='Sphere') atom_1.OrientationArray = ['POINTS', 'No orientation array'] atom_1.ScaleArray = ['POINTS', 'radius'] atom_1.ScaleFactor = 1.5 atom_1.GlyphTransform = 'Transform2' atom_1.GlyphMode = 'All Points' # init the 'Sphere' selected for 'GlyphType' atom_1.GlyphType.ThetaResolution = 64 atom_1.GlyphType.PhiResolution = 64 # create a new 'Glyph' velocity_1 = Glyph(registrationName='velocity', Input=radius, GlyphType='Arrow') velocity_1.OrientationArray = ['POINTS', 'velocity'] velocity_1.ScaleArray = ['POINTS', 'No scale array'] velocity_1.ScaleFactor = 3.0 velocity_1.GlyphTransform = 'Transform2' velocity_1.GlyphMode = 'All Points' # init the 'Arrow' selected for 'GlyphType' velocity_1.GlyphType.TipResolution = 64 velocity_1.GlyphType.TipRadius = 0.15 velocity_1.GlyphType.TipLength = 0.15 velocity_1.GlyphType.ShaftResolution = 64 velocity_1.GlyphType.ShaftRadius = 0.05 # ---------------------------------------------------------------- # setup the visualization in view 'renderView1' # ---------------------------------------------------------------- # show data from frame frameDisplay = Show(frame, renderView1, 'GeometryRepresentation') # trace defaults for the display properties. frameDisplay.Representation = 'Surface' frameDisplay.AmbientColor = [0.0, 0.0, 0.0] frameDisplay.ColorArrayName = [None, ''] frameDisplay.DiffuseColor = [0.0, 0.0, 0.0] frameDisplay.SelectNormalArray = 'None' frameDisplay.SelectTangentArray = 'None' frameDisplay.SelectTCoordArray = 'None' frameDisplay.TextureTransform = 'Transform2' frameDisplay.OSPRayScaleFunction = 'Piecewise Function' frameDisplay.Assembly = '' frameDisplay.SelectedBlockSelectors = [''] frameDisplay.SelectOrientationVectors = 'None' frameDisplay.ScaleFactor = 1.0126121520996094 frameDisplay.SelectScaleArray = 'None' frameDisplay.GlyphType = 'Arrow' frameDisplay.GlyphTableIndexArray = 'None' frameDisplay.GaussianRadius = 0.05063060760498047 frameDisplay.SetScaleArray = [None, ''] frameDisplay.ScaleTransferFunction = 'Piecewise Function' frameDisplay.OpacityArray = [None, ''] frameDisplay.OpacityTransferFunction = 'Piecewise Function' frameDisplay.DataAxesGrid = 'Grid Axes Representation' frameDisplay.PolarAxes = 'Polar Axes Representation' frameDisplay.SelectInputVectors = [None, ''] frameDisplay.WriteLog = '' # show data from mode modeDisplay = Show(mode, renderView1, 'GeometryRepresentation') # trace defaults for the display properties. modeDisplay.Representation = 'Surface' modeDisplay.ColorArrayName = [None, ''] modeDisplay.SelectNormalArray = 'None' modeDisplay.SelectTangentArray = 'None' modeDisplay.SelectTCoordArray = 'None' modeDisplay.TextureTransform = 'Transform2' modeDisplay.OSPRayScaleArray = 'id' modeDisplay.OSPRayScaleFunction = 'Piecewise Function' modeDisplay.Assembly = '' modeDisplay.SelectedBlockSelectors = [''] modeDisplay.SelectOrientationVectors = 'None' modeDisplay.ScaleFactor = 0.1 modeDisplay.SelectScaleArray = 'None' modeDisplay.GlyphType = 'Arrow' modeDisplay.GlyphTableIndexArray = 'None' modeDisplay.GaussianRadius = 0.005 modeDisplay.SetScaleArray = ['POINTS', 'id'] modeDisplay.ScaleTransferFunction = 'Piecewise Function' modeDisplay.OpacityArray = ['POINTS', 'id'] modeDisplay.OpacityTransferFunction = 'Piecewise Function' modeDisplay.DataAxesGrid = 'Grid Axes Representation' modeDisplay.PolarAxes = 'Polar Axes Representation' modeDisplay.SelectInputVectors = [None, ''] modeDisplay.WriteLog = '' # init the 'Piecewise Function' selected for 'ScaleTransferFunction' modeDisplay.ScaleTransferFunction.Points = [0.0, 0.0, 0.5, 0.0, 7.0, 1.0, 0.5, 0.0] # init the 'Piecewise Function' selected for 'OpacityTransferFunction' modeDisplay.OpacityTransferFunction.Points = [0.0, 0.0, 0.5, 0.0, 7.0, 1.0, 0.5, 0.0] # show data from appendAttributes1 appendAttributes1Display = Show(appendAttributes1, renderView1, 'GeometryRepresentation') # trace defaults for the display properties. appendAttributes1Display.Representation = 'Surface' appendAttributes1Display.ColorArrayName = [None, ''] appendAttributes1Display.SelectNormalArray = 'None' appendAttributes1Display.SelectTangentArray = 'None' appendAttributes1Display.SelectTCoordArray = 'None' appendAttributes1Display.TextureTransform = 'Transform2' appendAttributes1Display.OSPRayScaleArray = 'id' appendAttributes1Display.OSPRayScaleFunction = 'Piecewise Function' appendAttributes1Display.Assembly = '' appendAttributes1Display.SelectedBlockSelectors = [''] appendAttributes1Display.SelectOrientationVectors = 'None' appendAttributes1Display.ScaleFactor = 0.8227903893000001 appendAttributes1Display.SelectScaleArray = 'None' appendAttributes1Display.GlyphType = 'Arrow' appendAttributes1Display.GlyphTableIndexArray = 'None' appendAttributes1Display.GaussianRadius = 0.041139519465 appendAttributes1Display.SetScaleArray = ['POINTS', 'id'] appendAttributes1Display.ScaleTransferFunction = 'Piecewise Function' appendAttributes1Display.OpacityArray = ['POINTS', 'id'] appendAttributes1Display.OpacityTransferFunction = 'Piecewise Function' appendAttributes1Display.DataAxesGrid = 'Grid Axes Representation' appendAttributes1Display.PolarAxes = 'Polar Axes Representation' appendAttributes1Display.SelectInputVectors = [None, ''] appendAttributes1Display.WriteLog = '' # init the 'Piecewise Function' selected for 'ScaleTransferFunction' appendAttributes1Display.ScaleTransferFunction.Points = [0.0, 0.0, 0.5, 0.0, 7.0, 1.0, 0.5, 0.0] # init the 'Piecewise Function' selected for 'OpacityTransferFunction' appendAttributes1Display.OpacityTransferFunction.Points = [0.0, 0.0, 0.5, 0.0, 7.0, 1.0, 0.5, 0.0] # show data from atom_1 atom_1Display = Show(atom_1, renderView1, 'GeometryRepresentation') # get 2D transfer function for 'type' typeTF2D = GetTransferFunction2D('type') # get color transfer function/color map for 'type' typeLUT = GetColorTransferFunction('type') typeLUT.TransferFunction2D = typeTF2D typeLUT.RGBPoints = [0.0, 0.418, 0.68, 0.836, 0.5320334434509277, 0.865, 0.865, 0.865, 1.0, 0.988, 0.73, 0.516] typeLUT.Discretize = 0 typeLUT.ScalarRangeInitialized = 1.0 # trace defaults for the display properties. atom_1Display.Representation = 'Surface' atom_1Display.ColorArrayName = ['POINTS', 'type'] atom_1Display.LookupTable = typeLUT atom_1Display.InterpolateScalarsBeforeMapping = 0 atom_1Display.SelectNormalArray = 'Normals' atom_1Display.SelectTangentArray = 'None' atom_1Display.SelectTCoordArray = 'None' atom_1Display.TextureTransform = 'Transform2' atom_1Display.OSPRayScaleArray = 'Normals' atom_1Display.OSPRayScaleFunction = 'Piecewise Function' atom_1Display.Assembly = '' atom_1Display.SelectedBlockSelectors = [''] atom_1Display.SelectOrientationVectors = 'velocity' atom_1Display.ScaleFactor = 0.9050694227218629 atom_1Display.SelectScaleArray = 'None' atom_1Display.GlyphType = 'Arrow' atom_1Display.GlyphTableIndexArray = 'None' atom_1Display.GaussianRadius = 0.04525347113609314 atom_1Display.SetScaleArray = ['POINTS', 'Normals'] atom_1Display.ScaleTransferFunction = 'Piecewise Function' atom_1Display.OpacityArray = ['POINTS', 'Normals'] atom_1Display.OpacityTransferFunction = 'Piecewise Function' atom_1Display.DataAxesGrid = 'Grid Axes Representation' atom_1Display.PolarAxes = 'Polar Axes Representation' atom_1Display.SelectInputVectors = ['POINTS', 'velocity'] atom_1Display.WriteLog = '' # init the 'Piecewise Function' selected for 'ScaleTransferFunction' atom_1Display.ScaleTransferFunction.Points = [-0.9749279022216797, 0.0, 0.5, 0.0, 0.9749279022216797, 1.0, 0.5, 0.0] # init the 'Piecewise Function' selected for 'OpacityTransferFunction' atom_1Display.OpacityTransferFunction.Points = [-0.9749279022216797, 0.0, 0.5, 0.0, 0.9749279022216797, 1.0, 0.5, 0.0] # show data from velocity_1 velocity_1Display = Show(velocity_1, renderView1, 'GeometryRepresentation') # trace defaults for the display properties. velocity_1Display.Representation = 'Surface' velocity_1Display.AmbientColor = [1.0, 0.0, 0.0] velocity_1Display.ColorArrayName = [None, ''] velocity_1Display.DiffuseColor = [1.0, 0.0, 0.0] velocity_1Display.SelectNormalArray = 'None' velocity_1Display.SelectTangentArray = 'None' velocity_1Display.SelectTCoordArray = 'None' velocity_1Display.TextureTransform = 'Transform2' velocity_1Display.OSPRayScaleArray = 'id' velocity_1Display.OSPRayScaleFunction = 'Piecewise Function' velocity_1Display.Assembly = '' velocity_1Display.SelectedBlockSelectors = [''] velocity_1Display.SelectOrientationVectors = 'velocity' velocity_1Display.ScaleFactor = 0.9050694108009338 velocity_1Display.SelectScaleArray = 'None' velocity_1Display.GlyphType = 'Arrow' velocity_1Display.GlyphTableIndexArray = 'None' velocity_1Display.GaussianRadius = 0.04525347054004669 velocity_1Display.SetScaleArray = ['POINTS', 'id'] velocity_1Display.ScaleTransferFunction = 'Piecewise Function' velocity_1Display.OpacityArray = ['POINTS', 'id'] velocity_1Display.OpacityTransferFunction = 'Piecewise Function' velocity_1Display.DataAxesGrid = 'Grid Axes Representation' velocity_1Display.PolarAxes = 'Polar Axes Representation' velocity_1Display.SelectInputVectors = ['POINTS', 'velocity'] velocity_1Display.WriteLog = '' # init the 'Piecewise Function' selected for 'ScaleTransferFunction' velocity_1Display.ScaleTransferFunction.Points = [0.0, 0.0, 0.5, 0.0, 7.0, 1.0, 0.5, 0.0] # init the 'Piecewise Function' selected for 'OpacityTransferFunction' velocity_1Display.OpacityTransferFunction.Points = [0.0, 0.0, 0.5, 0.0, 7.0, 1.0, 0.5, 0.0] # show data from radius radiusDisplay = Show(radius, renderView1, 'GeometryRepresentation') # trace defaults for the display properties. radiusDisplay.Representation = 'Surface' radiusDisplay.ColorArrayName = ['POINTS', ''] radiusDisplay.SelectNormalArray = 'None' radiusDisplay.SelectTangentArray = 'None' radiusDisplay.SelectTCoordArray = 'None' radiusDisplay.TextureTransform = 'Transform2' radiusDisplay.OSPRayScaleArray = 'radius' radiusDisplay.OSPRayScaleFunction = 'Piecewise Function' radiusDisplay.Assembly = '' radiusDisplay.SelectedBlockSelectors = [''] radiusDisplay.SelectOrientationVectors = 'velocity' radiusDisplay.ScaleFactor = 0.8227903893000001 radiusDisplay.SelectScaleArray = 'radius' radiusDisplay.GlyphType = 'Arrow' radiusDisplay.GlyphTableIndexArray = 'radius' radiusDisplay.GaussianRadius = 0.041139519465 radiusDisplay.SetScaleArray = ['POINTS', 'radius'] radiusDisplay.ScaleTransferFunction = 'Piecewise Function' radiusDisplay.OpacityArray = ['POINTS', 'radius'] radiusDisplay.OpacityTransferFunction = 'Piecewise Function' radiusDisplay.DataAxesGrid = 'Grid Axes Representation' radiusDisplay.PolarAxes = 'Polar Axes Representation' radiusDisplay.SelectInputVectors = ['POINTS', 'velocity'] radiusDisplay.WriteLog = '' # init the 'Piecewise Function' selected for 'ScaleTransferFunction' radiusDisplay.ScaleTransferFunction.Points = [0.2, 0.0, 0.5, 0.0, 0.5, 1.0, 0.5, 0.0] # init the 'Piecewise Function' selected for 'OpacityTransferFunction' radiusDisplay.OpacityTransferFunction.Points = [0.2, 0.0, 0.5, 0.0, 0.5, 1.0, 0.5, 0.0] # setup the color legend parameters for each legend in this view # get color legend/bar for typeLUT in view renderView1 typeLUTColorBar = GetScalarBar(typeLUT, renderView1) typeLUTColorBar.WindowLocation = 'Any Location' typeLUTColorBar.Position = [0.8195679796696314, 0.07503410641200547] typeLUTColorBar.Title = 'type' typeLUTColorBar.ComponentTitle = '' # set color bar visibility typeLUTColorBar.Visibility = 0 # get 2D transfer function for 'radius' radiusTF2D = GetTransferFunction2D('radius') # get color transfer function/color map for 'radius' radiusLUT = GetColorTransferFunction('radius') radiusLUT.TransferFunction2D = radiusTF2D radiusLUT.RGBPoints = [0.2, 0.231373, 0.298039, 0.752941, 1.0999999999999999, 0.865003, 0.865003, 0.865003, 2.0, 0.705882, 0.0156863, 0.14902] radiusLUT.ScalarRangeInitialized = 1.0 # get color legend/bar for radiusLUT in view renderView1 radiusLUTColorBar = GetScalarBar(radiusLUT, renderView1) radiusLUTColorBar.WindowLocation = 'Upper Right Corner' radiusLUTColorBar.Position = [0.8526048284625158, 0.6534788540245566] radiusLUTColorBar.Title = 'radius' radiusLUTColorBar.ComponentTitle = '' # set color bar visibility radiusLUTColorBar.Visibility = 0 # get 2D transfer function for 'Separate_17226_type' separate_17226_typeTF2D = GetTransferFunction2D('Separate_17226_type') # get separate color transfer function/color map for 'type' separate_atom_1Display_typeLUT = GetColorTransferFunction('type', atom_1Display, separate=True) separate_atom_1Display_typeLUT.TransferFunction2D = separate_17226_typeTF2D separate_atom_1Display_typeLUT.ScalarRangeInitialized = 1.0 # get color legend/bar for separate_atom_1Display_typeLUT in view renderView1 separate_atom_1Display_typeLUTColorBar = GetScalarBar(separate_atom_1Display_typeLUT, renderView1) separate_atom_1Display_typeLUTColorBar.Title = 'type' separate_atom_1Display_typeLUTColorBar.ComponentTitle = '' # set color bar visibility separate_atom_1Display_typeLUTColorBar.Visibility = 0 # ---------------------------------------------------------------- # setup color maps and opacity maps used in the visualization # note: the Get..() functions create a new object, if needed # ---------------------------------------------------------------- # get opacity transfer function/opacity map for 'type' typePWF = GetOpacityTransferFunction('type') typePWF.ScalarRangeInitialized = 1 # get separate opacity transfer function/opacity map for 'type' separate_atom_1Display_typePWF = GetOpacityTransferFunction('type', atom_1Display, separate=True) separate_atom_1Display_typePWF.ScalarRangeInitialized = 1 # get opacity transfer function/opacity map for 'radius' radiusPWF = GetOpacityTransferFunction('radius') radiusPWF.Points = [0.2, 0.0, 0.5, 0.0, 2.0, 1.0, 0.5, 0.0] radiusPWF.ScalarRangeInitialized = 1 # ---------------------------------------------------------------- # setup animation scene, tracks and keyframes # note: the Get..() functions create a new object, if needed # ---------------------------------------------------------------- # get the time-keeper timeKeeper1 = GetTimeKeeper() # initialize the timekeeper timeKeeper1.SuppressedTimeSources = framecsv # get time animation track timeAnimationCue1 = GetTimeTrack() # initialize the animation track # get animation scene animationScene1 = GetAnimationScene() # initialize the animation scene animationScene1.ViewModules = renderView1 animationScene1.Cues = timeAnimationCue1 animationScene1.AnimationTime = 0.0 # initialize the animation scene # ---------------------------------------------------------------- # restore active source SetActiveSource(frame) # ---------------------------------------------------------------- ##-------------------------------------------- ## You may need to add some code at the end of this python script depending on your usage, eg: # ## Render all views to see them appears # RenderAllViews() # ## Interact with the view, usefull when running from pvpython # Interact() # ## Save a screenshot of the active view # SaveScreenshot("path/to/screenshot.png") # ## Save a screenshot of a layout (multiple splitted view) # SaveScreenshot("path/to/screenshot.png", GetLayout()) # ## Save all "Extractors" from the pipeline browser # SaveExtracts() # ## Save a animation of the current active view # SaveAnimation() # ## Please refer to the documentation of paraview.simple ## https://www.paraview.org/paraview-docs/latest/python/paraview.simple.html ##--------------------------------------------