How to get selection for plot s. over Time of descriptive Statistics Filter?

Hey there,

I fail at making a working selection via script.
How can I determine what to write at Selection=
[…]
plotSelectionOverTime1 = PlotSelectionOverTime(Input=descriptiveStatistics1,
Selection=None)
[…]

Error msg is this: Warning: In /home/ubuntu/OpenFOAM/ThirdParty-dev/ParaView-5.6.0/ParaViewCore/VTKExtensions/Default/vtkSciVizStatistics.cxx, line 581
vtkPSciVizDescriptiveStats (0x55e5205a2ed0): Every requested array wasn’t a scalar or wasn’t present.

The code I got via the Trace function.
Regards,
Terry

Tracing does not work with selection (yet). You have to create the selection manually in your script first.
Use something like :

selection = SelectCells("id <= 35")
plotSelectionOverTime1 = PlotSelectionOverTime(Input=descriptiveStatistics1,
Selection=selection)

Thank you for your very fast reply!

How can I determine an ID for a filter output that does not show in RenderView?

the “id <= 35” is just a dummy formula. How do you select your cells or points usually ?

Usually I use something like:

for i in range(2):
selection = SelectCells(query=“id==” +str(i))
plotSelectionOverTime = PlotSelectionOverTime(Input=contour1, Selection=selection)

However I can’t find a way to determine to select something after using the descriptiveStatistics filter via paraviev.simple as it does not “create a cell to select” like many other filters do.

Maybe I have to go the other way around:

Instead of: select --> plot selection over time

I could try: SaveData with proxy descriptiveStatistics and WriteTimeSteps=1. And write me something to get the data out of all these files and into one I could use with gnuplot…

Right, you want to select rows in a table, i missed that.
There is no SelectRows (yet), but you can do it manually with the following code:

selSource = servermanager.sources.SelectionQuerySource()
selSource.FieldType = "ROW"
selSource.QueryString = "id == 2"
descriptiveStatistics.SMProxy.SetSelectionInput(descriptiveStatistics.Port, selSource.SMProxy, 0)

be aware that the Spreadsheet view does not update itself with these manual selections, so you will have to create a new one to see it.

Thank you so much, I will try that right now. :slight_smile:

If I’m correct the selection is working now with your code.

However I am still not able to use the filter via python
This is the TraceBack:
create a new ‘OpenFOAMReader’
create a new ‘Descriptive Statistics’
Traceback (most recent call last):
File “volumenschwerpunkt.py”, line 39, in
descriptiveStatistics1.AttributeMode = ‘Point Data’
File “/opt/paraviewopenfoam56/lib/python2.7/site-packages/paraview/servermanager.py”, line 471, in setattr
raise ValueError("%s is not a valid value for attribute s." (value, name))
ValueError: Point Data is not a valid value for attribute AttributeMode.

‘Field Data’ is accepted instead of ‘Point Data’ but empty.

Works fine here, could you send a minimal example reproducing the error ?

While making the minimal example I had an Idea and it works now:

Before from the trace:

descriptiveStatistics2 = DescriptiveStatistics(Input=calculator2,
ModelInput=None)
descriptiveStatistics2.AttributeMode = ‘Point Data’
descriptiveStatistics2.VariablesofInterest = [‘U’, ‘alpha.water’, ‘p_rgh’, ‘postion’]
descriptiveStatistics2.Task = 0
descriptiveStatistics2.TrainingFraction = 0.1
descriptiveStatistics2.Deviationsshouldbe = 0

Now Working:
print “create a new ‘Descriptive Statistics’”
descriptiveStatistics1 = DescriptiveStatistics(Input=calculator1, ModelInput=None)
descriptiveStatistics1.AttributeMode = 0
descriptiveStatistics1.VariablesofInterest = [‘U’, ‘alpha.water’, ‘p_rgh’, ‘position’]
descriptiveStatistics1.Task = 0
descriptiveStatistics1.TrainingFraction = 0.1
descriptiveStatistics1.Deviationsshouldbe = 0

Thank you very much for your help!

Great. FYI, on ParaView 5.7, enum in Python should work.

1 Like