This commit is contained in:
2025-04-07 21:19:04 +08:00
parent 7d122639a6
commit 306ad17946
7 changed files with 18272 additions and 22 deletions

View File

@@ -1,9 +1,9 @@
id,type,x,y,z
0,0,0,1.785912884,2.530495816
1,0,1.546645788,0.892956361,7.593556577
2,0,0,0,10.124562250
3,0,0,0,5.061501490
4,1,0,1.785912884,4.434660329
5,1,1.546645788,0.892956361,9.497720786
6,1,0,0,1.896658357
7,1,0,0,6.959719117
type,x,y,z
0,0,1.785912884,2.530495816
0,1.546645788,0.892956361,7.593556577
0,0,0,0
0,0,0,5.061501490
1,0,1.785912884,4.434660329
1,1.546645788,0.892956361,9.497720786
1,0,0,1.896658357
1,0,0,6.959719117
1 id type x y z
2 0 0 0 1.785912884 2.530495816
3 1 0 1.546645788 0.892956361 7.593556577
4 2 0 0 0 10.124562250 0
5 3 0 0 0 5.061501490
6 4 1 0 1.785912884 4.434660329
7 5 1 1.546645788 0.892956361 9.497720786
8 6 1 0 0 1.896658357
9 7 1 0 0 6.959719117

BIN
画图/拉曼整体图/main.svg LFS Normal file

Binary file not shown.

View File

@@ -1,9 +1,9 @@
id,vx,vy,vz
0,0,0,1
1,0,0,1
2,0,0,1
3,0,0,1
4,0,0,1
5,0,0,1
6,0,0,1
7,0,0,1
vx,vy,vz
0,0,1
0,0,1
0,0,1
0,0,1
0,0,1
0,0,1
0,0,1
0,0,1
1 id vx vy vz
2 0 0 0 1
3 1 0 0 1
4 2 0 0 1
5 3 0 0 1
6 4 0 0 1
7 5 0 0 1
8 6 0 0 1
9 7 0 0 1

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,492 @@
# 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 = [787, 733]
renderView1.AxesGrid = 'Grid Axes 3D Actor'
renderView1.CenterOfRotation = [0.7733229100704193, 0.8929564654827118, 6.010610222816467]
renderView1.StereoType = 'Crystal Eyes'
renderView1.CameraPosition = [18.504536090763168, 6.686416267346643, 4.1835417898422005]
renderView1.CameraFocalPoint = [0.7733229100704198, 0.8929564654827146, 6.010610222816473]
renderView1.CameraViewUp = [0.09322747842486345, 0.028536938063048908, 0.9952357913743494]
renderView1.CameraFocalDisk = 1.0
renderView1.CameraParallelScale = 12.582330587837445
renderView1.CameraParallelProjection = 1
renderView1.LegendGrid = 'Legend Grid Actor'
renderView1.PolarGrid = 'Polar Grid Actor'
# Create a new 'SpreadSheet View'
spreadSheetView1 = CreateView('SpreadSheetView')
spreadSheetView1.ColumnToSort = ''
spreadSheetView1.BlockSize = 1024
SetActiveView(None)
# ----------------------------------------------------------------
# setup view layouts
# ----------------------------------------------------------------
# create new layout object 'Layout #1'
layout1 = CreateLayout(name='Layout #1')
layout1.AssignView(0, renderView1)
layout1.SetSize(787, 733)
# create new layout object 'Layout #2'
layout2 = CreateLayout(name='Layout #2')
layout2.AssignView(0, spreadSheetView1)
layout2.SetSize(400, 400)
# ----------------------------------------------------------------
# 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'
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'
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=a0csv)
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.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 = 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'
# ----------------------------------------------------------------
# show data from frame
frameDisplay = Show(frame, renderView1, 'GeometryRepresentation')
# trace defaults for the display properties.
frameDisplay.Representation = 'Surface'
frameDisplay.ColorArrayName = [None, '']
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.44568243622779846, 0.865, 0.865, 0.865, 1.0, 0.988, 0.73, 0.516]
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.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.ColorArrayName = [None, '']
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')
# 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.
radiusDisplay.Representation = 'Surface'
radiusDisplay.ColorArrayName = ['POINTS', 'radius']
radiusDisplay.LookupTable = radiusLUT
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.Title = 'type'
typeLUTColorBar.ComponentTitle = ''
# set color bar visibility
typeLUTColorBar.Visibility = 1
# get color legend/bar for radiusLUT in view renderView1
radiusLUTColorBar = GetScalarBar(radiusLUT, renderView1)
radiusLUTColorBar.WindowLocation = 'Upper Right Corner'
radiusLUTColorBar.Title = 'radius'
radiusLUTColorBar.ComponentTitle = ''
# set color bar visibility
radiusLUTColorBar.Visibility = 1
# show color legend
atom_1Display.SetScalarBarVisibility(renderView1, True)
# show color legend
radiusDisplay.SetScalarBarVisibility(renderView1, True)
# ----------------------------------------------------------------
# setup the visualization in view 'spreadSheetView1'
# ----------------------------------------------------------------
# show data from atom_1
atom_1Display_1 = Show(atom_1, spreadSheetView1, 'SpreadSheetRepresentation')
# trace defaults for the display properties.
atom_1Display_1.Assembly = ''
# ----------------------------------------------------------------
# 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 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, spreadSheetView1]
animationScene1.Cues = timeAnimationCue1
animationScene1.AnimationTime = 0.0
# initialize the animation scene
# ----------------------------------------------------------------
# restore active source
SetActiveSource(atom_1)
# ----------------------------------------------------------------
##--------------------------------------------
## 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
##--------------------------------------------

Binary file not shown.