Filter¶
-
nata.containers.ParticleDataset.filter(dataset: nata.containers.ParticleDataset, mask: List[bool] = None, quantities: List[str] = None, slicing: slice = None) → nata.containers.ParticleDataset¶ Filters a
nata.containers.ParticleDatasetaccording to a selection of quantities.- Parameters
mask (
np.ndarray, optional) – Array of booleans indicating the particles to be filtered. Particles withTrue(False) mask entries are selected (hidden). The shape ofmaskmust match that of each particle quantity.slicing (
slice, optional) – Slice of particles to be filtered. Acts only on particle indices and not on time, as time slicing should be done on the dataset. When provided together with themask argument, slicing is done on the masked array.quantities (
list, optional) – List of quantities to be filtered, ordered by the way they should be sorted in the returned dataset.
- Returns
nata.containers.ParticleDataset– Filtered dataset with only the quantities selected inquantities.
Examples
The filter plugin is used to get dataset with only a selection, say
'x1'and'x2', of its quantities.>>> from nata.containers import ParticleDataset >>> ds = ParticleDataset("path/to"file") >>> ds_flt = ds.filter(quantities=["x1","p1"])