pynbody.filt.SolarNeighborhood#

class pynbody.filt.SolarNeighborhood(r1: float | str | UnitBase = Unit('5.00e+00 kpc'), r2: float | str | UnitBase = Unit('1.00e+01 kpc'), height: float | str | UnitBase = Unit('2.00e+00 kpc'), cen: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] = (0, 0, 0))[source]#

Bases: And

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

As for Disc, the galaxy disc is defined in the x-y plane, with the z-axis being the symmetry axis.

Default parameters are provided that are approximately the solar neighborhood (coarsely selected).

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__(r1: float | str | UnitBase = Unit('5.00e+00 kpc'), r2: float | str | UnitBase = Unit('1.00e+01 kpc'), height: float | str | UnitBase = Unit('2.00e+00 kpc'), cen: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] = (0, 0, 0))[source]#

Create a solar neighborhood filter.

Parameters:
  • r1 – The inner radius of the disc. If a string, it is interpreted as a unit string.

  • r2 – The outer radius of the disc. If a string, it is interpreted as a unit string.

  • height – The thickness of the disc. If a string, it is interpreted as a unit string.

  • cen – The centre of the disc. If a pynbody.snapshot.simsnap.SimArray, units can be provided and will be correctly accounted for.

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.