Extracting a selection based on conditions

Hello I’d like to know how to select and extract a set of points based on a condition (ie y > 5 && y < 9) for instance. I’d like to know how to do this both manually and how to add it to my python script.

The data is in a ‘table to points’ format, with the xyz in a single blob which makes it difficult to select by a position.

You can use the Find Data dialog (Edit -> Find Data) to query points. Set it up with

Find “Point(s)” from “TableToPoints1”
“Query” “is” “np.logical_and(y > 5, y < 9)”

Then click “Run Selection Query”.

Change the “Show:” field to “Point(s)”.

There currently isn’t a way to set this up with a Python script, but we will be working on adding such a capability for ParaView 5.8.

It says

failed to evaluate expression ‘np.logical_and(y > 5, y < 9)’

Oops, right, you don’t have an array available named ‘y’.

This expression should work:

np.logical_and(points[:,1] > 5, points[:,1] < 9)

1 Like

Great is there a way to extract out and visualize the subset? Pressing extract selection gives an empty spreadsheet.

If the spreadsheet is empty, it means no points satisfied the selection criteria. You may need to adjust the ranges of inclusion in the query.

Once you have some points selected, you can choose Filters -> Extract Selection and click Apply. That will extract the points and you will see them in the Render View.

Thanks for your help so far. Is there a simple way to extract all points a certain distance range from another point? like from 0,0,0. The closest seems to be a manually used ruler but theres no relevant examples of use I can find. Doing it with simple python code doesn’t seem to work either.

You can use this expression the Find Data dialog:

mag(points - [.2, -.3, -.3]) < 0.3

where [0.2, -0.3, -0.3] is the query point and 0.3 is the query radius.

Is there a way of using fields of type string? I get an error if I try queries like VARIAB =='ASTRING'

Please open your own thread.