Problem with volume calculation

Dear community,
I simulate bubble collapses.
With a pvbatch-script I want to calculate the volume of the bubble.
I use the precompiled version ParaView-5.10.0-RC1-osmesa-MPI-Linux-Python3.9-x86_64
The following function should do this:

def Process( file ):
   xdmf = pv.Xdmf3ReaderS( FileName = [file] )
   xdmf.CellArrays = ['levelset' ]
   bubble = createThreshold( xdmf )
   v = algs.volume( bubble )
   i = sum(v)
   return i

The ´createThreshold´ function creates a dataset which contains only the bubble, therefore the name of its result. In the next step, I want to calculate the volume of the complete ´bubble´-dataset
But during the ´volume ´-algorithm the following error occurs:

Traceback (most recent call last):
  File "/gpfs/scratch/pr62wu/ga87xol2/ALPACA-Hoppe_new_develop/Validation/johnsen_3d_3/../../", line 86, in <module>
  File "/gpfs/scratch/pr62wu/ga87xol2/ALPACA-Hoppe_new_develop/Validation/johnsen_3d_3/../../", line 78, in Main
    i = Process( f )
  File "/gpfs/scratch/pr62wu/ga87xol2/ALPACA-Hoppe_new_develop/Validation/johnsen_3d_3/../../", line 51, in Process
    v = algs.volume( xdmf )
  File "/gpfs/scratch/pr62wu/ga87xol2/ALPACA-Hoppe_new_develop/Paraview/ParaView-5.10.0-RC1-osmesa-MPI-Linux-Python3.9-x86_64/lib/python3.9/site-packages/vtkmodules/numpy_interface/", line 140, in new_dsfunc2
    return dsfunc(ds)
  File "/gpfs/scratch/pr62wu/ga87xol2/ALPACA-Hoppe_new_develop/Paraview/ParaView-5.10.0-RC1-osmesa-MPI-Linux-Python3.9-x86_64/lib/python3.9/site-packages/vtkmodules/numpy_interface/", line 499, in volume
    ds = dataset.NewInstance()
  File "/gpfs/scratch/pr62wu/ga87xol2/ALPACA-Hoppe_new_develop/Paraview/ParaView-5.10.0-RC1-osmesa-MPI-Linux-Python3.9-x86_64/lib/python3.9/site-packages/paraview/", line 432, in __ConvertArgumentsAndCall
    return _getPyProxy(retVal)
  File "/gpfs/scratch/pr62wu/ga87xol2/ALPACA-Hoppe_new_develop/Paraview/ParaView-5.10.0-RC1-osmesa-MPI-Linux-Python3.9-x86_64/lib/python3.9/site-packages/paraview/", line 2574, in _getPyProxy
    classForProxy = ActiveConnection.ProxiesNS.getClass(smproxy)
  File "/gpfs/scratch/pr62wu/ga87xol2/ALPACA-Hoppe_new_develop/Paraview/ParaView-5.10.0-RC1-osmesa-MPI-Linux-Python3.9-x86_64/lib/python3.9/site-packages/paraview/", line 2787, in getClass
    assert not hasattr(cls, nsname)
TypeError: hasattr(): attribute name must be string

Since I use the precompiled files, I can change the file in which the error occurs, but I don’t know, what I have to do.
Can you help me?
Or is there a better way to calculate the volume after all?


You could try to use Python calculator (from Filters menu) above bubble’s threshold. In the Expression field of this calculator call volume(inputs[0]) function to have an array with volumes of cells (then you could sum them etc.).

Best Regards,