Re: [Paraview] [EXT] Re: Using Pandas in Paraview v5.4.1
Scott, I assume that if I compile a ParaView executable with pandas included, then I could distribute my plugin as xml and everyone could access it.I’m a little unsure but I assume I would also have to recompile the server that we are using on an HPC cluster to include pandas. I’m beginning to see why adding pandas to ParaView has been delayed a few times. Dennis From: Scott Wittenburg [mailto:scott.wittenb...@kitware.com] Sent: Friday, May 11, 2018 3:08 PM To: Dennis Conklin <dennis_conk...@goodyear.com> Cc: Paraview (parav...@paraview.org) <parav...@paraview.org> Subject: Re: [EXT] Re: [Paraview] Using Pandas in Paraview v5.4.1 Hi Dennis, I'm not sure I understand precisely what you mean when you say "compile here with an external python". Do you mean compiling your plugin (which would imply not a simple xml plugin), or compiling ParaView? Even if you compile ParaView on your end with an external python, I don't see how that will result in something that will allow you to distribute your plugin as xml. You could try to distribute a custom ParaView binary (which includes your new plugin as well as pandas python modules), but for that you would normally need to use the ParaView superbuild. Even then I think you would have to tweak the superbuild to get the python to include pandas. Hopefully someone out there with more knowledge can chime in and provide some hints or suggestions. Then maybe we'll find out what you want to do it quite easy, in which case I'll be excited to learn about it :-) Cheers, Scott p.s. I'm sure you may have read through this before, but just in case (or for people who come across this later): https://www.paraview.org/Wiki/ParaView/Plugin_HowTo<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.paraview.org%2FWiki%2FParaView%2FPlugin_HowTo=01%7C01%7Cdennis_conklin%40goodyear.com%7Caaa51a7dfa554f96298a08d5b77288bc%7C939e896692854a9a9f040887efe8aae0%7C0=xbwuecNf2e9PbFYvKjpfDbZS3k6TMAf67OYmHW2S50E%3D=0> On Fri, May 11, 2018 at 12:28 PM, Dennis Conklin <dennis_conk...@goodyear.com<mailto:dennis_conk...@goodyear.com>> wrote: Scott, Interesting idea and I was not aware of any of that. I should be specific that I need to make an xml Server side plugin for general distribution that needs to call pandas to execute. So I don’t think I can get everyone here to load up that virtual environment and install pandas. I think I’m hearing that pandas for everyone is not available unless I compile here with an external python, right? Thanks Dennis From: Scott Wittenburg [mailto:scott.wittenb...@kitware.com<mailto:scott.wittenb...@kitware.com>] Sent: Friday, May 11, 2018 1:21 PM To: Dennis Conklin <dennis_conk...@goodyear.com<mailto:dennis_conk...@goodyear.com>> Cc: Paraview (parav...@paraview.org<mailto:parav...@paraview.org>) <parav...@paraview.org<mailto:parav...@paraview.org>> Subject: [EXT] Re: [Paraview] Using Pandas in Paraview v5.4.1 CAUTION: EXTERNAL email. Please think before clicking on any links or attachments. Hello Dennis, Depending on how you want to use pandas within ParaView, one approach that could work involves creating a virtual environment and installing pandas there. Then a couple of lines of python can make modules installed in that virtualenv available from pvpython. See this blog post for more information: https://blog.kitware.com/using-pvpython-and-virtualenv/<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fblog.kitware.com%2Fusing-pvpython-and-virtualenv%2F=01%7C01%7Cdennis_conklin%40goodyear.com%7Cc0392a7911e348a9ddbf08d5b7639c21%7C939e896692854a9a9f040887efe8aae0%7C0=uJvHsBJNCGSTeklLNAk5QDZ48Ykdf1bdazrnW851AKw%3D=0> Hope this helps, Scott On Fri, May 11, 2018 at 11:11 AM, Dennis Conklin <dennis_conk...@goodyear.com<mailto:dennis_conk...@goodyear.com>> wrote: All, I need some pandas functions for some filters.Pandas, unfortunately is not a simple library (there is no pands.py) – it needs to be installed into your version of python as a module.How can I get this in Paraview (hopefully, without compiling from source).Can I install pandas into the python installation included with the PV download? Thanks Dennis ___ Powered by www.kitware.com<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com=01%7C01%7Cdennis_conklin%40goodyear.com%7Cc0392a7911e348a9ddbf08d5b7639c21%7C939e896692854a9a9f040887efe8aae0%7C0=10I%2BbpN%2Btcwg7aNqw8XEnENPPq4mp654mvc16cC8g%2Bk%3D=0> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fopensource%2Fopensource.html=01%7C01%7Cdennis_conklin%40goodyear.com%7Cc0392a7911e348a9ddbf08d5b7639c21%7C939e896692854a9a9f040887efe8aae0%7C0=hFLWecP
Re: [Paraview] [EXT] RE: [EXTERNAL] Calculating cylindrical coordinates
Guys, Just wanted to wrap up loose ends on this. It turned out the arctan2 call was not the problem – most of the time was spent averaging the nodal values onto the cells, but a separate thread has enabled me to call vtkPointDataToCellData for selected variables within my Programmable Filter. The filter is now ~ 15 times faster than before and my users have stopped grumbling (won’t last though!!) Thanks for all the support! Dennis From: Dennis Conklin Sent: Monday, April 30, 2018 2:08 PM To: 'Cory Quammen' <cory.quam...@kitware.com>; kenichiro yoshimi <rccm.kyosh...@gmail.com> Cc: Paraview (parav...@paraview.org) <parav...@paraview.org> Subject: RE: [Paraview] [EXT] RE: [EXTERNAL] Calculating cylindrical coordinates Cory, No, I’m using numpy.arctan2 – sorry, always think of it as atan2. What I’m doing now is: # Undeformed Sector Angles (degrees about Y-axis, 0=FP) numPts=block.GetNumberOfPoints() node_angles=zeros( (numPts,1) ) x_undef,y_undef,z_undef=calc_node_undeformed_coords(block) node_angles=arctan2(x_undef,z_undef)*180.0/pi return node_angles So, I’m not looping, as you suggest. I am later doing a custom point-data-to-cell-data by looping over millions of cells and finding each cells nodes and averaging them, but I’ve failed to get vtk.vtkPointDataToCellData to work inside my Programmable filter, so I don’t have a good alternative. I keep meaning to take out the cell angles and see how much that speeds it up, but haven’t done that yet. Thanks for looking at this. Dennis From: Cory Quammen [mailto:cory.quam...@kitware.com] Sent: Monday, April 30, 2018 1:44 PM To: kenichiro yoshimi <rccm.kyosh...@gmail.com<mailto:rccm.kyosh...@gmail.com>> Cc: Dennis Conklin <dennis_conk...@goodyear.com<mailto:dennis_conk...@goodyear.com>>; Paraview (parav...@paraview.org<mailto:parav...@paraview.org>) <parav...@paraview.org<mailto:parav...@paraview.org>> Subject: Re: [Paraview] [EXT] RE: [EXTERNAL] Calculating cylindrical coordinates Dennis, First, do you mean numpy.arctan2? I don't see that numpy.atan2 exists,but math.atan2 exists. Second, I suspect you are looping over millions of points in Python and are calling numpy.arctan2 on single X, Y values. Looping in Python like that will be very slow. Instead, you can get all your X values into one numpy array and do the same with your Y values, then make a single call to numpy.atan2. Here's an example: >>> from paraview.simple import * >>> import numpy >>> x = [1, 2, 3, 4] >>> y = [5, 6, 7, 8] >>> numpy.arctan2(y, x) array([ 1.37340077, 1.24904577, 1.16590454, 1.10714872]) To get the X and Y arrays, you can use the numpy adapter: >>> from vtk.numpy_interface import dataset_adapter as dsa >>> wrappedData = dsa.WrapDataObject(polydata) >>> X = wrappedData.Points[:,0] >>> Y = wrappedData.Points[:,1] >>> result = numpy.arctan2(Y, X) Hope that helps, Cory On Sat, Apr 28, 2018 at 1:25 AM, kenichiro yoshimi <rccm.kyosh...@gmail.com<mailto:rccm.kyosh...@gmail.com>> wrote: Hi Dennis, You can calculate cylindrical coordinates by utilizing vtkCylindricalTransform within the python programmable filter. It is something like below and faster than numpy. --- import vtk input = self.GetInput() output = self.GetOutput() transform = vtk.vtkCylindricalTransform() transformFilter = vtk.vtkTransformFilter() transformFilter.SetInputData(input) transformFilter.SetTransform(transform.GetInverse()) transformFilter.Update() output.ShallowCopy(transformFilter.GetOutput()) --- This converts (x,y,z) coordinates to (r,theta,z) coordinates by GetInverse method, where the angles are calculated by the following equation to change range to [0, 2*pi]: theta = pi + atan2(-y, -x). Regards 2018-04-28 5:25 GMT+09:00 Dennis Conklin <dennis_conk...@goodyear.com<mailto:dennis_conk...@goodyear.com>>: Alan, Yes, I am calling it many times at the same angular location, but it’s tough to know you’re at the same angular location without calculating the angle. Also, C++ is definitely orders of magnitude quicker, but once I have to compile routines into Paravew life gets very complicated. We barely survived compiling for cluster use and I haven’t written C++ for at least 20 years. So, if possible, I would like a clever external add-on that wouldn’t require us to re-compile PV everytime we update our version. I have visions of library errors in my nightmares! Dennis From: Scott, W Alan [mailto:wasc...@sandia.gov<mailto:wasc...@sandia.gov>] Sent: Friday, April 27, 2018 4:00 PM To: Dennis Conklin <dennis_conk...@goodyear.com<mailto:dennis_conk...@goodyear.com>>; Paraview (parav...@paraview.org<mailto:parav...@paraview.org>) <parav...@paraview.org<mailto:parav...@paraview.org>> Subject: [
Re: [Paraview] [EXT] Re: vtkPointDataToCellData but only for selected PointData
David, Thanks very much for that – that works and works well. My filter now runs ~15 times faster than it did before I incorporated this. I’m always impressed by the helpfulness of this board. Dennis From: David E DeMarle [mailto:dave.dema...@kitware.com] Sent: Monday, April 30, 2018 3:50 PM To: Dennis Conklin <dennis_conk...@goodyear.com> Cc: Paraview (parav...@paraview.org) <parav...@paraview.org> Subject: Re: [EXT] Re: [Paraview] vtkPointDataToCellData but only for selected PointData This does what you are looking for: import vtk # copy entire structure across self.GetOutputDataObject(0).ShallowCopy(self.GetInputDataObject(0,0)) # use pass arrays to extract a copy with one array of interest myArrays=vtk.vtkPassArrays() myArrays.SetInputDataObject(self.GetInputDataObject(0,0)) myArrays.ClearArrays() myArrays.AddPointDataArray('DISPL') myArrays.AddCellDataArray('') myArrays.AddFieldDataArray('') # use point2cell to operate on the one array we care about p2c = vtk.vtkPointDataToCellData() p2c.SetInputConnection(myArrays.GetOutputPort()) p2c.Update() # iterate over blocks and copy in the result iter=dsa.MultiCompositeDataIterator([p2c.GetOutputDataObject(0), output]) for in_block, output_block in iter: output_block.GetCellData().AddArray(in_block.VTKObject.GetCellData().GetArray('DISPL')) David E DeMarle Kitware, Inc. Principal Engineer 21 Corporate Drive Clifton Park, NY 12065-8662 Phone: 518-881-4909 On Mon, Apr 30, 2018 at 8:52 AM, Dennis Conklin <dennis_conk...@goodyear.com<mailto:dennis_conk...@goodyear.com>> wrote: David, I have not called filters within the Programmable Filter before and I am not getting things hooked up correctly. My attempt is attached. Clearly, I do not understand how to hook the output of 1 filter to the input of the next because I’m getting to the end and getting something with no blocks and no cells. Any hints? Dennis From: David E DeMarle [mailto:dave.dema...@kitware.com<mailto:dave.dema...@kitware.com>] Sent: Tuesday, April 10, 2018 10:14 AM To: Dennis Conklin <dennis_conk...@goodyear.com<mailto:dennis_conk...@goodyear.com>> Cc: Paraview (parav...@paraview.org<mailto:parav...@paraview.org>) <parav...@paraview.org<mailto:parav...@paraview.org>> Subject: [EXT] Re: [Paraview] vtkPointDataToCellData but only for selected PointData WARNING - External email; exercise caution. The pass arrays filter comes to mind. If creating withing your python programmable filter it will be called vtk.vtkPassArrays then follow that with a vtk.vtkPointDataToCellData. David E DeMarle Kitware, Inc. Principal Engineer 21 Corporate Drive Clifton Park, NY 12065-8662 Phone: 518-881-4909 On Tue, Apr 10, 2018 at 10:07 AM, Dennis Conklin <dennis_conk...@goodyear.com<mailto:dennis_conk...@goodyear.com>> wrote: All, Well, this list solved my problem so easily (and made me feel slightly less than the sharpest pencil in the box) yesterday, so I thought I’d try again. I am doing some Python calcs inside a programmable filter and some of the results I want to average from the Points onto the Cells. But, I don’t want all my PointData moved over to CellData – I want to transfer some of them over within my Filter. Right now I’m looping thru all the elements and finding all their nodes, then averaging them and assigning to the cells. It is dog slow and is choking off the usefulness of this filter. Is there anything like vtkPointDataToCellData that lets me specify which quantities to convert – could I do something tricky like store original list of PointData, make up a new list, then run PointDataToCellData, then restore the list of PointData ?? I realize this may have all sorts of unexpected side effects, so I’m just asking! Thanks again, this group is great! Dennis ___ Powered by www.kitware.com<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com=01%7C01%7Cdennis_conklin%40goodyear.com%7Ccdd327b7b83443c9224908d59eed5011%7C939e896692854a9a9f040887efe8aae0%7C0=bFpbI9%2F4eHwIrhf5Sd9f2ynzY%2FvWHiDIlONgpO13J0A%3D=0> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fopensource%2Fopensource.html=01%7C01%7Cdennis_conklin%40goodyear.com%7Ccdd327b7b83443c9224908d59eed5011%7C939e896692854a9a9f040887efe8aae0%7C0=mMExlGeMQKwAob7IUdPyH60WLz420BhmCRMs%2Fp8aLf4%3D=0> Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fparaview.org%2FWiki%2FParaView=01%7C01%7Cdennis_conklin%40goodyear.com%7Ccdd327b7b83443c9224908d59eed5011%7C939e896692854a9a9f040887efe8aae0%7C0=Myi6SWCBnXGSlGEpOScpW0tc83nT6ue%2FjmtzC9G%2FafE%3
Re: [Paraview] [EXT] RE: [EXTERNAL] Calculating cylindrical coordinates
Alan, Yes, I am calling it many times at the same angular location, but it's tough to know you're at the same angular location without calculating the angle. Also, C++ is definitely orders of magnitude quicker, but once I have to compile routines into Paravew life gets very complicated. We barely survived compiling for cluster use and I haven't written C++ for at least 20 years. So, if possible, I would like a clever external add-on that wouldn't require us to re-compile PV everytime we update our version. I have visions of library errors in my nightmares! Dennis From: Scott, W Alan [mailto:wasc...@sandia.gov] Sent: Friday, April 27, 2018 4:00 PM To: Dennis Conklin <dennis_conk...@goodyear.com>; Paraview (parav...@paraview.org) <parav...@paraview.org> Subject: [EXT] RE: [EXTERNAL] [Paraview] Calculating cylindrical coordinates CAUTION: EXTERNAL email. Please think before clicking on any links or attachments. Are there places on the cylinder you are calling atan2 with the same inputs, returning the same data, lots of times? Alternatively, could you calculate this in the simulation, and just add it to the simulation output? I am speculating that a C++ call to atan2 may be faster than numpy? Alan From: ParaView [mailto:paraview-boun...@public.kitware.com] On Behalf Of Dennis Conklin Sent: Friday, April 27, 2018 1:39 PM To: Paraview (parav...@paraview.org<mailto:parav...@paraview.org>) <parav...@paraview.org<mailto:parav...@paraview.org>> Subject: [EXTERNAL] [Paraview] Calculating cylindrical coordinates All, If I wanted to run atan2(X,Y) on millions and millions of nodes to calculate cylindrical coordinates, but found that numpy.atan2 in a Programmable Filter was taking 45 minutes to run, what should I do to make it much faster? Thanks for any hints Dennis ___ 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: https://public.kitware.com/mailman/listinfo/paraview
[Paraview] vtkPointDataToCellData but only for selected PointData
All, Well, this list solved my problem so easily (and made me feel slightly less than the sharpest pencil in the box) yesterday, so I thought I'd try again. I am doing some Python calcs inside a programmable filter and some of the results I want to average from the Points onto the Cells. But, I don't want all my PointData moved over to CellData - I want to transfer some of them over within my Filter. Right now I'm looping thru all the elements and finding all their nodes, then averaging them and assigning to the cells. It is dog slow and is choking off the usefulness of this filter. Is there anything like vtkPointDataToCellData that lets me specify which quantities to convert - could I do something tricky like store original list of PointData, make up a new list, then run PointDataToCellData, then restore the list of PointData ?? I realize this may have all sorts of unexpected side effects, so I'm just asking! Thanks again, this group is great! Dennis ___ 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: https://public.kitware.com/mailman/listinfo/paraview
[Paraview] Normal vector to Exodus Sideset elements
All, I'm sure I'm missing something here, so please knock me up alongside the head and point it out. I load a sideset (surface) from an Exodus file. I end up with a bunch of quads that Paraview conveniently created for me from the surface. I need to calculate a Normal vector for each of these quads. I have tried: Generate surface normal - this is greyed out (wants poly data?) Delaunay 3D on this to generate poly data, which I could then hopefully run Generate surface normal on, but it was still greyed Tried Normal Glyphs which gave me point Normal vectors but gave me a bunch of Triangle and Polygon elements - I'm not sure what's going on here. PointDataToCellData to get GlyphVector for each Cell Python Calculator and ask for area(inputs[0]) the Polygon elements all get an Area of -1 Calculator to get Area_X as product of GlyphVector_X and Area Threshold on Area_X > 0 - don't want negative areas or some boundary cells with GlyphVector_X as negative Python Calculator to get sum(Area_X) This number appears to be about half of my expected number These must be an easier way. I'm not a vtk guru. When I first load my surface, is there some vtk routine I could call within a Programmable filter to get the cell normal? Alternatively, anyone got an easier way to skin this cat? Thanks for any hints you may have. Dennis ___ 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: https://public.kitware.com/mailman/listinfo/paraview
[Paraview] Good neighbor filter
All, I am looking to calculate a mesh quality measure that would be the ratio of the max/min of the element volumes of each element and all it's neighbors (other elements with common nodes). I intend to use this to quantify grid refinement transitions and perhaps establish some design standards for them.I have tried Gradient of Element Volume, but I need to eliminate the distance part of that to get the number that I want.So, if I have a hex element in a regular grid, I would expect to have 26 "neighbor" elements plus the original element. The number I want is (max of 27 element volumes)/(min of 27 element volumes).This quantity will highlight mesh refinement transitions. My question (at last) is:how do I find all the neighbor elements (share at least 1 node) of each element in my model? I'd like to do this in a Programmable Filter. I'm afraid I don't know much about how connectivity is implemented in vtk. Dennis ___ 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: https://public.kitware.com/mailman/listinfo/paraview
[Paraview] Questions on Add Selection/Subtract Selection
All, I am writing some instructional material for my users and am working on "Interactive Selection".As I try to write this I realize that the rules for +/- Selection are confusing to me.Can someone verify that what I'm doing is the intended behavior. If I Click on "Select Cells Through" or "Select Points Through", then Add Selection and Subtract Selection are greyed out and not available. There are instances where I want to combine "Select Cells On", "Select Cells by Polygon", and "Select Cells Through" to finetune my final selection - similar for Points. Add/Subtract don't seem to work between all of the interactive selection methods, which is what I would intuitively expect: For example - click on Add Selection - it will remain highlighted thru the following actions: click on Select Cells On - now you can select cells click again on "Select Cells On" - you can select more cells that are added to the previous selection click on "Select Cells with Polygon" - you can select more cells that are added to the previous selection. click on "Select Block" - block is selected and all previously selected cells are unselected click again on "Select Block" - new block is selected and added to previous selection clock on "Select Cells On" - new cells are selected and previous selection is discarded. The two things which don't seem intuitive are: Why are "Select Cells/Points Through" not using Add Selection - in many cases it is necessary to select using different interactive methods to get the final desired selection. Should Select Block be divided into "Select Block Cells" and "Select Block Points" so that this selection method could be combined with Select Cells/Points On/Through with the "Add Selection" to finetune a selection. Alternately should "Select Block" be smarter and only select Block Cells if the current Selection is Cells, or only select Block Points if the current Selection is Points (and add them to the existing selection instead of replacing it? I realize I may be missing something here, so I'm really just asking for someone to clue me in if I am. Thanks for any insight Dennis ___ 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: https://public.kitware.com/mailman/listinfo/paraview
[Paraview] Finding Data Range Over All Timesteps Python
Bane, You could run Temporal Statistics to get Max and Min over entire time range, then run calculator to get Range as (Max-Min). Then you could run your filter on this and use the variable from the calculator. Hope this helps Dennis ___ 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: https://public.kitware.com/mailman/listinfo/paraview