第一版的原子运动图像

This commit is contained in:
2025-04-09 17:53:21 +08:00
parent b3d4a0ae22
commit 44623daf8d
22 changed files with 11842 additions and 11364 deletions

View File

@@ -0,0 +1,483 @@
#!/usr/bin/env pvpython
# 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()
# copy from view.py
def export(mode_id):
# ----------------------------------------------------------------
# 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.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'
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 'CSV Reader'
a3csv = CSVReader(registrationName=f'{mode_id}.csv', FileName=[f'/home/chn/repo/SiC-2nd-paper/画图/拉曼整体图/mode/z/{mode_id}.csv'])
# 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 'CSV Reader'
atomcsv = CSVReader(registrationName='atom.csv', FileName=['/home/chn/repo/SiC-2nd-paper/画图/拉曼整体图/atom.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 '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'
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
# 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
# ----------------------------------------------------------------
# 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 '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
# 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 'type'
typePWF = GetOpacityTransferFunction('type')
typePWF.ScalarRangeInitialized = 1
# ----------------------------------------------------------------
# setup animation scene, tracks and keyframes
# note: the Get..() functions create a new object, if needed
# ----------------------------------------------------------------
# get time animation track
timeAnimationCue1 = GetTimeTrack()
# initialize the animation scene
# get the time-keeper
timeKeeper1 = GetTimeKeeper()
# initialize the timekeeper
timeKeeper1.SuppressedTimeSources = framecsv
# initialize the animation track
# get animation scene
animationScene1 = GetAnimationScene()
# initialize the animation scene
animationScene1.ViewModules = renderView1
animationScene1.Cues = timeAnimationCue1
animationScene1.AnimationTime = 0.0
# ----------------------------------------------------------------
# restore active source
SetActiveSource(a3csv)
# ----------------------------------------------------------------
# ImageResolution=[1920, 1080]
SaveScreenshot(f'mode/z/{mode_id}.png', TransparentBackground=True)
for i in [*range(3, 9), *range(11, 21), 23]:
export(i)

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

File diff suppressed because it is too large Load Diff

View File

@@ -14,23 +14,20 @@ paraview.simple._DisableFirstRenderCameraReset()
# Create a new 'Render View' # Create a new 'Render View'
renderView1 = CreateView('RenderView') renderView1 = CreateView('RenderView')
renderView1.ViewSize = [787, 733] renderView1.ViewSize = [432, 733]
renderView1.AxesGrid = 'Grid Axes 3D Actor' renderView1.AxesGrid = 'Grid Axes 3D Actor'
renderView1.CenterOfRotation = [0.7733229100704193, 0.8929564654827118, 6.010610222816467] renderView1.CenterOfRotation = [0.7733228206634521, 0.8970721662044525, 4.6205607652664185]
renderView1.StereoType = 'Crystal Eyes' renderView1.StereoType = 'Crystal Eyes'
renderView1.CameraPosition = [18.504536090763168, 6.686416267346643, 4.1835417898422005] renderView1.CameraPosition = [23.272381554100093, -35.17841635119482, 17.0208663979609]
renderView1.CameraFocalPoint = [0.7733229100704198, 0.8929564654827146, 6.010610222816473] renderView1.CameraFocalPoint = [0.7733228206634513, 0.8970721662044528, 4.6205607652664185]
renderView1.CameraViewUp = [0.09322747842486345, 0.028536938063048908, 0.9952357913743494] renderView1.CameraViewUp = [-0.11869497208863593, 0.2557595945997649, 0.9594261479504517]
renderView1.CameraFocalDisk = 1.0 renderView1.CameraFocalDisk = 1.0
renderView1.CameraParallelScale = 12.582330587837445 renderView1.CameraParallelScale = 8.00603984662868
renderView1.CameraParallelProjection = 1 renderView1.CameraParallelProjection = 1
renderView1.LegendGrid = 'Legend Grid Actor' renderView1.LegendGrid = 'Legend Grid Actor'
renderView1.PolarGrid = 'Polar Grid Actor' renderView1.PolarGrid = 'Polar Grid Actor'
renderView1.UseColorPaletteForBackground = 0
# Create a new 'SpreadSheet View' renderView1.Background = [1.0, 1.0, 1.0]
spreadSheetView1 = CreateView('SpreadSheetView')
spreadSheetView1.ColumnToSort = ''
spreadSheetView1.BlockSize = 1024
SetActiveView(None) SetActiveView(None)
@@ -41,12 +38,7 @@ SetActiveView(None)
# create new layout object 'Layout #1' # create new layout object 'Layout #1'
layout1 = CreateLayout(name='Layout #1') layout1 = CreateLayout(name='Layout #1')
layout1.AssignView(0, renderView1) layout1.AssignView(0, renderView1)
layout1.SetSize(787, 733) layout1.SetSize(432, 733)
# create new layout object 'Layout #2'
layout2 = CreateLayout(name='Layout #2')
layout2.AssignView(0, spreadSheetView1)
layout2.SetSize(400, 400)
# ---------------------------------------------------------------- # ----------------------------------------------------------------
# restore active view # restore active view
@@ -57,18 +49,6 @@ SetActiveView(renderView1)
# setup the data processing pipelines # 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'
a0csv = CSVReader(registrationName='0.csv', FileName=['/home/chn/repo/SiC-2nd-paper/画图/拉曼整体图/mode/0.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' # create a new 'CSV Reader'
framecsv = CSVReader(registrationName='frame.csv', FileName=['/home/chn/repo/SiC-2nd-paper/画图/拉曼整体图/frame.csv']) framecsv = CSVReader(registrationName='frame.csv', FileName=['/home/chn/repo/SiC-2nd-paper/画图/拉曼整体图/frame.csv'])
@@ -111,13 +91,25 @@ frame.RequestInformationScript = ''
frame.RequestUpdateExtentScript = '' frame.RequestUpdateExtentScript = ''
frame.PythonPath = '' frame.PythonPath = ''
# 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' # create a new 'Table To Points'
mode = TableToPoints(registrationName='mode', Input=a0csv) mode = TableToPoints(registrationName='mode', Input=a3csv)
mode.XColumn = 'vx' mode.XColumn = 'vx'
mode.YColumn = 'vy' mode.YColumn = 'vy'
mode.ZColumn = 'vz' mode.ZColumn = 'vz'
mode.KeepAllDataArrays = 1 mode.KeepAllDataArrays = 1
# create a new 'CSV Reader'
atomcsv = CSVReader(registrationName='atom.csv', FileName=['/home/chn/repo/SiC-2nd-paper/画图/拉曼整体图/atom.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 'Append Attributes' # create a new 'Append Attributes'
appendAttributes1 = AppendAttributes(registrationName='AppendAttributes1', Input=[atom, mode]) appendAttributes1 = AppendAttributes(registrationName='AppendAttributes1', Input=[atom, mode])
@@ -131,11 +123,28 @@ radius = Calculator(registrationName='radius', Input=velocity)
radius.ResultArrayName = 'radius' radius.ResultArrayName = 'radius'
radius.Function = '(type == 0)*1.18 + (type == 1)*0.77' radius.Function = '(type == 0)*1.18 + (type == 1)*0.77'
# 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
# create a new 'Glyph' # create a new 'Glyph'
atom_1 = Glyph(registrationName='atom', Input=radius, atom_1 = Glyph(registrationName='atom', Input=radius,
GlyphType='Sphere') GlyphType='Sphere')
atom_1.OrientationArray = ['POINTS', 'No orientation array'] atom_1.OrientationArray = ['POINTS', 'No orientation array']
atom_1.ScaleArray = ['POINTS', 'radius'] atom_1.ScaleArray = ['POINTS', 'radius']
atom_1.ScaleFactor = 1.5
atom_1.GlyphTransform = 'Transform2' atom_1.GlyphTransform = 'Transform2'
atom_1.GlyphMode = 'All Points' atom_1.GlyphMode = 'All Points'
@@ -143,21 +152,6 @@ atom_1.GlyphMode = 'All Points'
atom_1.GlyphType.ThetaResolution = 64 atom_1.GlyphType.ThetaResolution = 64
atom_1.GlyphType.PhiResolution = 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 = 1.5
velocity_1.GlyphTransform = 'Transform2'
velocity_1.GlyphMode = 'All Points'
# init the 'Arrow' selected for 'GlyphType'
velocity_1.GlyphType.TipResolution = 64
velocity_1.GlyphType.TipLength = 0.2
velocity_1.GlyphType.ShaftResolution = 64
velocity_1.GlyphType.ShaftRadius = 0.05
# ---------------------------------------------------------------- # ----------------------------------------------------------------
# setup the visualization in view 'renderView1' # setup the visualization in view 'renderView1'
# ---------------------------------------------------------------- # ----------------------------------------------------------------
@@ -167,7 +161,9 @@ frameDisplay = Show(frame, renderView1, 'GeometryRepresentation')
# trace defaults for the display properties. # trace defaults for the display properties.
frameDisplay.Representation = 'Surface' frameDisplay.Representation = 'Surface'
frameDisplay.AmbientColor = [0.0, 0.0, 0.0]
frameDisplay.ColorArrayName = [None, ''] frameDisplay.ColorArrayName = [None, '']
frameDisplay.DiffuseColor = [0.0, 0.0, 0.0]
frameDisplay.SelectNormalArray = 'None' frameDisplay.SelectNormalArray = 'None'
frameDisplay.SelectTangentArray = 'None' frameDisplay.SelectTangentArray = 'None'
frameDisplay.SelectTCoordArray = 'None' frameDisplay.SelectTCoordArray = 'None'
@@ -269,13 +265,15 @@ typeTF2D = GetTransferFunction2D('type')
# get color transfer function/color map for 'type' # get color transfer function/color map for 'type'
typeLUT = GetColorTransferFunction('type') typeLUT = GetColorTransferFunction('type')
typeLUT.TransferFunction2D = typeTF2D typeLUT.TransferFunction2D = typeTF2D
typeLUT.RGBPoints = [0.0, 0.418, 0.68, 0.836, 0.44568243622779846, 0.865, 0.865, 0.865, 1.0, 0.988, 0.73, 0.516] 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 typeLUT.ScalarRangeInitialized = 1.0
# trace defaults for the display properties. # trace defaults for the display properties.
atom_1Display.Representation = 'Surface' atom_1Display.Representation = 'Surface'
atom_1Display.ColorArrayName = ['POINTS', 'type'] atom_1Display.ColorArrayName = ['POINTS', 'type']
atom_1Display.LookupTable = typeLUT atom_1Display.LookupTable = typeLUT
atom_1Display.InterpolateScalarsBeforeMapping = 0
atom_1Display.SelectNormalArray = 'Normals' atom_1Display.SelectNormalArray = 'Normals'
atom_1Display.SelectTangentArray = 'None' atom_1Display.SelectTangentArray = 'None'
atom_1Display.SelectTCoordArray = 'None' atom_1Display.SelectTCoordArray = 'None'
@@ -310,7 +308,9 @@ velocity_1Display = Show(velocity_1, renderView1, 'GeometryRepresentation')
# trace defaults for the display properties. # trace defaults for the display properties.
velocity_1Display.Representation = 'Surface' velocity_1Display.Representation = 'Surface'
velocity_1Display.AmbientColor = [1.0, 0.0, 0.0]
velocity_1Display.ColorArrayName = [None, ''] velocity_1Display.ColorArrayName = [None, '']
velocity_1Display.DiffuseColor = [1.0, 0.0, 0.0]
velocity_1Display.SelectNormalArray = 'None' velocity_1Display.SelectNormalArray = 'None'
velocity_1Display.SelectTangentArray = 'None' velocity_1Display.SelectTangentArray = 'None'
velocity_1Display.SelectTCoordArray = 'None' velocity_1Display.SelectTCoordArray = 'None'
@@ -343,19 +343,9 @@ velocity_1Display.OpacityTransferFunction.Points = [0.0, 0.0, 0.5, 0.0, 7.0, 1.0
# show data from radius # show data from radius
radiusDisplay = Show(radius, renderView1, 'GeometryRepresentation') radiusDisplay = Show(radius, renderView1, 'GeometryRepresentation')
# 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
# trace defaults for the display properties. # trace defaults for the display properties.
radiusDisplay.Representation = 'Surface' radiusDisplay.Representation = 'Surface'
radiusDisplay.ColorArrayName = ['POINTS', 'radius'] radiusDisplay.ColorArrayName = ['POINTS', '']
radiusDisplay.LookupTable = radiusLUT
radiusDisplay.SelectNormalArray = 'None' radiusDisplay.SelectNormalArray = 'None'
radiusDisplay.SelectTangentArray = 'None' radiusDisplay.SelectTangentArray = 'None'
radiusDisplay.SelectTCoordArray = 'None' radiusDisplay.SelectTCoordArray = 'None'
@@ -389,80 +379,96 @@ radiusDisplay.OpacityTransferFunction.Points = [0.2, 0.0, 0.5, 0.0, 0.5, 1.0, 0.
# get color legend/bar for typeLUT in view renderView1 # get color legend/bar for typeLUT in view renderView1
typeLUTColorBar = GetScalarBar(typeLUT, renderView1) typeLUTColorBar = GetScalarBar(typeLUT, renderView1)
typeLUTColorBar.WindowLocation = 'Any Location'
typeLUTColorBar.Position = [0.8195679796696314, 0.07503410641200547]
typeLUTColorBar.Title = 'type' typeLUTColorBar.Title = 'type'
typeLUTColorBar.ComponentTitle = '' typeLUTColorBar.ComponentTitle = ''
# set color bar visibility # set color bar visibility
typeLUTColorBar.Visibility = 1 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 # get color legend/bar for radiusLUT in view renderView1
radiusLUTColorBar = GetScalarBar(radiusLUT, renderView1) radiusLUTColorBar = GetScalarBar(radiusLUT, renderView1)
radiusLUTColorBar.WindowLocation = 'Upper Right Corner' radiusLUTColorBar.WindowLocation = 'Upper Right Corner'
radiusLUTColorBar.Position = [0.8526048284625158, 0.6534788540245566]
radiusLUTColorBar.Title = 'radius' radiusLUTColorBar.Title = 'radius'
radiusLUTColorBar.ComponentTitle = '' radiusLUTColorBar.ComponentTitle = ''
# set color bar visibility # set color bar visibility
radiusLUTColorBar.Visibility = 1 radiusLUTColorBar.Visibility = 0
# show color legend # get 2D transfer function for 'Separate_17226_type'
atom_1Display.SetScalarBarVisibility(renderView1, True) separate_17226_typeTF2D = GetTransferFunction2D('Separate_17226_type')
# show color legend # get separate color transfer function/color map for 'type'
radiusDisplay.SetScalarBarVisibility(renderView1, True) 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
# setup the visualization in view 'spreadSheetView1' separate_atom_1Display_typeLUTColorBar = GetScalarBar(separate_atom_1Display_typeLUT, renderView1)
# ---------------------------------------------------------------- separate_atom_1Display_typeLUTColorBar.Title = 'type'
separate_atom_1Display_typeLUTColorBar.ComponentTitle = ''
# show data from atom_1 # set color bar visibility
atom_1Display_1 = Show(atom_1, spreadSheetView1, 'SpreadSheetRepresentation') separate_atom_1Display_typeLUTColorBar.Visibility = 0
# trace defaults for the display properties.
atom_1Display_1.Assembly = ''
# ---------------------------------------------------------------- # ----------------------------------------------------------------
# setup color maps and opacity maps used in the visualization # setup color maps and opacity maps used in the visualization
# note: the Get..() functions create a new object, if needed # 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 opacity transfer function/opacity map for 'radius' # get opacity transfer function/opacity map for 'radius'
radiusPWF = GetOpacityTransferFunction('radius') radiusPWF = GetOpacityTransferFunction('radius')
radiusPWF.Points = [0.2, 0.0, 0.5, 0.0, 2.0, 1.0, 0.5, 0.0] radiusPWF.Points = [0.2, 0.0, 0.5, 0.0, 2.0, 1.0, 0.5, 0.0]
radiusPWF.ScalarRangeInitialized = 1 radiusPWF.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 'type'
typePWF = GetOpacityTransferFunction('type')
typePWF.ScalarRangeInitialized = 1
# ---------------------------------------------------------------- # ----------------------------------------------------------------
# setup animation scene, tracks and keyframes # setup animation scene, tracks and keyframes
# note: the Get..() functions create a new object, if needed # note: the Get..() functions create a new object, if needed
# ---------------------------------------------------------------- # ----------------------------------------------------------------
# get time animation track
timeAnimationCue1 = GetTimeTrack()
# initialize the animation scene
# get the time-keeper # get the time-keeper
timeKeeper1 = GetTimeKeeper() timeKeeper1 = GetTimeKeeper()
# initialize the timekeeper # initialize the timekeeper
timeKeeper1.SuppressedTimeSources = framecsv timeKeeper1.SuppressedTimeSources = framecsv
# get time animation track
timeAnimationCue1 = GetTimeTrack()
# initialize the animation track # initialize the animation track
# get animation scene # get animation scene
animationScene1 = GetAnimationScene() animationScene1 = GetAnimationScene()
# initialize the animation scene # initialize the animation scene
animationScene1.ViewModules = [renderView1, spreadSheetView1] animationScene1.ViewModules = renderView1
animationScene1.Cues = timeAnimationCue1 animationScene1.Cues = timeAnimationCue1
animationScene1.AnimationTime = 0.0 animationScene1.AnimationTime = 0.0
# initialize the animation scene
# ---------------------------------------------------------------- # ----------------------------------------------------------------
# restore active source # restore active source
SetActiveSource(atom_1) SetActiveSource(a3csv)
# ---------------------------------------------------------------- # ----------------------------------------------------------------
@@ -489,4 +495,6 @@ SetActiveSource(atom_1)
# #
## Please refer to the documentation of paraview.simple ## Please refer to the documentation of paraview.simple
## https://www.paraview.org/paraview-docs/latest/python/paraview.simple.html ## https://www.paraview.org/paraview-docs/latest/python/paraview.simple.html
##-------------------------------------------- ##--------------------------------------------
# ImageResolution=[1920, 1080]
SaveScreenshot('output.png', TransparentBackground=True)