Re: [Paraview] [vtkusers] Combining vtk and paraview python scripts
Now that I can load image (uniform rectilinear grid) data using the Python Programmable Source, I'm trying to do this on four gpu nodes (using mpirun -np 4 pvserver). Once I load my image, I thought it would be automatically distributed (equally) to the four nodes, but coloring by process id shows that everything happens on one node. What do I need to do (short of writing out four pvti files and reading them back in) to automatically distribute my data? Thanks. -jeff On 07/21/2015 09:14 AM, Jeff Becker wrote: On 07/20/2015 05:43 PM, Berk Geveci wrote: You probably need to update vtkImageExport and shallow copy its output to the programmable source's output. You also need to add something to the RequestInformation setting the whole extent. You need something like: from paraview import util util.SetOutputWholeExtent(self, [0,nx-1,0,ny-1,0,nz-1]) By the way, there are better ways of getting numpy arrays into VTK than the image import stuff. See some of the earlier blogs here: Right. I found the RequestInformation info above from searching the web. Then I was able to follow the instructions in the ParaView Guide section 13.2.4 Reading binary 2D image. I basically replaced the image import stuff with code analogous to the output assignment, Thanks for your help. ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Search the list archives at: http://markmail.org/search/?q=ParaView Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/paraview
Re: [Paraview] Combining vtk and paraview python scripts
On 07/20/2015 05:43 PM, Berk Geveci wrote: You probably need to update vtkImageExport and shallow copy its output to the programmable source's output. You also need to add something to the RequestInformation setting the whole extent. You need something like: from paraview import util util.SetOutputWholeExtent(self, [0,nx-1,0,ny-1,0,nz-1]) By the way, there are better ways of getting numpy arrays into VTK than the image import stuff. See some of the earlier blogs here: Right. I found the RequestInformation info above from searching the web. Then I was able to follow the instructions in the ParaView Guide section 13.2.4 Reading binary 2D image. I basically replaced the image import stuff with code analogous to the output assignment, Thanks for your help. -jeff http://www.kitware.com/blog/home/user/53/2 Best, -berk On Mon, Jul 20, 2015 at 2:08 PM, Jeff Becker jeffrey.c.bec...@nasa.gov mailto:jeffrey.c.bec...@nasa.gov wrote: Hi, On 07/18/2015 05:17 PM, Berk Geveci wrote: To elaborate on what Andy said, you can stick your entire VTK script in side the programmable source. Which you can use in batch mode as well. If you want to keep your VTK script as a reusable code, I recommend making it a module that you import from the programmable source. So if the last thing my VTK script does is set up a vtkImageImport object should that work as a programmable source (I tried but ParaView didn't get any bounds or scalar field name even though I set them up)? If not, what else do I need to do? Thanks. -jeff Best, -berk On Tue, Jul 14, 2015 at 3:43 PM, Jeff Becker jeffrey.c.bec...@nasa.gov mailto:jeffrey.c.bec...@nasa.gov wrote: On 07/14/2015 12:20 PM, Andy Bauer wrote: ParaView's Python Programmable Filter and Python Programmable Source use VTK Python wrapping to do the work while making it available in Paraview. Check out http://www.paraview.org/Wiki/Python_Programmable_Filter. Thanks. That's pretty neat, but what I'd really like is a standalone script I can run in batch mode (no interaction) to generate one png file per timestep for all the timesteps in the data set. Essentially I'd like a way to construct a pipeline between the vtk.vtkImageImport() object and the ParaView renderView1. -jeff On Tue, Jul 14, 2015 at 2:59 PM, Jeff Becker jeffrey.c.bec...@nasa.gov mailto:jeffrey.c.bec...@nasa.gov wrote: Hi. As a proof of concept, I have a vtk script that reads some binary data, and produces a vti file. I then have a second script that I generated using ParaView's tracing facility while viewing the data. Now I'd like to combine them, so as to eliminate the intermediate file, i.e., go from binary data directly to rendering. To be specific, my vtk script ends like this: steinbmag = steinbmag.reshape(nx,ny,nz).T vtkImporter = vtk.vtkImageImport() vtkImporter.CopyImportVoidPointer(steinbmag, steinbmag.nbytes) vtkImporter.SetDataScalarTypeToFloat() vtkImporter.SetNumberOfScalarComponents(1) vtkImporter.SetDataExtent(0, nx-1, 0, ny-1, 0, nz-1) vtkImporter.SetWholeExtent(0, nx-1, 0, ny-1, 0, nz-1) vtkImporter.SetScalarArrayName('B field magnitude') writer=vtk.vtkXMLImageDataWriter() writer.SetFileName(out_fname) writer.SetInputConnection(vtkImporter.GetOutputPort()) writer.Write() and the ParaView script starts like this: from paraview.simple import * paraview.simple._DisableFirstRenderCameraReset() filepfx = '/nobackup/jcbecker/steinBmag_0' infile = filepfx+'.vti' # create a new 'XML Image Data Reader' steinBmag_ = XMLImageDataReader(FileName=infile) steinBmag_.CellArrayStatus = [] steinBmag_.PointArrayStatus = ['B field magnitude'] # get animation scene animationScene1 = GetAnimationScene() # update animation scene based on data timesteps animationScene1.UpdateAnimationUsingDataTimeSteps() # get active view renderView1 = GetActiveViewOrCreate('RenderView') # uncomment following to set a specific view size renderView1.ViewSize = [1090, 761] I'm looking at the VTK examples and pvpython documentation, but any help is appreciated. Thanks. -jeff ___ Powered by www.kitware.com http://www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please
Re: [Paraview] Combining vtk and paraview python scripts
Hi, On 07/18/2015 05:17 PM, Berk Geveci wrote: To elaborate on what Andy said, you can stick your entire VTK script in side the programmable source. Which you can use in batch mode as well. If you want to keep your VTK script as a reusable code, I recommend making it a module that you import from the programmable source. So if the last thing my VTK script does is set up a vtkImageImport object should that work as a programmable source (I tried but ParaView didn't get any bounds or scalar field name even though I set them up)? If not, what else do I need to do? Thanks. -jeff Best, -berk On Tue, Jul 14, 2015 at 3:43 PM, Jeff Becker jeffrey.c.bec...@nasa.gov mailto:jeffrey.c.bec...@nasa.gov wrote: On 07/14/2015 12:20 PM, Andy Bauer wrote: ParaView's Python Programmable Filter and Python Programmable Source use VTK Python wrapping to do the work while making it available in Paraview. Check out http://www.paraview.org/Wiki/Python_Programmable_Filter. Thanks. That's pretty neat, but what I'd really like is a standalone script I can run in batch mode (no interaction) to generate one png file per timestep for all the timesteps in the data set. Essentially I'd like a way to construct a pipeline between the vtk.vtkImageImport() object and the ParaView renderView1. -jeff On Tue, Jul 14, 2015 at 2:59 PM, Jeff Becker jeffrey.c.bec...@nasa.gov mailto:jeffrey.c.bec...@nasa.gov wrote: Hi. As a proof of concept, I have a vtk script that reads some binary data, and produces a vti file. I then have a second script that I generated using ParaView's tracing facility while viewing the data. Now I'd like to combine them, so as to eliminate the intermediate file, i.e., go from binary data directly to rendering. To be specific, my vtk script ends like this: steinbmag = steinbmag.reshape(nx,ny,nz).T vtkImporter = vtk.vtkImageImport() vtkImporter.CopyImportVoidPointer(steinbmag, steinbmag.nbytes) vtkImporter.SetDataScalarTypeToFloat() vtkImporter.SetNumberOfScalarComponents(1) vtkImporter.SetDataExtent(0, nx-1, 0, ny-1, 0, nz-1) vtkImporter.SetWholeExtent(0, nx-1, 0, ny-1, 0, nz-1) vtkImporter.SetScalarArrayName('B field magnitude') writer=vtk.vtkXMLImageDataWriter() writer.SetFileName(out_fname) writer.SetInputConnection(vtkImporter.GetOutputPort()) writer.Write() and the ParaView script starts like this: from paraview.simple import * paraview.simple._DisableFirstRenderCameraReset() filepfx = '/nobackup/jcbecker/steinBmag_0' infile = filepfx+'.vti' # create a new 'XML Image Data Reader' steinBmag_ = XMLImageDataReader(FileName=infile) steinBmag_.CellArrayStatus = [] steinBmag_.PointArrayStatus = ['B field magnitude'] # get animation scene animationScene1 = GetAnimationScene() # update animation scene based on data timesteps animationScene1.UpdateAnimationUsingDataTimeSteps() # get active view renderView1 = GetActiveViewOrCreate('RenderView') # uncomment following to set a specific view size renderView1.ViewSize = [1090, 761] I'm looking at the VTK examples and pvpython documentation, but any help is appreciated. Thanks. -jeff ___ Powered by www.kitware.com http://www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Search the list archives at: http://markmail.org/search/?q=ParaView Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/paraview ___ Powered by www.kitware.com http://www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Search the list archives at: http://markmail.org/search/?q=ParaView Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/paraview ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Search the list archives at: http://markmail.org/search/?q=ParaView Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/paraview
Re: [Paraview] Combining vtk and paraview python scripts
You probably need to update vtkImageExport and shallow copy its output to the programmable source's output. You also need to add something to the RequestInformation setting the whole extent. You need something like: from paraview import util util.SetOutputWholeExtent(self, [0,nx-1,0,ny-1,0,nz-1]) By the way, there are better ways of getting numpy arrays into VTK than the image import stuff. See some of the earlier blogs here: http://www.kitware.com/blog/home/user/53/2 Best, -berk On Mon, Jul 20, 2015 at 2:08 PM, Jeff Becker jeffrey.c.bec...@nasa.gov wrote: Hi, On 07/18/2015 05:17 PM, Berk Geveci wrote: To elaborate on what Andy said, you can stick your entire VTK script in side the programmable source. Which you can use in batch mode as well. If you want to keep your VTK script as a reusable code, I recommend making it a module that you import from the programmable source. So if the last thing my VTK script does is set up a vtkImageImport object should that work as a programmable source (I tried but ParaView didn't get any bounds or scalar field name even though I set them up)? If not, what else do I need to do? Thanks. -jeff Best, -berk On Tue, Jul 14, 2015 at 3:43 PM, Jeff Becker jeffrey.c.bec...@nasa.gov wrote: On 07/14/2015 12:20 PM, Andy Bauer wrote: ParaView's Python Programmable Filter and Python Programmable Source use VTK Python wrapping to do the work while making it available in Paraview. Check out http://www.paraview.org/Wiki/Python_Programmable_Filter. Thanks. That's pretty neat, but what I'd really like is a standalone script I can run in batch mode (no interaction) to generate one png file per timestep for all the timesteps in the data set. Essentially I'd like a way to construct a pipeline between the vtk.vtkImageImport() object and the ParaView renderView1. -jeff On Tue, Jul 14, 2015 at 2:59 PM, Jeff Becker jeffrey.c.bec...@nasa.gov wrote: Hi. As a proof of concept, I have a vtk script that reads some binary data, and produces a vti file. I then have a second script that I generated using ParaView's tracing facility while viewing the data. Now I'd like to combine them, so as to eliminate the intermediate file, i.e., go from binary data directly to rendering. To be specific, my vtk script ends like this: steinbmag = steinbmag.reshape(nx,ny,nz).T vtkImporter = vtk.vtkImageImport() vtkImporter.CopyImportVoidPointer(steinbmag, steinbmag.nbytes) vtkImporter.SetDataScalarTypeToFloat() vtkImporter.SetNumberOfScalarComponents(1) vtkImporter.SetDataExtent(0, nx-1, 0, ny-1, 0, nz-1) vtkImporter.SetWholeExtent(0, nx-1, 0, ny-1, 0, nz-1) vtkImporter.SetScalarArrayName('B field magnitude') writer=vtk.vtkXMLImageDataWriter() writer.SetFileName(out_fname) writer.SetInputConnection(vtkImporter.GetOutputPort()) writer.Write() and the ParaView script starts like this: from paraview.simple import * paraview.simple._DisableFirstRenderCameraReset() filepfx = '/nobackup/jcbecker/steinBmag_0' infile = filepfx+'.vti' # create a new 'XML Image Data Reader' steinBmag_ = XMLImageDataReader(FileName=infile) steinBmag_.CellArrayStatus = [] steinBmag_.PointArrayStatus = ['B field magnitude'] # get animation scene animationScene1 = GetAnimationScene() # update animation scene based on data timesteps animationScene1.UpdateAnimationUsingDataTimeSteps() # get active view renderView1 = GetActiveViewOrCreate('RenderView') # uncomment following to set a specific view size renderView1.ViewSize = [1090, 761] I'm looking at the VTK examples and pvpython documentation, but any help is appreciated. Thanks. -jeff ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Search the list archives at: http://markmail.org/search/?q=ParaView Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/paraview ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Search the list archives at: http://markmail.org/search/?q=ParaView Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/paraview ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Search the list archives at: http://markmail.org/search/?q=ParaView Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/paraview
Re: [Paraview] Combining vtk and paraview python scripts
ParaView's Python Programmable Filter and Python Programmable Source use VTK Python wrapping to do the work while making it available in Paraview. Check out http://www.paraview.org/Wiki/Python_Programmable_Filter. On Tue, Jul 14, 2015 at 2:59 PM, Jeff Becker jeffrey.c.bec...@nasa.gov wrote: Hi. As a proof of concept, I have a vtk script that reads some binary data, and produces a vti file. I then have a second script that I generated using ParaView's tracing facility while viewing the data. Now I'd like to combine them, so as to eliminate the intermediate file, i.e., go from binary data directly to rendering. To be specific, my vtk script ends like this: steinbmag = steinbmag.reshape(nx,ny,nz).T vtkImporter = vtk.vtkImageImport() vtkImporter.CopyImportVoidPointer(steinbmag, steinbmag.nbytes) vtkImporter.SetDataScalarTypeToFloat() vtkImporter.SetNumberOfScalarComponents(1) vtkImporter.SetDataExtent(0, nx-1, 0, ny-1, 0, nz-1) vtkImporter.SetWholeExtent(0, nx-1, 0, ny-1, 0, nz-1) vtkImporter.SetScalarArrayName('B field magnitude') writer=vtk.vtkXMLImageDataWriter() writer.SetFileName(out_fname) writer.SetInputConnection(vtkImporter.GetOutputPort()) writer.Write() and the ParaView script starts like this: from paraview.simple import * paraview.simple._DisableFirstRenderCameraReset() filepfx = '/nobackup/jcbecker/steinBmag_0' infile = filepfx+'.vti' # create a new 'XML Image Data Reader' steinBmag_ = XMLImageDataReader(FileName=infile) steinBmag_.CellArrayStatus = [] steinBmag_.PointArrayStatus = ['B field magnitude'] # get animation scene animationScene1 = GetAnimationScene() # update animation scene based on data timesteps animationScene1.UpdateAnimationUsingDataTimeSteps() # get active view renderView1 = GetActiveViewOrCreate('RenderView') # uncomment following to set a specific view size renderView1.ViewSize = [1090, 761] I'm looking at the VTK examples and pvpython documentation, but any help is appreciated. Thanks. -jeff ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Search the list archives at: http://markmail.org/search/?q=ParaView Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/paraview ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Search the list archives at: http://markmail.org/search/?q=ParaView Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/paraview
Re: [Paraview] Combining vtk and paraview python scripts
On 07/14/2015 12:20 PM, Andy Bauer wrote: ParaView's Python Programmable Filter and Python Programmable Source use VTK Python wrapping to do the work while making it available in Paraview. Check out http://www.paraview.org/Wiki/Python_Programmable_Filter. Thanks. That's pretty neat, but what I'd really like is a standalone script I can run in batch mode (no interaction) to generate one png file per timestep for all the timesteps in the data set. Essentially I'd like a way to construct a pipeline between the vtk.vtkImageImport() object and the ParaView renderView1. -jeff On Tue, Jul 14, 2015 at 2:59 PM, Jeff Becker jeffrey.c.bec...@nasa.gov mailto:jeffrey.c.bec...@nasa.gov wrote: Hi. As a proof of concept, I have a vtk script that reads some binary data, and produces a vti file. I then have a second script that I generated using ParaView's tracing facility while viewing the data. Now I'd like to combine them, so as to eliminate the intermediate file, i.e., go from binary data directly to rendering. To be specific, my vtk script ends like this: steinbmag = steinbmag.reshape(nx,ny,nz).T vtkImporter = vtk.vtkImageImport() vtkImporter.CopyImportVoidPointer(steinbmag, steinbmag.nbytes) vtkImporter.SetDataScalarTypeToFloat() vtkImporter.SetNumberOfScalarComponents(1) vtkImporter.SetDataExtent(0, nx-1, 0, ny-1, 0, nz-1) vtkImporter.SetWholeExtent(0, nx-1, 0, ny-1, 0, nz-1) vtkImporter.SetScalarArrayName('B field magnitude') writer=vtk.vtkXMLImageDataWriter() writer.SetFileName(out_fname) writer.SetInputConnection(vtkImporter.GetOutputPort()) writer.Write() and the ParaView script starts like this: from paraview.simple import * paraview.simple._DisableFirstRenderCameraReset() filepfx = '/nobackup/jcbecker/steinBmag_0' infile = filepfx+'.vti' # create a new 'XML Image Data Reader' steinBmag_ = XMLImageDataReader(FileName=infile) steinBmag_.CellArrayStatus = [] steinBmag_.PointArrayStatus = ['B field magnitude'] # get animation scene animationScene1 = GetAnimationScene() # update animation scene based on data timesteps animationScene1.UpdateAnimationUsingDataTimeSteps() # get active view renderView1 = GetActiveViewOrCreate('RenderView') # uncomment following to set a specific view size renderView1.ViewSize = [1090, 761] I'm looking at the VTK examples and pvpython documentation, but any help is appreciated. Thanks. -jeff ___ Powered by www.kitware.com http://www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Search the list archives at: http://markmail.org/search/?q=ParaView Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/paraview ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Search the list archives at: http://markmail.org/search/?q=ParaView Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/paraview
Re: [Paraview] Combining vtk and paraview python scripts
All of that functionality is available through pvpython, or pvbatch in parallel. I'd suggest you look into using the GUI's Python trace functionality to help you make that script. pvpython can also be used as an interactive Python shell if you want. On Tue, Jul 14, 2015 at 3:43 PM, Jeff Becker jeffrey.c.bec...@nasa.gov wrote: On 07/14/2015 12:20 PM, Andy Bauer wrote: ParaView's Python Programmable Filter and Python Programmable Source use VTK Python wrapping to do the work while making it available in Paraview. Check out http://www.paraview.org/Wiki/Python_Programmable_Filter. Thanks. That's pretty neat, but what I'd really like is a standalone script I can run in batch mode (no interaction) to generate one png file per timestep for all the timesteps in the data set. Essentially I'd like a way to construct a pipeline between the vtk.vtkImageImport() object and the ParaView renderView1. -jeff On Tue, Jul 14, 2015 at 2:59 PM, Jeff Becker jeffrey.c.bec...@nasa.gov wrote: Hi. As a proof of concept, I have a vtk script that reads some binary data, and produces a vti file. I then have a second script that I generated using ParaView's tracing facility while viewing the data. Now I'd like to combine them, so as to eliminate the intermediate file, i.e., go from binary data directly to rendering. To be specific, my vtk script ends like this: steinbmag = steinbmag.reshape(nx,ny,nz).T vtkImporter = vtk.vtkImageImport() vtkImporter.CopyImportVoidPointer(steinbmag, steinbmag.nbytes) vtkImporter.SetDataScalarTypeToFloat() vtkImporter.SetNumberOfScalarComponents(1) vtkImporter.SetDataExtent(0, nx-1, 0, ny-1, 0, nz-1) vtkImporter.SetWholeExtent(0, nx-1, 0, ny-1, 0, nz-1) vtkImporter.SetScalarArrayName('B field magnitude') writer=vtk.vtkXMLImageDataWriter() writer.SetFileName(out_fname) writer.SetInputConnection(vtkImporter.GetOutputPort()) writer.Write() and the ParaView script starts like this: from paraview.simple import * paraview.simple._DisableFirstRenderCameraReset() filepfx = '/nobackup/jcbecker/steinBmag_0' infile = filepfx+'.vti' # create a new 'XML Image Data Reader' steinBmag_ = XMLImageDataReader(FileName=infile) steinBmag_.CellArrayStatus = [] steinBmag_.PointArrayStatus = ['B field magnitude'] # get animation scene animationScene1 = GetAnimationScene() # update animation scene based on data timesteps animationScene1.UpdateAnimationUsingDataTimeSteps() # get active view renderView1 = GetActiveViewOrCreate('RenderView') # uncomment following to set a specific view size renderView1.ViewSize = [1090, 761] I'm looking at the VTK examples and pvpython documentation, but any help is appreciated. Thanks. -jeff ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Search the list archives at: http://markmail.org/search/?q=ParaView Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/paraview ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Search the list archives at: http://markmail.org/search/?q=ParaView Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/paraview
[Paraview] Combining vtk and paraview python scripts
Hi. As a proof of concept, I have a vtk script that reads some binary data, and produces a vti file. I then have a second script that I generated using ParaView's tracing facility while viewing the data. Now I'd like to combine them, so as to eliminate the intermediate file, i.e., go from binary data directly to rendering. To be specific, my vtk script ends like this: steinbmag = steinbmag.reshape(nx,ny,nz).T vtkImporter = vtk.vtkImageImport() vtkImporter.CopyImportVoidPointer(steinbmag, steinbmag.nbytes) vtkImporter.SetDataScalarTypeToFloat() vtkImporter.SetNumberOfScalarComponents(1) vtkImporter.SetDataExtent(0, nx-1, 0, ny-1, 0, nz-1) vtkImporter.SetWholeExtent(0, nx-1, 0, ny-1, 0, nz-1) vtkImporter.SetScalarArrayName('B field magnitude') writer=vtk.vtkXMLImageDataWriter() writer.SetFileName(out_fname) writer.SetInputConnection(vtkImporter.GetOutputPort()) writer.Write() and the ParaView script starts like this: from paraview.simple import * paraview.simple._DisableFirstRenderCameraReset() filepfx = '/nobackup/jcbecker/steinBmag_0' infile = filepfx+'.vti' # create a new 'XML Image Data Reader' steinBmag_ = XMLImageDataReader(FileName=infile) steinBmag_.CellArrayStatus = [] steinBmag_.PointArrayStatus = ['B field magnitude'] # get animation scene animationScene1 = GetAnimationScene() # update animation scene based on data timesteps animationScene1.UpdateAnimationUsingDataTimeSteps() # get active view renderView1 = GetActiveViewOrCreate('RenderView') # uncomment following to set a specific view size renderView1.ViewSize = [1090, 761] I'm looking at the VTK examples and pvpython documentation, but any help is appreciated. Thanks. -jeff ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Search the list archives at: http://markmail.org/search/?q=ParaView Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/paraview
Re: [Paraview] Python Scripts and memory
Hi Olaf, Given that there is no memory management in your code, it is not surprising that it leaks :-) One option is to use Delete() to get rid of objects after using them. There is a short section talking about it here: http://paraview.org/Wiki/ParaView/Python_Scripting The even better approach would be to create the pipeline and all the views only once and then simply update the filename in the loop. That would guarantee that all resources from a previous timestep are released when the next one executes. Best, -berk On Mon, Mar 25, 2013 at 10:38 AM, Dr. Olaf Ippisch olaf.ippi...@iwr.uni-heidelberg.de wrote: Dear Paraview developers and users, I have some problems when using the python interface to paraview. I attached a small program I wrote to visualize data from several time steps of a simulation. Two things are unclear to me: - The program contains a loop over several files to be read from disk and visualized. However, if I start the program, the memory consumption of the python interpreter is growing steadily with each iteration. It seems that the memory allocated for python objects storing data and results is never freed again. Is there some command to tell the interpreter to release the vtk/paraview data structures? - In line 9 I create a text label. I can set its content and also manipulate its position. However, I was not able to change the size of the text field. For large numbers the text is just cut. I tried to play with props.Position2, but I did not have any success. What is the trick? Best regards, Olaf Ippisch -- Dr. Olaf Ippisch Universität Heidelberg Interdisziplinäres Zentrum für Wissenschaftliches Rechnen Im Neuenheimer Feld 368, Raum 4.24 Tel: 06221/548252 Fax: 06221/548884 Mail: Im Neuenheimer Feld 368, 69120 Heidelberg e-mail: olaf.ippi...@iwr.uni-heidelberg.de ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Follow this link to subscribe/unsubscribe: http://www.paraview.org/mailman/listinfo/paraview ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Follow this link to subscribe/unsubscribe: http://www.paraview.org/mailman/listinfo/paraview
Re: [Paraview] Python Scripts and memory
Dear Berk, thank you for the fast response and for pointing me to the right point in the a bit scattered Paraview Python documentation. You do not possibly also have a clue how to get the size of the text field right? Best regards, Olaf Am 26.03.13 13:33, schrieb Berk Geveci: Hi Olaf, Given that there is no memory management in your code, it is not surprising that it leaks :-) One option is to use Delete() to get rid of objects after using them. There is a short section talking about it here: http://paraview.org/Wiki/ParaView/Python_Scripting The even better approach would be to create the pipeline and all the views only once and then simply update the filename in the loop. That would guarantee that all resources from a previous timestep are released when the next one executes. Best, -berk On Mon, Mar 25, 2013 at 10:38 AM, Dr. Olaf Ippisch olaf.ippi...@iwr.uni-heidelberg.de mailto:olaf.ippi...@iwr.uni-heidelberg.de wrote: Dear Paraview developers and users, I have some problems when using the python interface to paraview. I attached a small program I wrote to visualize data from several time steps of a simulation. Two things are unclear to me: - The program contains a loop over several files to be read from disk and visualized. However, if I start the program, the memory consumption of the python interpreter is growing steadily with each iteration. It seems that the memory allocated for python objects storing data and results is never freed again. Is there some command to tell the interpreter to release the vtk/paraview data structures? - In line 9 I create a text label. I can set its content and also manipulate its position. However, I was not able to change the size of the text field. For large numbers the text is just cut. I tried to play with props.Position2, but I did not have any success. What is the trick? Best regards, Olaf Ippisch -- Dr. Olaf Ippisch Universität Heidelberg Interdisziplinäres Zentrum für Wissenschaftliches Rechnen Im Neuenheimer Feld 368, Raum 4.24 Tel: 06221/548252 Fax: 06221/548884 Mail: Im Neuenheimer Feld 368, 69120 Heidelberg e-mail: olaf.ippi...@iwr.uni-heidelberg.de mailto:olaf.ippi...@iwr.uni-heidelberg.de ___ Powered by www.kitware.com http://www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Follow this link to subscribe/unsubscribe: http://www.paraview.org/mailman/listinfo/paraview -- Dr. Olaf Ippisch Universität Heidelberg Interdisziplinäres Zentrum für Wissenschaftliches Rechnen Im Neuenheimer Feld 368, Raum 4.24 Tel: 06221/548252 Fax: 06221/548884 Mail: Im Neuenheimer Feld 368, 69120 Heidelberg e-mail: olaf.ippi...@iwr.uni-heidelberg.de ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Follow this link to subscribe/unsubscribe: http://www.paraview.org/mailman/listinfo/paraview
Re: [Paraview] Python Scripts and memory
You do not possibly also have a clue how to get the size of the text field right? Sorry. I don't have an answer for this. Not sure that I understand the question even :-) Hopefully, someone else that is more knowledgeable in this will answer. On Tue, Mar 26, 2013 at 8:44 AM, Dr. Olaf Ippisch olaf.ippi...@iwr.uni-heidelberg.de wrote: Dear Berk, thank you for the fast response and for pointing me to the right point in the a bit scattered Paraview Python documentation. You do not possibly also have a clue how to get the size of the text field right? Best regards, Olaf Am 26.03.13 13:33, schrieb Berk Geveci: Hi Olaf, Given that there is no memory management in your code, it is not surprising that it leaks :-) One option is to use Delete() to get rid of objects after using them. There is a short section talking about it here: http://paraview.org/Wiki/ParaView/Python_Scripting The even better approach would be to create the pipeline and all the views only once and then simply update the filename in the loop. That would guarantee that all resources from a previous timestep are released when the next one executes. Best, -berk On Mon, Mar 25, 2013 at 10:38 AM, Dr. Olaf Ippisch olaf.ippi...@iwr.uni-heidelberg.de mailto:olaf.ippi...@iwr.uni-heidelberg.de wrote: Dear Paraview developers and users, I have some problems when using the python interface to paraview. I attached a small program I wrote to visualize data from several time steps of a simulation. Two things are unclear to me: - The program contains a loop over several files to be read from disk and visualized. However, if I start the program, the memory consumption of the python interpreter is growing steadily with each iteration. It seems that the memory allocated for python objects storing data and results is never freed again. Is there some command to tell the interpreter to release the vtk/paraview data structures? - In line 9 I create a text label. I can set its content and also manipulate its position. However, I was not able to change the size of the text field. For large numbers the text is just cut. I tried to play with props.Position2, but I did not have any success. What is the trick? Best regards, Olaf Ippisch -- Dr. Olaf Ippisch Universität Heidelberg Interdisziplinäres Zentrum für Wissenschaftliches Rechnen Im Neuenheimer Feld 368, Raum 4.24 Tel: 06221/548252 Fax: 06221/548884 Mail: Im Neuenheimer Feld 368, 69120 Heidelberg e-mail: olaf.ippi...@iwr.uni-heidelberg.de mailto:olaf.ippi...@iwr.uni-heidelberg.de ___ Powered by www.kitware.com http://www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Follow this link to subscribe/unsubscribe: http://www.paraview.org/mailman/listinfo/paraview -- Dr. Olaf Ippisch Universität Heidelberg Interdisziplinäres Zentrum für Wissenschaftliches Rechnen Im Neuenheimer Feld 368, Raum 4.24 Tel: 06221/548252 Fax: 06221/548884 Mail: Im Neuenheimer Feld 368, 69120 Heidelberg e-mail: olaf.ippi...@iwr.uni-heidelberg.de ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Follow this link to subscribe/unsubscribe: http://www.paraview.org/mailman/listinfo/paraview
[Paraview] Python Scripts and memory
Dear Paraview developers and users, I have some problems when using the python interface to paraview. I attached a small program I wrote to visualize data from several time steps of a simulation. Two things are unclear to me: - The program contains a loop over several files to be read from disk and visualized. However, if I start the program, the memory consumption of the python interpreter is growing steadily with each iteration. It seems that the memory allocated for python objects storing data and results is never freed again. Is there some command to tell the interpreter to release the vtk/paraview data structures? - In line 9 I create a text label. I can set its content and also manipulate its position. However, I was not able to change the size of the text field. For large numbers the text is just cut. I tried to play with props.Position2, but I did not have any success. What is the trick? Best regards, Olaf Ippisch -- Dr. Olaf Ippisch Universität Heidelberg Interdisziplinäres Zentrum für Wissenschaftliches Rechnen Im Neuenheimer Feld 368, Raum 4.24 Tel: 06221/548252 Fax: 06221/548884 Mail: Im Neuenheimer Feld 368, 69120 Heidelberg e-mail: olaf.ippi...@iwr.uni-heidelberg.de #!pvpython from paraview.simple import * from glob import glob from re import search def SurfacePlot(r,outputFilename,cameraFocalPoint,cameraPosition,time): lt = MakeBlueToRedLT(0.0,1.0) view = CreateRenderView() t=Text() text = %d h % (time) t.Text = text Show(t,view) props=GetDisplayProperties(t) props.Position=[0.85,0.95] props.Justification='Right' Show(r,view) props=GetDisplayProperties(r) props.LookupTable = lt # setup view view.ViewSize=[800,800] view.CameraViewUp=[0.0,0.0,1.0] view.CameraFocalPoint=cameraFocalPoint view.CameraPosition=cameraPosition view.CenterAxesVisibility = 0 props.Ambient = 0.25 # first plot props.Representation = 'Surface' props.ColorArrayName='conc' bar = CreateScalarBar(LookupTable=lt, Title=Concentration) bar.Orientation='Horizontal' bar.TitleFontSize=14 bar.LabelFontSize=10 bar.Position=[0.65,0.05] bar.Position2=[0.3,0.1] view.Representations.append(bar) WriteImage(outputFilename,view,Magnification=2) def ContourPlot(r,outputFilename,cameraFocalPoint,cameraPosition): lt = MakeBlueToRedLT(0.0,1.0) view = CreateRenderView() t=Text() text = %d h % (time) t.Text = text Show(t,view) props=GetDisplayProperties(t) props.Position=[0.85,0.95] props.Justification='Right' s = Show(r,view) props=GetDisplayProperties(r) props.LookupTable = lt # setup view view.ViewSize=[800,800] view.CameraViewUp=[0.0,0.0,1.0] view.CameraFocalPoint=cameraFocalPoint view.CameraPosition=cameraPosition view.CenterAxesVisibility = 0 # first plot props.Representation = 'Outline' c= Contour(r) c.Isosurfaces=[0.2,0.4,0.6,0.8] c.ComputeScalars = True dp = GetDisplayProperties(c) if ((int(r.PointData[0].GetRange()[1]/0.2)-int(r.PointData[0].GetRange()[0]/0.2))0) : dp.ColorArrayName='conc' dp.LookupTable = lt Show(c,view) bar = CreateScalarBar(LookupTable=lt, Title=Concentration) bar.Orientation='Horizontal' bar.TitleFontSize=12 bar.LabelFontSize=8 bar.Position=[0.65,0.05] bar.Position2=[0.3,0.1] view.Representations.append(bar) WriteImage(outputFilename,view,Magnification=2) def newFilename(base,number): return %s_%05d.png % (base,number) def fileTime(filename): return int(search(r'\d+', filename).group(0)) cameraFocalPoint=[-0.32,0.32,0.2] cameraPosition=[1.25,1.25,1.0] fnameList = glob(conc_*.vtr) fnameList.sort(key=fileTime) for fname in fnameList: print Reading data from ,fname time = (fileTime(fname)-3600)/3600 f = OpenDataFile(fname) f.UpdatePipeline() r= Transform(Input=f) r.Transform.Rotate = [0,-90,0] r.Transform.Translate = [0,0,0] i=time print Writing , newFilename(surface,i) SurfacePlot(r,newFilename(surface,i),cameraFocalPoint,cameraPosition,time) print Writing , newFilename(contour,i) ContourPlot(r,newFilename(contour,i),cameraFocalPoint,cameraPosition) i = i +1 ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Follow this link to subscribe/unsubscribe: http://www.paraview.org/mailman/listinfo/paraview
[Paraview] Python scripts and exit
When I run pvbatch, with the following script, pvbatch never exits. Is there a way to get pvbatch to exit? # write a file f = open('/... /working.txt', 'w') f.write('script worked\n') f.close() # exit exit() Thanks, Alan W. Alan Scott ParaView Support Manager GAITS Sandia National Laboratories, MS 0822 Org 9326 - Building 880 A1-C (505) 284-0932 FAX (505) 284-5619 - ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Follow this link to subscribe/unsubscribe: http://www.paraview.org/mailman/listinfo/paraview
Re: [Paraview] Python scripts and exit
That worked for me for bin/pvbatch scriptname. I did get 2 debug leak warnings but no problems exiting. If I comment out exit(), I don't get the leaks. When I ran in parallel I get similar behavior with respect to using exit(). I do have to use the -sym flag (mpirun -np X bin/pvbatch -sym scriptname) though with pvbatch. Maybe that's what you're missing. Andy On Tue, Feb 21, 2012 at 1:57 PM, Scott, W Alan wasc...@sandia.gov wrote: When I run pvbatch, with the following script, pvbatch never exits. Is there a way to get pvbatch to exit? # write a file f = open('/… /working.txt', 'w') f.write('script worked\n') f.close() # exit exit() Thanks, Alan W. Alan Scott ParaView Support Manager GAITS Sandia National Laboratories, MS 0822 Org 9326 - Building 880 A1-C (505) 284-0932 FAX (505) 284-5619 - ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Follow this link to subscribe/unsubscribe: http://www.paraview.org/mailman/listinfo/paraview ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Follow this link to subscribe/unsubscribe: http://www.paraview.org/mailman/listinfo/paraview
Re: [Paraview] Python scripts with PyQt4
PyQt can be made to work with paraview. Make sure paraview and pyqt use the same version of qt. It works for me using qt 4.6.2 compiled from source, and system pyqt (apt-get install python-qt4.) Don't create a QApplication or call exec_(), paraview already has an application event loop running. A minimal example would look like: from PyQt4 import QtGui b = QtGui.QPushButton(click me) b.show() But... due to the way paraview embeds python you can't use pyqt signal/slot callbacks without some hackery. Paraview creates multiple python interpreter contexts, so callbacks don't automatically execute under the correct context. The issue is described here: http://www.vtk.org/pipermail/vtk-developers/2009-June/006091.html You can work around the issue by wrapping python functions that are called via qt signals with @callback_wrapper. Here is a minimal example that shows a combo box, changing selection in the combo box creates objects in paraview: def callback_wrapper(func): A decorator that wraps a python function with a vtk callback v = paraview.vtk.vtkObject() def wrap(*args, **kwargs): v._args = args v._kwargs = kwargs v.Modified() def callback(o, e): func(*v._args, **v._kwargs) v.AddObserver(ModifiedEvent, callback) return wrap @callback_wrapper def onComboChanged(value): print You selected:, value if value == Sphere: Sphere() if value == Cone: Cone() if value == Cylinder: Cylinder() from PyQt4 import QtCore, QtGui c = QtGui.QComboBox() for s in [Sphere, Cone, Cylinder]: c.addItem(s) c.connect(c, QtCore.SIGNAL('currentIndexChanged(const QString)'), onComboChanged) c.show() One final disclaimer: if errors occur while executing pyqt code, paraview can hang instead of reporting the error message and returning... Pat On Sat, Apr 17, 2010 at 1:39 PM, Berk Geveci berk.gev...@kitware.comwrote: Hi Stefan, I am afraid what you are trying to do is not supported. I am saying not supported rather than impossible because someone smarter than me may be able to figure it out. We never envisioned it as a use case. I think you have two choices: use C++ to extend ParaView or use PyQt from python/pvpython building the GUI from scratch. If you are interested in the second case, I have some code that shows how to embed the render window(s) into PyQt widgets. -berk On Fri, Apr 9, 2010 at 2:39 PM, Stefan Kroboth m...@stefan-kroboth.com wrote: Hello! I've build a Gui in the QtDesigner and converted it into a *.py file using pyuic4. Then I wrote a small program which loads and shows this Window. This program works fine in Python 2.6 but fails in the ParaView python shell. Since I'm new to Qt I don't know where to look for help. Is it even possible to display custom Windows? This is the code I tried (based on a tutorial): import sys from paraview.simple import * from PyQt4 import QtCore, QtGui from MITgui import Ui_MIT_Automator class Qt_MIT_Gui(QtGui.QMainWindow): def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self.ui = Ui_MIT_Automator() self.ui.setupUi(self) if __name__ == __main__: bla = QtGui.QApplication(sys.argv) test = Qt_MIT_Gui() test.show() sys.exit(test.exec_()) 1. The first problem is sys.argv. I solve that by assigning [path to the script] to it. 2. When 1. is solved, it gets stuck in the line bla = QtGui.QApplication(sys.argv). When I comment that line, it ... 3. ... gets to QtGui.QWidget.__init__(self, parent), where it gets stuck again. ParaView just doesn't do anything and has to be killed. I tried a lot of things, which were mostly just random alterations (because of my lack of knowledge). It would be very nice if someone could provide me a minimal example of how to load and display a Qt gui (if this is even possible). Please excuse once again my bad englisch :) Thanks, Stefan ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Follow this link to subscribe/unsubscribe: http://www.paraview.org/mailman/listinfo/paraview ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Follow this link to subscribe/unsubscribe: http://www.paraview.org/mailman/listinfo/paraview ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Follow this link to
Re: [Paraview] Python scripts with PyQt4
Hi Stefan, I am afraid what you are trying to do is not supported. I am saying not supported rather than impossible because someone smarter than me may be able to figure it out. We never envisioned it as a use case. I think you have two choices: use C++ to extend ParaView or use PyQt from python/pvpython building the GUI from scratch. If you are interested in the second case, I have some code that shows how to embed the render window(s) into PyQt widgets. -berk On Fri, Apr 9, 2010 at 2:39 PM, Stefan Kroboth m...@stefan-kroboth.com wrote: Hello! I've build a Gui in the QtDesigner and converted it into a *.py file using pyuic4. Then I wrote a small program which loads and shows this Window. This program works fine in Python 2.6 but fails in the ParaView python shell. Since I'm new to Qt I don't know where to look for help. Is it even possible to display custom Windows? This is the code I tried (based on a tutorial): import sys from paraview.simple import * from PyQt4 import QtCore, QtGui from MITgui import Ui_MIT_Automator class Qt_MIT_Gui(QtGui.QMainWindow): def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self.ui = Ui_MIT_Automator() self.ui.setupUi(self) if __name__ == __main__: bla = QtGui.QApplication(sys.argv) test = Qt_MIT_Gui() test.show() sys.exit(test.exec_()) 1. The first problem is sys.argv. I solve that by assigning [path to the script] to it. 2. When 1. is solved, it gets stuck in the line bla = QtGui.QApplication(sys.argv). When I comment that line, it ... 3. ... gets to QtGui.QWidget.__init__(self, parent), where it gets stuck again. ParaView just doesn't do anything and has to be killed. I tried a lot of things, which were mostly just random alterations (because of my lack of knowledge). It would be very nice if someone could provide me a minimal example of how to load and display a Qt gui (if this is even possible). Please excuse once again my bad englisch :) Thanks, Stefan ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Follow this link to subscribe/unsubscribe: http://www.paraview.org/mailman/listinfo/paraview ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Follow this link to subscribe/unsubscribe: http://www.paraview.org/mailman/listinfo/paraview
[Paraview] Python scripts with PyQt4
Hello! I've build a Gui in the QtDesigner and converted it into a *.py file using pyuic4. Then I wrote a small program which loads and shows this Window. This program works fine in Python 2.6 but fails in the ParaView python shell. Since I'm new to Qt I don't know where to look for help. Is it even possible to display custom Windows? This is the code I tried (based on a tutorial): import sys from paraview.simple import * from PyQt4 import QtCore, QtGui from MITgui import Ui_MIT_Automator class Qt_MIT_Gui(QtGui.QMainWindow): def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self.ui = Ui_MIT_Automator() self.ui.setupUi(self) if __name__ == __main__: bla = QtGui.QApplication(sys.argv) test = Qt_MIT_Gui() test.show() sys.exit(test.exec_()) 1. The first problem is sys.argv. I solve that by assigning [path to the script] to it. 2. When 1. is solved, it gets stuck in the line bla = QtGui.QApplication(sys.argv). When I comment that line, it ... 3. ... gets to QtGui.QWidget.__init__(self, parent), where it gets stuck again. ParaView just doesn't do anything and has to be killed. I tried a lot of things, which were mostly just random alterations (because of my lack of knowledge). It would be very nice if someone could provide me a minimal example of how to load and display a Qt gui (if this is even possible). Please excuse once again my bad englisch :) Thanks, Stefan ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Follow this link to subscribe/unsubscribe: http://www.paraview.org/mailman/listinfo/paraview
Re: [Paraview] python scripts
That's weird. from paraview import servermanager should work from all the 3 locations client, pvbatch or pvpython. Can you try the following script and print your path in all the three applications? import sys print sys.path Utkarsh Patrick Shinpaugh wrote: Hi, I've been writing some python scripts and running them through the paraview GUI. I start the scripts with from paraview import servermanager When I use pvpython or pvbatch to run the same scripts I receive an error: [project] pvpython paraview.py Traceback (most recent call last): File paraview.py, line 1, in module from paraview import servermanager File /home/project/paraview.py, line 1, in module from paraview import servermanager ImportError: cannot import name servermanager After messing with this for a while I finally tried: import servermanager which worked. Question: Why is there a difference in the way the servermanager is imported between paraview gui and pvpython/pvbatch? Have other people run across this issue? This is version 3.2.2. Is it possible there is something wrong my build? If this is something I just have to live with, is there a way to prevent the error from closing the script/interpreter, check to see if the first import failed and then run the second import? Thanks, Pat ___ ParaView mailing list ParaView@paraview.org http://www.paraview.org/mailman/listinfo/paraview
Re: [Paraview] python scripts
I created the script you posted. The results of each are displayed below: pvpython ~/paraview-test-path.py ['/home/project', '/usr/local/ParaView-3.2.2/lib/paraview-3.2', '/usr/lib/python25.zip', '/usr/lib/python2.5', '/usr/lib/python2.5/plat-linux2', '/usr/lib/python2.5/lib-tk', '/usr/lib/python2.5/lib-dynload', '/usr/lib/python2.5/site-packages', '/usr/lib/python2.5/site-packages/Numeric', /usr/lib/python2.5/site-packages/PIL', '/usr/lib/python2.5/site-packages/gst-0.10', '/usr/lib/python2.5/site-packages/gtk-2.0'] pvbatch ~/paraview-test-path.py ['/home/project', '/usr/local/ParaView-3.2.2/lib/paraview-3.2', '/usr/lib/python25.zip', '/usr/lib/python2.5', '/usr/lib/python2.5/plat-linux2', /usr/lib/python2.5/lib-tk', '/usr/lib/python2.5/lib-dynload', '/usr/lib/python2.5/site-packages', '/usr/lib/python2.5/site-packages/Numeric', /usr/lib/python2.5/site-packages/PIL', '/usr/lib/python2.5/site-packages/gst-0.10', '/usr/lib/python2.5/site-packages/gtk-2.0'] from paraview gui - tools/python shell/run script ['/usr/local/ParaView-3.2.2/lib/paraview-3.2', '/usr/lib/python25.zip', '/usr/lib/python2.5', '/usr/lib/python2.5/plat-linux2', '/usr/lib/python2.5/lib-tk', /usr/lib/python2.5/lib-dynload', '/usr/lib/python2.5/site-packages', '/usr/lib/python2.5/site-packages/Numeric', /usr/lib/python2.5/site-packages/PIL', /usr/lib/python2.5/site-packages/gst-0.10', '/usr/lib/python2.5/site-packages/gtk-2.0'] Interestingly, the only difference is the home directory at the beginning for pvbatch/pvpython... Any ideas? Pat Utkarsh Ayachit wrote: That's weird. from paraview import servermanager should work from all the 3 locations client, pvbatch or pvpython. Can you try the following script and print your path in all the three applications? import sys print sys.path Utkarsh Patrick Shinpaugh wrote: Hi, I've been writing some python scripts and running them through the paraview GUI. I start the scripts with from paraview import servermanager When I use pvpython or pvbatch to run the same scripts I receive an error: [project] pvpython paraview.py Traceback (most recent call last): File paraview.py, line 1, in module from paraview import servermanager File /home/project/paraview.py, line 1, in module from paraview import servermanager ImportError: cannot import name servermanager After messing with this for a while I finally tried: import servermanager which worked. Question: Why is there a difference in the way the servermanager is imported between paraview gui and pvpython/pvbatch? Have other people run across this issue? This is version 3.2.2. Is it possible there is something wrong my build? If this is something I just have to live with, is there a way to prevent the error from closing the script/interpreter, check to see if the first import failed and then run the second import? Thanks, Pat -- Patrick Shinpaugh Virginia Tech UVAG System Administrator/Programmer 540-231-2054 ___ ParaView mailing list ParaView@paraview.org http://www.paraview.org/mailman/listinfo/paraview