ArraySelectableChildHaver
- class PlasmaCalcs.tools.array_select.ArraySelectableChildHaver
Bases:
objectclass which provides select_… methods for a child object.
indicate the attribute name of the child object via ‘array_selectable_child’ kwarg at subclass creation.
E.g., class SnapList(…, array_selectable_child=’x’)–> self.select_i_closest(5) will return i such that self.x[i] is closest to 5.selections which return values (e.g. select_closest, but not select_i_closest)will always return the values from self, not the child.E.g. self.select_closest(5) returns self[i] such that self.x[i] is closest to 5.Implemented using __init_subclass__ to make pretty docstrings.Methods
__init_subclass__(*[, array_selectable_child])called when subclassing ArraySelectableChildHaver; sets cls.select_.
- classmethod __init_subclass__(*, array_selectable_child=None, **kw_super)
called when subclassing ArraySelectableChildHaver; sets cls.select_… methods.
array_selectable_child: None or strattribute name of child object which will be used for select_… methods.if None, no select_… methods will be added.the select_… methods are:select_i_closest, select_closest,select_i_before, select_before, select_all_before,select_i_after, select_after, select_all_after,select_i_between, select_betweenalso sets self.array_selectable_child = array_selectable_child, for bookkeeping reasons.