Clipping
- orbithunter.clipping.clip(orbit_instance, window_dimensions, **kwargs)[source]
Create Orbit instance whose state array is a subdomain of the provided Orbit.
- Parameters:
- orbit_instanceOrbit
The orbit whose state the subdomain is extracted from.
- window_dimensionstuple of tuples.
Contains one tuple for each continuous dimension, each defining the interval of the dimension to slice out.
- kwargsdict
Keyword arguments for Orbit instantiate.
- Returns:
- Orbit
Orbit whose state and parameters reflect the subdomain defined by the provided dimensions.
Notes
The intervals provided refer to the
Orbit._plotting_dimensions()method. The motivation here is to allow for clipping using visualization techniques as a direct guide. If a dimension has zero extent; i.e. equilibrium in that dimension, then the corresponding window_dimension tuple must be passed as (None, None).Examples
Extract subdomain from an Orbit
>>> orb = Orbit(state=np.ones([128, 128, 128, 128]), basis='physical', ... parameters=(100, 100, 100, 100)) >>> one_sixteeth_subdomain_orbit = clip(orb, ((0, 50), (0, 50), (0, 50), (0, 50)))
It is 1/16th the size because it takes half of the points in 4 different dimensions.
- orbithunter.clipping.clipping_mask(orbit_instance, *windows, invert=True)[source]
Produce an array mask which shows the clipped regions corresponding to windows upon plotting.
- Parameters:
- orbit_instanceOrbit
An instance whose state is to be masked.
- windowslist or tuple
An iterable of window tuples; see Notes below.
- invertbool
Whether to logically invert the boolean mask; equivalent to showing the “interior” or “exterior” of the clipping if True or False, respectively.
- Returns:
- Orbit
Orbit instance whose state is a numpy masked array.