Hi Cornelis, I'm confused a bit. With PV 5.2 when I do Extract Selection with preserve topology on I only get the vtkInsidedness array out from that -- do you also get your other field arrays? I had to use the Append Attributes filter to get all of the arrays back into a single filter output.
Also, I don't see an option for "if(1=vtkInsidedness, ...)" in the Calculator filter. Did you get that to work for you and if you did, what was the full expression? Using the Python Calculator I can do something like "numpy.where(vtkInsidedness>0, -RTData, RTData)" to negate values in the RTData array based on the vtkInsidedness array. Note that I had to use the Calculator fitler to create a double type of array from the original signed char vtkInsidedness array. This is because of the error that you noticed which is that we don't have a way to create a numpy array from a signed char array and thus the Python Calculator fails. To answer your question on how to speed up this process, you can try doing a Python trace and saving that as a Macro button or maybe create a custom filter that combines all of those filters. Details on both of those should be in the ParaView Users Guide. Best, Andy On Tue, Jan 17, 2017 at 5:12 AM, Cornelis Bockemühl < [email protected]> wrote: > Once again: I just see that I received more information than just the > assertion error: > > "" > > Traceback (most recent call last): > > File "<string>", line 4, in <module> > > File "D:\Users\cbockenm\Documents\BTest\ParaView\OwnBinaries\ParaView > 5.1.2\lib\site-packages\paraview\calculator.py", line 122, in execute > > variables = get_arrays(inputs[0].GetAttributes(self. > GetArrayAssociation())) > > File "D:\Users\cbockenm\Documents\BTest\ParaView\OwnBinaries\ParaView > 5.1.2\lib\site-packages\paraview\calculator.py", line 34, in get_arrays > > arrays[varname] = attribs[key] > > File "D:\Users\cbockenm\Documents\BTest\ParaView\OwnBinaries\ParaView > 5.1.2\lib\site-packages\paraview\vtk\numpy_interface\dataset_adapter.py", > line 587, in __getitem__ > > return self.GetArray(idx) > > File "D:\Users\cbockenm\Documents\BTest\ParaView\OwnBinaries\ParaView > 5.1.2\lib\site-packages\paraview\vtk\numpy_interface\dataset_adapter.py", > line 599, in GetArray > > array = vtkDataArrayToVTKArray(vtkarray, self.DataSet) > > File "D:\Users\cbockenm\Documents\BTest\ParaView\OwnBinaries\ParaView > 5.1.2\lib\site-packages\paraview\vtk\numpy_interface\dataset_adapter.py", > line 138, in vtkDataArrayToVTKArray > > narray = numpy_support.vtk_to_numpy(array) > > File "D:\Users\cbockenm\Documents\BTest\ParaView\OwnBinaries\ParaView > 5.1.2\lib\site-packages\vtk\util\numpy_support.py", line 214, in > vtk_to_numpy > > "Unsupported array type %s"%typ > > AssertionError: Unsupported array type 15 > > > "" > > It does not help me a lot, but maybe it indicates to somebody else what > might be the problem!? > > Regards, > Cornelis > > > 2017-01-17 11:08 GMT+01:00 Cornelis Bockemühl < > [email protected]>: > >> Thanks again Andy! >> >> I really appreciate your hints: It has already pointed me into a good >> direction! >> >> Actually what I tried for my purpose was: >> >> 1. do a selection, apply the "extract selection" filter, with the "keep >> topology" option on. With this I am getting just one additional column - >> "vtkInsidedness" - and this tells me whether in the initial data (actually >> cells of an "unstructured grid") an item was selected (value 1) or not >> (value -1). >> >> 2. on top of this I applied the "calculator" filter like you suggested, >> and with just an if(1=vtkInsidedness, ...) I could get exactly what I >> wanted! >> >> Bottom line: these two filters are actually my friends for the purpose! >> >> Only two things I am still struggling: >> >> 1. if I want this procedure to be a bit more simple I should maybe still >> write some kind of "wrapper filter" that does the above steps for me just >> in one. Like derive one filter from the calculator, including the nice >> calculator panel on the left, and just automatically do the "extract >> selection" before applying the calculator >> >> 2. with the "python calculator" I was not successful, and I wonder why!? >> Because if I applied that python calculator to my original "unstructured >> grid" data set everything worked fine (so it is not about missing python >> support!), but if I did the procedure as above, applying the "python >> calculator" on the extracted data, I always got a message: "AssertionError: >> Unsupported array type 15". This was independent on what was the expression >> I tried to apply, even if it was just a constant value! Looking into the >> source code it looks indeed like a mistake if some column has "type 15": I >> found only about 10 type definitions at all... >> >> Regards, >> Cornelis >> >> 2017-01-17 10:51 GMT+01:00 Andy Bauer <[email protected]>: >> >>> Hi Cornelis, >>> >>> How would you like to select the single or group of values to change? >>> Also, how would you like to change them (e.g. the same transformation for >>> each or each with its own transformation)? These two questions are meant to >>> guide you to do what you want in ParaView. >>> >>> You probably want to look at the Python Programmable Filter ( >>> http://www.paraview.org/Wiki/Python_Programmable_Filter) for changing >>> individual array values. If you are working in serial you may also be able >>> to bring in the entities to change based on a selection. A better solution >>> would be to use the global ids filter, then do a selection on what you want >>> and finally pass that in as a secondary input to the Python Programmable >>> filter. >>> >>> Developing your own filter is also a possibility. >>> >>> cheers, >>> Andy >>> >>> On Tue, Jan 17, 2017 at 1:38 AM, Cornelis Bockemühl < >>> [email protected]> wrote: >>> >>>> Dear Andy, >>>> >>>> Thanks for this hint: Indeed I was not fully aware of the way how you >>>> can easily add new calculated columns with these two filters! What they do >>>> is some kind of "vector math", resulting in a new vector that is appended >>>> to the input data set. >>>> >>>> However my question went in the direction of directly editing single >>>> values, or groups of values. >>>> >>>> Example: Assume that we have a data array "Density" in some data set, >>>> then I want to be able to directly change the "density" value for just a >>>> few cells, or even better: for a selected set of data rows. >>>> >>>> Because: If such a thing does not exist yet I would consider trying to >>>> write it myself - but I do not insist on reinventing any wheel! And I am >>>> sometimes astonished how many "wheels" already exist in the ParaView >>>> "world"... >>>> >>>> Regards, >>>> Cornelis >>>> >>>> PS: Why do I never see my own posts to the paraview mailing list? Is >>>> this a bug or a feature or something I am doing wrong? >>>> >>>> 2017-01-17 0:57 GMT+01:00 Andy Bauer <[email protected]>: >>>> >>>>> This can be done through either the calculator or python calculator >>>>> filter. If you're in the spreadsheet view it should switch over to the >>>>> calculator/python calculator output when the filter is applied. >>>>> >>>>> On Mon, Jan 16, 2017 at 5:14 PM, Cornelis Bockemühl < >>>>> [email protected]> wrote: >>>>> >>>>>> Has somebody already written and contributed a filter that allows >>>>>> some simple "spreadsheet like" user manipulation of the data? >>>>>> >>>>>> I mean something that accepts some data input, then allows user >>>>>> changes, and the output would be the changed data set. >>>>>> >>>>>> Regards, >>>>>> Cornelis >>>>>> >>>>>> -- >>>>>> Cornelis Bockemühl >>>>>> Basel, Schweiz >>>>>> >>>>>> _______________________________________________ >>>>>> 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 >>>>>> >>>>>> >>>>> >>>> >>>> >>>> -- >>>> Cornelis Bockemühl >>>> Basel, Schweiz >>>> >>> >>> >> >> >> -- >> Cornelis Bockemühl >> Basel, Schweiz >> > > > > -- > Cornelis Bockemühl > Basel, Schweiz >
_______________________________________________ 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
