pynbody.filt.Sphere#
- class pynbody.filt.Sphere(radius: float | str | UnitBase, 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:
Filter
A filter that selects particles within radius of the point cen.
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__(radius: float | str | UnitBase, 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 sphere filter.
- Parameters:
radius – The radius of the sphere. If a string, it is interpreted as a unit string.
cen – The centre of the sphere. If a
pynbody.snapshot.simsnap.SimArray
, units can be provided and will be correctly accounted for.