Export Descriptive statitistics to python

Good day,

I am taking multiple slices through my data and then want to calculate the mean and standard deviation for each slice. I then want to plot the mean and STD against the position of the slice. For this I would prefer to extract the descriptive statistics to python where I would combine the data for plotting.

Within paraview, I see the data I am interested in is located under the attribute ‘Row Data’ in the spreadsheet view. Currently, the only way I can see to get this data out is to export the spreadsheet view to csv file and manipulate the data from there. This is a cumbersome approach.

Is there a better way to get the statistics into python? I have tried servermanager.fetch(‘DescriptiveStatistics1’) but I can’t see how to get the data from there.

Thanks for the help
Thomas

1 Like

A few approaches are possible:

  1. Use “DescriptiveStatistics” filter (server side)
  2. Use servermanager.Fetch in a pvpython script (client side)
  3. Write your own ProgrammableFilter script (server side)

Hi Mathieu,

Thanks for the advice.

I have tried your points 1 & 2, but in both cases I can not get the values for Max, Min, Mean, M2, M3, M4 into python. The best I can do is view them in the spreadsheet view under ‘Row Data’ within python. If the data was point data, it would be easy to get with the GetPointData method, but no similar method seems to exist for Row Data. Is there a method that I am missing that would allow me to get these values into python?

I have never used programmable filters and it seems somewhat daunting. I have spent some time today attempting to use the programmable filter and am able to calculate the standard devuatuib. I am currently using a vtkTable as an output data set type and using output.RowData.append. With this I can view my result in the spreadsheet view under RowData but again I am unable to extract the result.

As you can see, my problem seems to be the extraction of the data rather than the calculation. Can you advise me on the next step?

Thanks again for your help!
Thomas

1 Like

I’m also struggling with the same issue. What method do we need to employ after servermanager.Fetch to retrieve the Row Data?

Please open your own topic.