SubsamplingSlice

class PlasmaCalcs.dimensions.subsampling.SubsamplingSlice(info, *, array_dims, snap_applier=None, **extra_info)

Bases: SubsamplingApplier

slice subsampling applier. Expect info to be dict of {array_dim: [start, stop, step]}.

Methods

__init_subclass__(*[, mode])

register subclass as a subsampling mode.

apply(array)

apply subsampling to array; return new array.

apply1d(dict_)

return result of subsampling dict_ of 1d arrays, with keys in array_dims

apply_snap_applier(snap_srcs, *[, missing_ok])

return self.snap_applier(snap_srcs), or snap_srcs unchanged if self.snap_applier=None.

slice([dim])

returns slice for this dim, or dict of {dim: slice} for all dims in array_dims.

start([dim])

returns slice start for this dim, or dict of {dim: slice start} for all array_dims.

step([dim])

returns slice step for this dim, or dict of {dim: slice step} for all array_dims.

stop([dim])

returns slice stop for this dim, or dict of {dim: slice stop} for all array_dims.

_check_info()

checks that self.info is in the expected format.

Attributes

mode

classmethod __init_subclass__(*, mode=None, **kw)

register subclass as a subsampling mode.

_check_info()

checks that self.info is in the expected format. Crash if not.

apply(array)

apply subsampling to array; return new array.

apply1d(dict_)

return result of subsampling dict_ of 1d arrays, with keys in array_dims

apply_snap_applier(snap_srcs, *, missing_ok=True)

return self.snap_applier(snap_srcs), or snap_srcs unchanged if self.snap_applier=None.

missing_ok: bool
whether it is okay for snap_applier to be None
False –> crash with SubsamplingNotFoundError if snap_applier is None.
slice(dim=None)

returns slice for this dim, or dict of {dim: slice} for all dims in array_dims.

start(dim=None)

returns slice start for this dim, or dict of {dim: slice start} for all array_dims.

step(dim=None)

returns slice step for this dim, or dict of {dim: slice step} for all array_dims.

stop(dim=None)

returns slice stop for this dim, or dict of {dim: slice stop} for all array_dims.