pynbody.filt

pynbody.filt#

Filters are used to define subsets of simulations, especially (but not exclusively) spatial sub-regions.

The basic idea is that a Filter object stores the abstract definition of the subset, and then it can be called with a simulation to return a boolean array indicating which particles are in the subset. The implementation of filters is designed to be as efficient as possible, and in many cases the selection is done in C with OpenMP parallelisation. Additionally, if a simulation has a pynbody.kdtree.KDTree built (via pynbody.snapshot.simsnap.SimSnap.build_tree()), then the selection can be done using the KDTree, which is considerably faster for very large simulations.

Filters can be combined using the logical operators &, | and ~ to create more complex selections.

For a friendly introduction, see Subviews and Filters.

Classes

And(f1, f2)

A filter that selects particles that are in both of two other filters.

Annulus(r1, r2[, cen])

A filter that selects particles in between two spheres specified by radii r1 and r2 centered on cen.

BandPass(prop, min, max)

Selects particles in a bandpass of a named property

Cuboid(x1[, y1, z1, x2, y2, z2])

A filter that selects particles within a cuboid defined by two opposite corners.

Disc(radius, height[, cen])

A filter that selects particles within a disc of specified extent and thickness.

FamilyFilter(family_)

A filter that selects particles based on their family.

Filter()

Base class for all filters.

HighPass(prop, min)

Selects particles exceeding a specified threshold of a named property

LowPass(prop, max)

Selects particles below a specified threshold of a named property

Not(f)

A filter that selects particles that are not in another filter.

Or(f1, f2)

A filter that selects particles that are in either of two other filters.

SolarNeighborhood([r1, r2, height, cen])

A filter that selects particles in a disc between 2d radii r1 and r2 and thickness height.

Sphere(radius[, cen])

A filter that selects particles within radius of the point cen.

Modules

pynbody.filt.geometry_selection