diff --git a/画图/拉曼整体图/export_png.py b/画图/拉曼整体图/export_png.py index c533089..2e66638 100755 --- a/画图/拉曼整体图/export_png.py +++ b/画图/拉曼整体图/export_png.py @@ -62,36 +62,36 @@ def export(mode_id): frame.OutputDataSetType = 'vtkPolyData' frame.Script = """input_data = self.GetInput() - # 创建输出数据结构(vtkPolyData) - output = self.GetOutput() - points = vtk.vtkPoints() - lines = vtk.vtkCellArray() +# 创建输出数据结构(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) +# 遍历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)""" +# 设置输出数据 +output.SetPoints(points) +output.SetLines(lines)""" frame.RequestInformationScript = '' frame.RequestUpdateExtentScript = '' frame.PythonPath = '' @@ -476,8 +476,10 @@ def export(mode_id): SetActiveSource(a3csv) # ---------------------------------------------------------------- + renderView1.Update() # 强制更新视图 + Render() # ImageResolution=[1920, 1080] - SaveScreenshot(f'mode/z/{mode_id}.png', TransparentBackground=True) + SaveScreenshot(f'mode/z/{mode_id}.png', renderView1, TransparentBackground=True) -for i in [*range(3, 9), *range(11, 21), 23]: +for i in range(3, 24): export(i) diff --git a/画图/拉曼整体图/main.svg b/画图/拉曼整体图/main.svg index ecf8b48..c7b26cc 100644 --- a/画图/拉曼整体图/main.svg +++ b/画图/拉曼整体图/main.svg @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:797f5145c0d449830d4ef939af90e6759b2b0adc839c393e2c75fce9e73ba86d -size 627279 +oid sha256:29fe8f864b6d374fdc03013bb81125dc8481d62c099d1f002377d4dc0a6d81d0 +size 2056719 diff --git a/画图/拉曼整体图/mode/z/10.csv b/画图/拉曼整体图/mode/z/10.csv new file mode 100644 index 0000000..c3f0156 --- /dev/null +++ b/画图/拉曼整体图/mode/z/10.csv @@ -0,0 +1,9 @@ +vx,vy,vz +0,0,0.04986 +0,0,-0.10462 +0,0,-0.04986 +0,0,0.10462 +0,0,0.06389 +0,0,-0.01697 +0,0,-0.06389 +0,0,0.01697 diff --git a/画图/拉曼整体图/mode/z/10.png b/画图/拉曼整体图/mode/z/10.png new file mode 100644 index 0000000..fe4bc1a Binary files /dev/null and b/画图/拉曼整体图/mode/z/10.png differ diff --git a/画图/拉曼整体图/mode/z/11.png b/画图/拉曼整体图/mode/z/11.png index 38df6f1..a332b25 100644 Binary files a/画图/拉曼整体图/mode/z/11.png and b/画图/拉曼整体图/mode/z/11.png differ diff --git a/画图/拉曼整体图/mode/z/12.png b/画图/拉曼整体图/mode/z/12.png index 0c8565b..e6e9e69 100644 Binary files a/画图/拉曼整体图/mode/z/12.png and b/画图/拉曼整体图/mode/z/12.png differ diff --git a/画图/拉曼整体图/mode/z/13.png b/画图/拉曼整体图/mode/z/13.png index 1d91b74..6130521 100644 Binary files a/画图/拉曼整体图/mode/z/13.png and b/画图/拉曼整体图/mode/z/13.png differ diff --git a/画图/拉曼整体图/mode/z/14.png b/画图/拉曼整体图/mode/z/14.png index 4864625..dd9491f 100644 Binary files a/画图/拉曼整体图/mode/z/14.png and b/画图/拉曼整体图/mode/z/14.png differ diff --git a/画图/拉曼整体图/mode/z/15.png b/画图/拉曼整体图/mode/z/15.png index d68648c..bbb4e90 100644 Binary files a/画图/拉曼整体图/mode/z/15.png and b/画图/拉曼整体图/mode/z/15.png differ diff --git a/画图/拉曼整体图/mode/z/16.png b/画图/拉曼整体图/mode/z/16.png index 87d2553..b74a323 100644 Binary files a/画图/拉曼整体图/mode/z/16.png and b/画图/拉曼整体图/mode/z/16.png differ diff --git a/画图/拉曼整体图/mode/z/17.png b/画图/拉曼整体图/mode/z/17.png index dfd446b..1e91d11 100644 Binary files a/画图/拉曼整体图/mode/z/17.png and b/画图/拉曼整体图/mode/z/17.png differ diff --git a/画图/拉曼整体图/mode/z/18.png b/画图/拉曼整体图/mode/z/18.png index 02ddbaf..b38b616 100644 Binary files a/画图/拉曼整体图/mode/z/18.png and b/画图/拉曼整体图/mode/z/18.png differ diff --git a/画图/拉曼整体图/mode/z/19.png b/画图/拉曼整体图/mode/z/19.png index fa5e930..83f55ba 100644 Binary files a/画图/拉曼整体图/mode/z/19.png and b/画图/拉曼整体图/mode/z/19.png differ diff --git a/画图/拉曼整体图/mode/z/20.png b/画图/拉曼整体图/mode/z/20.png index 685bb80..9b8e00b 100644 Binary files a/画图/拉曼整体图/mode/z/20.png and b/画图/拉曼整体图/mode/z/20.png differ diff --git a/画图/拉曼整体图/mode/z/21.csv b/画图/拉曼整体图/mode/z/21.csv new file mode 100644 index 0000000..6b9826c --- /dev/null +++ b/画图/拉曼整体图/mode/z/21.csv @@ -0,0 +1,9 @@ +vx,vy,vz +0,0,0.05431 +0,0,-0.03742 +0,0,-0.05431 +0,0,0.03742 +0,0,-0.11183 +0,0,-0.03075 +0,0,0.11183 +0,0,0.03075 diff --git a/画图/拉曼整体图/mode/z/21.png b/画图/拉曼整体图/mode/z/21.png new file mode 100644 index 0000000..17632ea Binary files /dev/null and b/画图/拉曼整体图/mode/z/21.png differ diff --git a/画图/拉曼整体图/mode/z/22.csv b/画图/拉曼整体图/mode/z/22.csv new file mode 100644 index 0000000..b99de53 --- /dev/null +++ b/画图/拉曼整体图/mode/z/22.csv @@ -0,0 +1,9 @@ +vx,vy,vz +0,0,0.03648 +0,0,0.0542 +0,0,-0.03648 +0,0,-0.0542 +0,0,0.03046 +0,0,-0.11228 +0,0,-0.03046 +0,0,0.11228 diff --git a/画图/拉曼整体图/mode/z/22.png b/画图/拉曼整体图/mode/z/22.png new file mode 100644 index 0000000..f455dad Binary files /dev/null and b/画图/拉曼整体图/mode/z/22.png differ diff --git a/画图/拉曼整体图/mode/z/23.png b/画图/拉曼整体图/mode/z/23.png index c0be134..1b8d48b 100644 Binary files a/画图/拉曼整体图/mode/z/23.png and b/画图/拉曼整体图/mode/z/23.png differ diff --git a/画图/拉曼整体图/mode/z/3.png b/画图/拉曼整体图/mode/z/3.png index 8476aa5..89b292b 100644 Binary files a/画图/拉曼整体图/mode/z/3.png and b/画图/拉曼整体图/mode/z/3.png differ diff --git a/画图/拉曼整体图/mode/z/4.png b/画图/拉曼整体图/mode/z/4.png index 6e386f7..1203ef5 100644 Binary files a/画图/拉曼整体图/mode/z/4.png and b/画图/拉曼整体图/mode/z/4.png differ diff --git a/画图/拉曼整体图/mode/z/5.png b/画图/拉曼整体图/mode/z/5.png index 20a489c..e09369b 100644 Binary files a/画图/拉曼整体图/mode/z/5.png and b/画图/拉曼整体图/mode/z/5.png differ diff --git a/画图/拉曼整体图/mode/z/6.png b/画图/拉曼整体图/mode/z/6.png index 9215c13..1823e42 100644 Binary files a/画图/拉曼整体图/mode/z/6.png and b/画图/拉曼整体图/mode/z/6.png differ diff --git a/画图/拉曼整体图/mode/z/7.png b/画图/拉曼整体图/mode/z/7.png index 65e1886..f0942a3 100644 Binary files a/画图/拉曼整体图/mode/z/7.png and b/画图/拉曼整体图/mode/z/7.png differ diff --git a/画图/拉曼整体图/mode/z/8.png b/画图/拉曼整体图/mode/z/8.png index 5201cf8..cc081c7 100644 Binary files a/画图/拉曼整体图/mode/z/8.png and b/画图/拉曼整体图/mode/z/8.png differ diff --git a/画图/拉曼整体图/mode/z/9.csv b/画图/拉曼整体图/mode/z/9.csv new file mode 100644 index 0000000..ebe46c1 --- /dev/null +++ b/画图/拉曼整体图/mode/z/9.csv @@ -0,0 +1,9 @@ +vx,vy,vz +0,0,0.10505 +0,0,0.05019 +0,0,-0.10505 +0,0,-0.05019 +0,0,0.01692 +0,0,0.06295 +0,0,-0.01692 +0,0,-0.06295 diff --git a/画图/拉曼整体图/mode/z/9.png b/画图/拉曼整体图/mode/z/9.png new file mode 100644 index 0000000..886476a Binary files /dev/null and b/画图/拉曼整体图/mode/z/9.png differ diff --git a/画图/拉曼整体图/view.pvsm b/画图/拉曼整体图/view.pvsm index 1a9d07a..089c898 100644 --- a/画图/拉曼整体图/view.pvsm +++ b/画图/拉曼整体图/view.pvsm @@ -1864,8 +1864,13 @@ - - + + + + + + + @@ -3090,18 +3095,18 @@ - - + + - - + + - - + + @@ -4326,13 +4331,13 @@ - - + + - - + + @@ -9047,11 +9052,6 @@ - - - - - @@ -16020,37 +16020,37 @@ - - + + - + - + - - + + - + - + - + - + - + - + - + - + - + - + @@ -16313,7 +16313,7 @@ - + @@ -16583,14 +16583,14 @@ - + - + @@ -17375,8 +17375,11 @@ + + + - + @@ -17395,13 +17398,13 @@ - - - + + + - + @@ -17420,10 +17423,10 @@ - + - + @@ -17500,9 +17503,6 @@ - - - @@ -17520,7 +17520,7 @@ - + diff --git a/画图/拉曼整体图/view.py b/画图/拉曼整体图/view.py index 7d4ab6e..3f6d07e 100644 --- a/画图/拉曼整体图/view.py +++ b/画图/拉曼整体图/view.py @@ -49,6 +49,18 @@ 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']) @@ -91,9 +103,6 @@ frame.RequestInformationScript = '' frame.RequestUpdateExtentScript = '' 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' mode = TableToPoints(registrationName='mode', Input=a3csv) mode.XColumn = 'vx' @@ -101,15 +110,6 @@ 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]) @@ -123,6 +123,19 @@ 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') @@ -139,19 +152,6 @@ 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' # ---------------------------------------------------------------- @@ -427,35 +427,33 @@ separate_atom_1Display_typeLUTColorBar.Visibility = 0 # 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 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 '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 time animation track -timeAnimationCue1 = GetTimeTrack() - -# initialize the animation scene - # 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 @@ -466,9 +464,11 @@ animationScene1.ViewModules = renderView1 animationScene1.Cues = timeAnimationCue1 animationScene1.AnimationTime = 0.0 +# initialize the animation scene + # ---------------------------------------------------------------- # restore active source -SetActiveSource(a3csv) +SetActiveSource(frame) # ---------------------------------------------------------------- @@ -495,6 +495,4 @@ SetActiveSource(a3csv) # ## Please refer to the documentation of paraview.simple ## https://www.paraview.org/paraview-docs/latest/python/paraview.simple.html -##-------------------------------------------- -# ImageResolution=[1920, 1080] -SaveScreenshot('output.png', TransparentBackground=True) \ No newline at end of file +##-------------------------------------------- \ No newline at end of file