pynbody.filt.BandPass#

class pynbody.filt.BandPass(prop: str, min: float | str | UnitBase, max: float | str | UnitBase)[source]#

Bases: Filter

Selects particles in a bandpass of a named property

Methods

__call__(sim)

Return a boolean mask indicating which particles are in the filter.

cubic_cell_intersection(centroids)

Compute the intersection with cubic cells with the specified centroids.

where(sim)

Return the indices of particles that are in the filter.

__init__(prop: str, min: float | str | UnitBase, max: float | str | UnitBase)[source]#

Create a bandpass filter.

Parameters:
  • prop – The name of the simulation array to filter on.

  • min – The minimum value of the property. If a string, it is interpreted as a unit string.

  • max – The maximum value of the property. If a string, it is interpreted as a unit string.

cubic_cell_intersection(centroids)#

Compute the intersection with cubic cells with the specified centroids.

This is currently used by the swift loader to figure out which cells to load

where(sim: snapshot.SimSnap)#

Return the indices of particles that are in the filter.

This is a convenience method that is equivalent to np.where(f(sim)) but may be more efficient for some filters.