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

**URL:** https://discourse.paraview.org/t/how-to-get-selection-for-plot-s-over-time-of-descriptive-statistics-filter/2473
**Category:** ParaView Support
**Created:** [August 26, 2019, 6:42am UTC](https://discourse.paraview.org/t/how-to-get-selection-for-plot-s-over-time-of-descriptive-statistics-filter/2473 "2019-08-26T06:42:19Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![Terry](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/t/b9e5f3/32.png) [@Terry](https://discourse.paraview.org/u/Terry)
#### Post date: [August 26, 2019, 6:42am UTC](https://discourse.paraview.org/t/how-to-get-selection-for-plot-s-over-time-of-descriptive-statistics-filter/2473/1 "2019-08-26T06:42:19Z")

</div>

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

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [August 26, 2019, 6:52am UTC](https://discourse.paraview.org/t/how-to-get-selection-for-plot-s-over-time-of-descriptive-statistics-filter/2473/2 "2019-08-26T06:52:05Z")

</div>

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)
```

---

<div class="post-metadata">

### Author: ![Terry](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/t/b9e5f3/32.png) [@Terry](https://discourse.paraview.org/u/Terry)
#### Post date: [August 26, 2019, 6:53am UTC](https://discourse.paraview.org/t/how-to-get-selection-for-plot-s-over-time-of-descriptive-statistics-filter/2473/3 "2019-08-26T06:53:20Z")

</div>

Thank you for your very fast reply!

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

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [August 26, 2019, 6:54am UTC](https://discourse.paraview.org/t/how-to-get-selection-for-plot-s-over-time-of-descriptive-statistics-filter/2473/4 "2019-08-26T06:54:05Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Terry](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/t/b9e5f3/32.png) [@Terry](https://discourse.paraview.org/u/Terry)
#### Post date: [August 26, 2019, 6:57am UTC](https://discourse.paraview.org/t/how-to-get-selection-for-plot-s-over-time-of-descriptive-statistics-filter/2473/5 "2019-08-26T06:57:45Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Terry](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/t/b9e5f3/32.png) [@Terry](https://discourse.paraview.org/u/Terry)
#### Post date: [August 26, 2019, 7:19am UTC](https://discourse.paraview.org/t/how-to-get-selection-for-plot-s-over-time-of-descriptive-statistics-filter/2473/6 "2019-08-26T07:19:43Z")

</div>

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…

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [August 26, 2019, 7:27am UTC](https://discourse.paraview.org/t/how-to-get-selection-for-plot-s-over-time-of-descriptive-statistics-filter/2473/7 "2019-08-26T07:27:18Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Terry](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/t/b9e5f3/32.png) [@Terry](https://discourse.paraview.org/u/Terry)
#### Post date: [August 26, 2019, 7:28am UTC](https://discourse.paraview.org/t/how-to-get-selection-for-plot-s-over-time-of-descriptive-statistics-filter/2473/8 "2019-08-26T07:28:03Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Terry](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/t/b9e5f3/32.png) [@Terry](https://discourse.paraview.org/u/Terry)
#### Post date: [August 26, 2019, 8:00am UTC](https://discourse.paraview.org/t/how-to-get-selection-for-plot-s-over-time-of-descriptive-statistics-filter/2473/9 "2019-08-26T08:00:03Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [August 26, 2019, 8:03am UTC](https://discourse.paraview.org/t/how-to-get-selection-for-plot-s-over-time-of-descriptive-statistics-filter/2473/10 "2019-08-26T08:03:13Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Terry](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/t/b9e5f3/32.png) [@Terry](https://discourse.paraview.org/u/Terry)
#### Post date: [August 26, 2019, 9:08am UTC](https://discourse.paraview.org/t/how-to-get-selection-for-plot-s-over-time-of-descriptive-statistics-filter/2473/11 "2019-08-26T09:08:38Z")

</div>

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!

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [August 26, 2019, 9:11am UTC](https://discourse.paraview.org/t/how-to-get-selection-for-plot-s-over-time-of-descriptive-statistics-filter/2473/12 "2019-08-26T09:11:06Z")

</div>

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