[Paraview] calculator filter via python
Berk Geveci
berk.geveci at kitware.com
Wed Jan 7 10:22:48 EST 2009
However, you can get the current time value with:
input = self.GetInputDataObject(0,0)
print input.GetInformation().Get(vtk.vtkDataObject.DATA_TIME_STEPS(),0)
-berk
On Wed, Jan 7, 2009 at 10:11 AM, Utkarsh Ayachit
<utkarsh.ayachit at kitware.com> wrote:
> Alas there's no way for the python programmable filter to ask for a
> particular timestep currently. This should be remedied soon. Feel free
> to add a bug report at:
> www.paraview.org/Bug
>
> Thanks
> Utkarsh
>
> On Fri, Jan 2, 2009 at 4:00 PM, Peter Brady <petertbrady at gmail.com> wrote:
>> I don't think I can do what I originally intended via the calculator
>> filter due to the need to access the data in center[i][k] which is a
>> data array in my script but the function parser won't know what to do
>> with it. I was able to make some good progress using the programmable
>> filter and the information on the wiki.
>>
>> My main question at this point is how do I access the time data from
>> the programmable filter? I am using multiblockdatasets.
>>
>> Thanks,
>> Peter.
>>
>> On Fri, Jan 2, 2009 at 11:04 AM, Peter Brady <petertbrady at gmail.com> wrote:
>>> Hello all,
>>>
>>> I am trying to do calculations based on coordinate locations. In the
>>> GUI I can simply select 'coordsX', 'coordsY', 'coordsZ'. From python
>>> things seem to be more complicated. I've tried the snippet below with
>>> several variations and keep getting errors
>>>
>>> calc_radius = servermanager.filters.Calculator(Input=g_cont)
>>> calc_radius.AddCoordinateScalarVariable('coordsX', 0)
>>> calc_radius.Function =
>>> 'sqrt((coordsX-center[i][0])^2+(coordsY-center[i][1])^2+(coordsZ-center[i][2])^2)'
>>> calc_radius.UpdatePipeline()
>>>
>>> I've also tried
>>> calc_radius.AddCoordinateScalarVariable('coordsX')
>>> but I get the error:
>>> calc_radius.AddCoordinateScalarVariable('coordsX')
>>> TypeError: __call__() takes exactly 1 argument (2 given)
>>>
>>> I've also tried using the scalar array name ('G' in this case) in
>>> place of coordsX but have met the same error message.
>>>
>>> What is the correct way of doing this?
>>>
>>> Also, I've tried using the PV-Dump.py script that was suggested to me
>>> previously but am met with the error:
>>>
>>> Traceback (most recent call last):
>>> File "<console>", line 1, in <module>
>>> File "<string>", line 33, in allToPython
>>> File "<string>", line 48, in proxiesToPython
>>> File "<string>", line 149, in __orderProxies
>>> AttributeError: 'NoneType' object has no attribute 'groups'
>>>
>>> The offending lines are:
>>> def __orderProxies( proxies ):
>>> """Returns an array, where each entry contains the names of the proxies that
>>> depend on the previous array entry."""
>>> patternName = re.compile(' *XMLName: *(.*)')
>>> patternValues = re.compile(' *Values: *(.*)')
>>> patternHex = re.compile('^0x[0-9a-f]+$')
>>> pmanager = servermanager.ProxyManager()
>>>
>>> dependencies = {} # COLLECT DEPS
>>> for group in proxies: # For each proxy
>>> for name in proxies[group]:
>>> dependencies[group+':'+name] = {} # Init its depend.
>>> proxy = proxies[group][name]
>>>
>>> for prop in proxy:
>>> 148 match = patternName.search( str(prop) )
>>> 149 propName = match.groups()[0]
>>>
>>> I was hoping that this script would be very helpful. Anyone else have
>>> similar problems?
>>>
>>> Thanks in advance for your help,
>>> Peter.
>>>
>> _______________________________________________
>> ParaView mailing list
>> ParaView at paraview.org
>> http://www.paraview.org/mailman/listinfo/paraview
>>
> _______________________________________________
> ParaView mailing list
> ParaView at paraview.org
> http://www.paraview.org/mailman/listinfo/paraview
>
More information about the ParaView
mailing list