PlasmaCalcs.tools.properties.elementwise_property
- PlasmaCalcs.tools.properties.elementwise_property(attr, *, as_array=True, array_dim=None, doc=None, default=NO_VALUE)
- return property which returns tuple(element.attr for element in self).
- as_array: bool or ‘xarray’, default True
- return np.array of result instead of list.
- array_dim: None or str
- if provided and as_array=True, return xarray.DataArray instead,with this dimension name, and coord = elements from self.
- doc: None or str
- the docstring for this property
- default: any value, default NO_VALUE
- if provided, use this for any element missing the ‘attr’ attribute, instead of crashing.
The property also supports setting values, e.g.:self.attr = [‘a’, ‘b’, ‘c’, ‘d’] sets self[0].attr=’a’, self[1].attr=’b’, etc.self.attr = ‘common_val’ sets self[0].attr=’common_val’, self[1].attr=’common_val’, etc.- NOTE: to avoid ambiguity, the only non-“common” values are lists and tuples;
- all other types will be treated as “common” (hence, set the same value for each element).
This property does not support deleting values.