#!/usr/bin/env python2.7 # Mon Aug 12 11:33:59 CEST 2013 # jasper kursk # # To do: # write a small ssh command just after username/password input to check if its correct, try to make it able to be re-entered? currently works by resetting paraview, which spawns a freaky ssh input window try: paraview.simple except: from paraview.simple import * import sys import getpass import Tkinter as tk from random import randint from time import time import math from caller_module import write_file def GetaViewProps(rv): res=dict() for prop in ["CenterOfRotation","CameraViewUp","CameraFocalPoint","CameraClippingRange","CameraPosition"]: res[prop]=rv.GetProperty(prop).GetData() print prop, "--->", res[prop] return(res) #def return_colours(field): # #returns RGBPoints and Points lists # #the first one should be assigned to the LookupTable, latter to the PiecewiseFunction # table1 = GetLookupTableForArray( field, 1, NanColor=[1.0, 1.0, 0.0], RGBPoints=[-0.15222379565238953, 0.2784313725490196, 0.2784313725490196, 0.8588235294117647, -0.10660678204894067, 0.050980392156862744, 0.050980392156862744, 0.43137254901960786, -0.06130856854056117, 0.0, 0.7843137254901961, 0.8745098039215686, -0.0153725548419833, 0.0, 0.5529411764705883, 0.11764705882352941, 0.02992555866636637, 1.0, 0.9098039215686274, 0.0, 0.07554257226981526, 1.0, 0.3803921568627451, 0.0, 0.12115928587317465, 0.47058823529411764, 0.050980392156862744, 0.050980392156862744, 0.16677629947662354, 0.8784313725490196, 0.30196078431372547, 0.30196078431372547], VectorMode='Magnitude', ColorSpace='RGB', ScalarRangeInitialized=1.0 ) # table2 = CreatePiecewiseFunction( Points=[-0.15222379565238953, 1.0, 0.5, 0.0, -0.047535497695207596, 0.02, 0.5, 0.0, 0.06628411263227463, 0.02, 0.5, 0.0, 0.16677629947662354, 1.0, 0.5, 0.0] ) # return table1, table2 def data_rho_init(current_source): a1_Babs_PVLookupTable = GetLookupTableForArray( "Babs", 1, NanColor=[0.25, 0.0, 0.0], RGBPoints=[0.45639699697494507, 0.23, 0.299, 0.754, 1.2598623037338257, 0.706, 0.016, 0.15], VectorMode='Magnitude', ColorSpace='Diverging', ScalarRangeInitialized=1.0 ) a1_Babs_PiecewiseFunction = CreatePiecewiseFunction( Points=[0.45639699697494507, 0.0, 0.5, 0.0, 1.2598623037338257, 1.0, 0.5, 0.0] ) ############### THE COLOUR OF THE DENSITY FUNCTION a1_Rho_PVLookupTable = GetLookupTableForArray( "Rho", 1, NanColor=[1.0, 1.0, 0.0], RGBPoints=[-0.15222379565238953, 0.2784313725490196, 0.2784313725490196, 0.8588235294117647, -0.10660678204894067, 0.050980392156862744, 0.050980392156862744, 0.43137254901960786, -0.06130856854056117, 0.0, 0.7843137254901961, 0.8745098039215686, -0.0153725548419833, 0.0, 0.5529411764705883, 0.11764705882352941, 0.02992555866636637, 1.0, 0.9098039215686274, 0.0, 0.07554257226981526, 1.0, 0.3803921568627451, 0.0, 0.12115928587317465, 0.47058823529411764, 0.050980392156862744, 0.050980392156862744, 0.16677629947662354, 0.8784313725490196, 0.30196078431372547, 0.30196078431372547], VectorMode='Magnitude', ColorSpace='RGB', ScalarRangeInitialized=1.0 ) a1_Rho_PiecewiseFunction = CreatePiecewiseFunction( Points=[-0.15222379565238953, 0.8, 0.5, 0.0, -0.047535497695207596, 0.02, 0.5, 0.0, 0.06628411263227463, 0.02, 0.5, 0.0, 0.16677629947662354, 0.8, 0.5, 0.0] ) ###################################################### SetActiveSource(current_source) DataRepresentation1 = Show() DataRepresentation1.EdgeColor = [0.0, 0.0, 0.5000076295109483] DataRepresentation1.SelectionPointFieldDataArrayName = 'Eabs' DataRepresentation1.ScalarOpacityFunction = a1_Rho_PiecewiseFunction DataRepresentation1.ColorArrayName = 'Rho' DataRepresentation1.ScalarOpacityUnitDistance = 1.7320508075688776 DataRepresentation1.LookupTable = a1_Rho_PVLookupTable DataRepresentation1.Representation = 'Volume' DataRepresentation1.ScaleFactor = 12.700000000000001 DataRepresentation1.CubeAxesVisibility = 1 DataRepresentation1.CubeAxesFlyMode = 'Closest Triad' return DataRepresentation1 def data_probe(): global view2check global DataRepresentation1 global DataRepresentation2 global RenderView1 global ProbeLocation1 paraview.simple._DisableFirstRenderCameraReset() EBbin_288_vtk = LegacyVTKReader( FileNames=['/gpfs/scratch/userinternal/gmuscia1/peter_thompson/peter_scratch/bigfile2/EBbin_288.vtk'] ) SetActiveSource(EBbin_288_vtk) RenderView1 = GetRenderView() ProbeLocation1 = ProbeLocation( ProbeType="Fixed Radius Point Source" ) DataRepresentation1 = data_rho_init(LegacyVTKReader( FileNames=['/gpfs/scratch/userinternal/gmuscia1/peter_thompson/peter_scratch/bigfile2/EBbin_288.vtk'] )) # a1_Babs_PVLookupTable = GetLookupTableForArray( "Babs", 1, NanColor=[0.25, 0.0, 0.0], RGBPoints=[0.45639699697494507, 0.23, 0.299, 0.754, 1.2598623037338257, 0.706, 0.016, 0.15], VectorMode='Magnitude', ColorSpace='Diverging', ScalarRangeInitialized=1.0 ) # a1_Babs_PiecewiseFunction = CreatePiecewiseFunction( Points=[0.45639699697494507, 0.0, 0.5, 0.0, 1.2598623037338257, 1.0, 0.5, 0.0] ) ## a1_Rho_PVLookupTable = GetLookupTableForArray( "Rho", 1, RGBPoints=[-0.15222379565238953, 0.23137254901960785, 0.2980392156862745, 0.7529411764705882, 0.16677629947662354, 0.7058823529411765, 0.01568627450980392, 0.14901960784313725], VectorMode='Magnitude', NanColor=[0.24705882352941178, 0.0, 0.0], ColorSpace='Diverging', HSVWrap=0, ScalarRangeInitialized=1.0 ) ## a1_Rho_PiecewiseFunction = CreatePiecewiseFunction( Points=[-0.15222379565238953, 0.5, 0.5, 0.0, -0.05592772737145424, 0.0, 0.5, 0.0, 0.05264674127101898, 0.0, 0.5, 0.0, 0.07205377519130707, 0.0, 0.5, 0.0, 0.16677629947662354, 0.5, 0.5, 0.0] ) # # # # a1_Rho_PVLookupTable, a1_Rho_PiecewiseFunction = return_colours("Rho") # a1_Babs_PVLookupTable, a1_Babs_PiecewiseFunction = return_colours("Babs") # # ############### THE COLOUR OF THE DENSITY FUNCTION ## a1_Rho_PVLookupTable = GetLookupTableForArray( "Rho", 1, NanColor=[1.0, 1.0, 0.0], RGBPoints=[-0.15222379565238953, 0.2784313725490196, 0.2784313725490196, 0.8588235294117647, -0.10660678204894067, 0.050980392156862744, 0.050980392156862744, 0.43137254901960786, -0.06130856854056117, 0.0, 0.7843137254901961, 0.8745098039215686, -0.0153725548419833, 0.0, 0.5529411764705883, 0.11764705882352941, 0.02992555866636637, 1.0, 0.9098039215686274, 0.0, 0.07554257226981526, 1.0, 0.3803921568627451, 0.0, 0.12115928587317465, 0.47058823529411764, 0.050980392156862744, 0.050980392156862744, 0.16677629947662354, 0.8784313725490196, 0.30196078431372547, 0.30196078431372547], VectorMode='Magnitude', ColorSpace='RGB', ScalarRangeInitialized=1.0 ) ## a1_Rho_PiecewiseFunction = CreatePiecewiseFunction( Points=[-0.15222379565238953, 1.0, 0.5, 0.0, -0.047535497695207596, 0.02, 0.5, 0.0, 0.06628411263227463, 0.02, 0.5, 0.0, 0.16677629947662354, 1.0, 0.5, 0.0] ) # ###################################################### # # SetActiveSource(EBbin_288_vtk) # DataRepresentation1 = Show() # DataRepresentation1.EdgeColor = [0.0, 0.0, 0.5000076295109483] # DataRepresentation1.SelectionPointFieldDataArrayName = 'Eabs' # DataRepresentation1.ScalarOpacityFunction = a1_Rho_PiecewiseFunction # DataRepresentation1.ColorArrayName = 'Rho' # DataRepresentation1.ScalarOpacityUnitDistance = 1.7320508075688776 # DataRepresentation1.LookupTable = a1_Rho_PVLookupTable # DataRepresentation1.Representation = 'Volume' # DataRepresentation1.ScaleFactor = 12.700000000000001 # DataRepresentation1.CubeAxesVisibility = 1 # DataRepresentation1.CubeAxesFlyMode = 'Closest Triad' RenderView1.CameraViewUp = [0.08281593300599972, 0.9238627752329709, -0.37365638463591] RenderView1.CameraPosition = [-27.613974698659774, 198.63383510073479, 375.7291323606349] RenderView1.CameraClippingRange = [154.2966506159436, 599.9046544452474] RenderView1.CameraFocalPoint = [64.5, 64.5, 64.5] RenderView1.CameraParallelScale = 109.9852262806237 RenderView1.CenterOfRotation = [64.5, 64.5, 64.5] RenderView1.CenterAxesVisibility = 0 ProbeLocation1.ProbeType.Center = [64.5, 64.5, 64.5] ProbeLocation1.ProbeType = "Fixed Radius Point Source" active_objects.source.SMProxy.InvokeEvent('UserEvent', 'ShowWidget') SetActiveSource(ProbeLocation1) DataRepresentation2 = Show() DataRepresentation2.ColorArrayName = 'Rho' DataRepresentation2.ScaleFactor = 0.1 DataRepresentation2.SelectionPointFieldDataArrayName = 'Eabs' DataRepresentation2.EdgeColor = [0.0, 0.0, 0.5000076295109483] a1_Eabs_PVLookupTable = GetLookupTableForArray( "Eabs", 1, NanColor=[0.25, 0.0, 0.0], RGBPoints=[0.11486060917377472, 0.23, 0.299, 0.754, 0.11486060917377472, 0.706, 0.016, 0.15], VectorMode='Magnitude', ColorSpace='Diverging', ScalarRangeInitialized=1.0 ) a1_Eabs_PiecewiseFunction = CreatePiecewiseFunction( Points=[0.0, 0.0, 0.5, 0.0, 1.0, 1.0, 0.5, 0.0] ) ProbeLocation1.ProbeType.Center = [23.8173400781295, 81.9096835937293, 44.9559775979259] DataRepresentation2.Representation = 'Points' DataRepresentation2.ColorArrayName = '' DataRepresentation2.PointSize = 10.0 DataRepresentation2.LookupTable = a1_Eabs_PVLookupTable ScalarBarWidgetRepresentation1 = CreateScalarBar( LabelFormat='%-#6.3g', Title='Density', AutomaticLabelFormat=0, LabelFontSize=12, Enabled=1, TitleFontSize=12 ) GetRenderView().Representations.append(ScalarBarWidgetRepresentation1) a1_Rho_PVLookupTable = GetLookupTableForArray( "Rho", 1 ) ScalarBarWidgetRepresentation1.LookupTable = a1_Rho_PVLookupTable # EBbin_288_vtk = LegacyVTKReader( FileNames=['/gpfs/scratch/userexternal/pthompso/bigfile2/EBbin_288.vtk'] ) # SetActiveSource(EBbin_288_vtk) # # ProbeLocation1 = ProbeLocation( ProbeType="Fixed Radius Point Source" ) # ProbeLocation1.ProbeType = "Fixed Radius Point Source" # ProbeLocation1.ProbeType.Center = [64.5, 64.5, 64.5] # active_objects.source.SMProxy.InvokeEvent('UserEvent', 'ShowWidget') # # RenderView1 = GetRenderView() # a1_Babs_PVLookupTable = GetLookupTableForArray( "Babs", 1 ) # a1_Rho_PVLookupTable = GetLookupTableForArray( "Rho", 1, RGBPoints=[-0.15222379565238953, 0.0, 0.0, 0.0, -0.024623757600784307, 0.9019607843137255, 0.0, 0.0, 0.10297628045082091, 0.9019607843137255, 0.9019607843137255, 0.0, 0.16677629947662354, 1.0, 1.0, 1.0], VectorMode='Magnitude', NanColor=[0.0, 0.4980392156862745, 1.0], ColorSpace='RGB', UseLogScale=0, ScalarRangeInitialized=1.0, LockScalarRange=0 ) # a1_Rho_PiecewiseFunction = CreatePiecewiseFunction( Points=[-0.15222379565238953, 1.0, 0.5, 0.0, -0.048584528267383575, 0.01, 0.5, 0.0, 0.06628411263227463, 0.01, 0.5, 0.0, 0.16677629947662354, 1.0, 0.5, 0.0] ) # SetActiveView(RenderView1) # DataRepresentation1 = Show() # ScalarBarWidgetRepresentation1 = CreateScalarBar( Title='Density', LabelFontSize=12, Enabled=1, LookupTable=a1_Rho_PVLookupTable, TitleFontSize=12 ) # GetRenderView().Representations.append(ScalarBarWidgetRepresentation1) # DataRepresentation1.Representation = 'Volume' # DataRepresentation1.EdgeColor = [0.0, 0.0, 0.5000076295109483] # DataRepresentation1.CustomBounds = [1.0, 128.0, 1.0, 128.0, 1.0, 128.0] # DataRepresentation1.SelectionPointFieldDataArrayName = 'Eabs' # DataRepresentation1.ScalarOpacityFunction = a1_Rho_PiecewiseFunction # DataRepresentation1.ColorArrayName = 'Rho' # DataRepresentation1.ScalarOpacityUnitDistance = 1.7320508075688776 # DataRepresentation1.LookupTable = a1_Rho_PVLookupTable # DataRepresentation1.ScaleFactor = 12.700000000000001 # DataRepresentation1.CubeAxesVisibility = 1 # DataRepresentation1.CubeAxesFlyMode = 'Closest Triad'#'Outer Edges' # # DataRepresentation1.Representation = 'Points' # DataRepresentation1.ColorArrayName = '' # DataRepresentation1.PointSize = 10.0 # DataRepresentation1.LookupTable = a1_Rho_PVLookupTable # DataRepresentation1.DiffuseColor = [1.0, 1.0, 1.0] # # ##################### # # RenderView1.CameraViewUp = [0.4697502961088887, 0.45584950445669203, 0.7559999263175889] # RenderView1.CameraPosition = [-206.31365911293076, -217.9294359871623, 402.5008642225999] # RenderView1.CameraClippingRange = [20.20848155285991, 70.65169936628278] # RenderView1.CameraFocalPoint = [64.5, 64.5, 64.5] # RenderView1.CameraParallelScale = 10.998522628062371 # RenderView1.CenterOfRotation = [64.5, 64.5, 64.5] # RenderView1.Background = [0.0, 0.0, 0.0] # ProbeLocation1.ProbeType.Center = [4.14478452601783, 7.88468778288704, 5.81582194844571] # SetActiveSource(ProbeLocation1) # DataRepresentation2 = Show() # DataRepresentation2.ColorArrayName = 'Babs' # DataRepresentation2.ScaleFactor = 0.1 # DataRepresentation2.SelectionPointFieldDataArrayName = 'Eabs' # DataRepresentation2.EdgeColor = [0.0, 0.0, 0.5000076295109483] # DataRepresentation2.Representation = 'Points' # DataRepresentation2.ColorArrayName = '' # DataRepresentation2.PointSize = 10.0 # DataRepresentation2.AmbientColor = [1.0, 0.6666666666666666, 1.0] # DataRepresentation2.ColorArrayName = '' # a1_Eabs_PVLookupTable = GetLookupTableForArray( "Eabs", 1, NanColor=[0.25, 0.0, 0.0], RGBPoints=[0.23553098738193512, 0.23, 0.299, 0.754, 0.23553098738193512, 0.706, 0.016, 0.15], VectorMode='Magnitude', ColorSpace='Diverging', ScalarRangeInitialized=1.0 ) # # a1_Eabs_PiecewiseFunction = CreatePiecewiseFunction( Points=[0.0, 0.0, 0.5, 0.0, 1.0, 1.0, 0.5, 0.0] ) # # DataRepresentation2.ColorArrayName = 'Eabs' # DataRepresentation2.LookupTable = a1_Eabs_PVLookupTable Render() ################ view2check = False #http://effbot.org/tkinterbook/entry.htm def make_entry(parent, caption, width=None, **options): tk.Label(parent, text=caption).pack(side=tk.TOP) entry = tk.Entry(parent, **options) if width: entry.config(width=width) entry.pack(side=tk.TOP, padx=10, fill=tk.BOTH) return entry def save_creds(): global username global password username = usernaam.get() password = passwd.get() root.destroy() return sys.argv=['Main'] root = tk.Tk() root.geometry('300x160') root.title('login details') parent = tk.Frame(root, padx=10, pady=10) parent.pack(fill=tk.BOTH, expand=True) tk.Label(parent, text="Login details for FERMI").pack(side=tk.TOP) usernaam = make_entry(parent, "Username:", 16) passwd = make_entry(parent, "Password:", 16, show="*") b = tk.Button(parent, borderwidth=4, text="Login", width=10, pady=8, command=save_creds) b.pack(side=tk.BOTTOM) usernaam.focus_set() parent.mainloop() return EBbin_288_vtk ########################################## def extract_from_fermi(data, View1 = None, probe_coords = [None, None, None]): global RenderView2 global RenderView1 global Contour1 global x_old global y_old global z_old global drep2 global DataRepresentation3 global DataRepresentation4 global file_generated_vtk global ProbeLocation1 global Arrow1 global first_run global probe_coordtext global probe_datatext try: RenderView2 except: RenderView2 = CreateRenderView() try: if len(username) < 1: print "no login credentials found! reload the data macro!" quit() except NameError: print "no login credentials found! reload the data macro!" quit() try: if len(password) < 1: print "no login credentials found! reload the data macro!" quit() except NameError: print "no login credentials found! reload the data macro!" quit() global view2check # first-time setup of RenderView2 if view2check == False: RenderView2.CompressorConfig = 'vtkSquirtCompressor 0 3' RenderView2.UseLight = 1 RenderView2.CameraPosition = [0.0, 0.0, 11.266552967989236] RenderView2.LightSwitch = 0 RenderView2.RemoteRenderThreshold = 3.0 RenderView2.LODThreshold = 5.0 RenderView2.CameraClippingRange = [9.163887438309343, 13.940551262509075] RenderView2.ViewTime = 0.0 RenderView2.LODResolution = 50.0 RenderView2.Background = [0.31999694819562063, 0.3400015259021897, 0.4299992370489052] RenderView2.CameraParallelScale = 2.982976390813066 # RenderView2.CameraViewUp = [0.38481001973076284, 0.7904359194404722, -0.47658399676563346] # RenderView2.CameraPosition = [-46.47924496442444, 47.37459320454502, 31.735009570020072] # RenderView2.CameraClippingRange = [49.76614521378664, 99.12725822169003] RenderView2.CameraViewUp = [0.14694520322335597, 0.9412344492466398, -0.30411316775342284] RenderView2.CameraPosition = [-152, 56, 100] RenderView2.CameraClippingRange = [0.17597031868451724, 175.97031868451722] RenderView2.CenterAxesVisibility = 0 RenderView2.CameraFocalPoint = [0, 0, 0] RenderView2.CameraParallelScale = 18.941899797184174 RenderView2.CenterOfRotation = [0, 0, 0] RenderView2.Background = [0.0, 0.0, 0.0] view2check = True # possible setup of RenderView1 if View1 != None: RenderView1.CenterOfRotation = View1["CenterOfRotation"] RenderView1.CameraViewUp = View1["CameraViewUp"] RenderView1.CameraFocalPoint = View1["CameraFocalPoint"] RenderView1.CameraClippingRange = View1["CameraClippingRange"] RenderView1.CameraPosition = View1["CameraPosition"] ######################################## try: x_old = x y_old = y z_old = z except NameError: x_old = None y_old = None z_old = None if probe_coords[0] != None: ProbeLocation1.ProbeType.Center = [probe_coords[0], probe_coords[1], probe_coords[2]] x, y, z = ProbeLocation1.ProbeType.Center SetActiveView(RenderView2) ######################################## print "coordinates should be: x:" + str(x) + "|y:" + str(y) + "|z:" + str(z) start = time() loadmsg = Text() DataRepresentation7 = Show() DataRepresentation7.FontFamily = "Arial" DataRepresentation7.FontSize = 35 DataRepresentation7.Position = [0.01,0.5] DataRepresentation7.Opacity = 1.0 loadmsg.Text = "LOADING, DON'T PANIC" Render() if x_old != None and x_old == x and y_old == y and z_old == z: pass #no need to extract the data again else: output_file = write_file(x,y,z, username, password) if x < 1: x = 1 elif x > 128: x = 128 if y < 1: y = 1 elif y > 128: y = 128 if z < 1: z = 1 elif z > 128: z = 128 print "data extracted in " + str(time() - start) + " seconds." Delete(loadmsg) if output_file == None: print "something went wrong with the .vtk file :(" quit() SetActiveView(RenderView2) try: Delete(Contour1) del Contour1 except: print "aint got no contour" try: Delete(drep2) del drep2 except: print "aint got no drep2" try: Delete(DataRepresentation3) except: print "aint got no drep3" try: del DataRepresentation3 except: print "aint got no var drep3" try: Delete(file_generated_vtk) del file_generated_vtk except: print "aint got no file" try: Delete(DataRepresentation4) except: print "aint got no DataRepresentation4" try: Delete(Glyph2) except: print "aint got no Glyph2" try: Delete(glyph) except: print "aint got no glyph" try: Delete(Transform2) except: print "aint got no Transform2" ##################################### file_generated_vtk = LegacyVTKReader( FileNames=[output_file] ) #RenderView1 = GetRenderView() SetActiveView(RenderView2) RenderView2 = GetRenderView() Contour1 = Contour( PointMergeMethod="Uniform Binning" ) SetActiveSource(file_generated_vtk) drep2 = Show() drep2.EdgeColor = [0.0, 0.0, 0.5000076295109483] drep2.SelectionPointFieldDataArrayName = ' Distr_func' drep2.ScalarOpacityUnitDistance = 1.7320508075688776 drep2.Representation = 'Outline' drep2.ScaleFactor = 5.0 Contour1.PointMergeMethod = "Uniform Binning" Contour1.ContourBy = ['POINTS', ' Distr_func'] Contour1.Isosurfaces = [0.0005] SetActiveSource(Contour1) DataRepresentation3 = Show() DataRepresentation3.ScaleFactor = 1.2223547458648683 DataRepresentation3.SelectionPointFieldDataArrayName = 'Normals' DataRepresentation3.EdgeColor = [0.0, 0.0, 0.5000076295109483] ### arrow time ### # Arrow1 = Arrow() # SetActiveSource(Arrow1) # #DataRepresentation4 = Show() # DataRepresentation4 = GetDisplayProperties(Arrow1) # # DataRepresentation4.ScaleFactor = 0.1 # DataRepresentation4.EdgeColor = [0.0, 0.0, 0.5000076295109483] x2 = x - 1 y2 = y - 1 z2 = z - 1 line = x2 + y2*128 + z2*128**2 bmodule = data.GetPointData().GetArray("Babs").GetValue(line) bx = data.GetPointData().GetArray("Bx").GetValue(line) by = data.GetPointData().GetArray("By").GetValue(line) bz = data.GetPointData().GetArray("Bz").GetValue(line) # xorient = math.degrees(math.acos(bx/bmodule)) # yorient = math.degrees(math.acos(bx/math.sqrt(bmodule**2 - by**2))) # zorient = math.degrees(math.acos(bx/math.sqrt(bmodule**2 - bz**2))) # # DataRepresentation4.Scale = [10.0 * bmodule, 10.0 * bmodule, 10.0 * bmodule] # DataRepresentation4.Orientation = [xorient, yorient, zorient] # DataRepresentation4.DiffuseColor = [1.0, 0.0, 0.0] # smarter better faster arrow # SetActiveSource(ProbeLocation1) Transform2 = Transform( Transform="Transform" ) Transform2.Transform = "Transform" Transform2.Transform.Scale = [0.0, 0.0, 0.0] Glyph4 = Glyph( GlyphType="Arrow", GlyphTransform="Transform2" ) Glyph4.SetScaleFactor = 0.1 Glyph4.GlyphTransform = "Transform2" Glyph4.GlyphType = "Arrow" Glyph4.Scalars = ['POINTS', 'Babs'] Glyph4.Vectors = ['POINTS', 'Bfield'] Glyph4.GlyphTransform.Scale = [350.0, 350.0, 350.0] SetActiveSource(Glyph4) glyph = Show() glyph.DiffuseColor = [1.0, 0.0, 0.0] SetActiveView(RenderView1) glyph.Visibility = 0 SetActiveView(RenderView2) glyph.Visibility = 1 ################################################## #TEXTTTTTTTTT ################################################## try: if first_run: pass except NameError: SetActiveView(RenderView1) # probe_coordtext = Text() # probec = Show() # probec.FontFamily = "Arial" # probec.FontSize = 12 # probec.Position = [0.01, 0.01] # probec.Opacity = 1.0 SetActiveView(RenderView2) probe_datatext = Text() probe_data = Show() probe_data.FontFamily = "Arial" probe_data.FontSize = 12 probe_data.Position = [0.01, 0.885] probe_data.Opacity = 1.0 #probe_coordtext.Text = "Probe coordinates: x:" + str(x).zfill(3) + " y:"+str(y).zfill(3) + " z:"+str(z).zfill(3) probe_datatext.Text = "Data at probe location:\nProbe coordinates: x:"+ str(int(x)).zfill(3) + " y:"+str(int(y)).zfill(3) + " z:"+str(int(z)).zfill(3)+"\nDensity: " + str("%.4f" % data.GetPointData().GetArray("Rho").GetValue(line)) + "\nMag.field module: " + str("%.4f" % data.GetPointData().GetArray("Babs").GetValue(line)) try: if first_run: pass # point/trace creation SetActiveView(RenderView1) PointSource2 = PointSource() PointSource2.Center = [x, y, z] tracepoints = Show() tracepoints.ScaleFactor = 0.1 tracepoints.EdgeColor = [0.0, 0.0, 0.5000076295109483] tracepoints.Representation = 'Points' tracepoints.PointSize = 5.0 tracepoints.Visibility = 1 except NameError: pass first_run = False ################################################# SetActiveView(RenderView1) Render() SetActiveView(RenderView2) Render() print 'x: ' + str(x) print 'y: ' + str(y) print 'z: ' + str(z)