pyoculus.utils.convergence_domain
This module provides functions to make and plot a convergence domain.
For each pair in a grid of (x1, x2) points, it tries to find a cretain fixed point and the store the convergence behaviour.
- authors:
Ludovic Rais (ludovic.rais@epfl.ch)
Functions
|
Compute where the FixedPoint solver converges to for each of the [x1, x2] point pair. |
|
Plot the convergence domain for the FixedPoint solver in the X1s-X2s plane. |
- pyoculus.utils.convergence_domain.compute_convergence_domain(map: BaseMap, x1s: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], x2s: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], find_with_iota: bool = True, eps: float = 0.001, **kwargs) tuple
Compute where the FixedPoint solver converges to for each of the [x1, x2] point pair. If a point converges, it is assigned a number which is the index corresponding to the equal first fixedpoint converging to the same place, otherwise it is assigned -1. The number corresponds to the index of the fixed point in the returned list of fixed points.
- Parameters:
map (pyoculus.maps) – The problem to solve.
x1s (np.ndarray) – The x1 values of the meshgrid.
x2s (np.ndarray) – The x2 values of the meshgrid.
find_with_iota (bool, optional) – Whether to use the find_with_iota method. Defaults to True.
eps (float, optional) – The tolerance for the comparison with the fixed points. Defaults to 1e-3.
- Keyword Arguments:
m (int) – The poloidal mode to use.
n (int) – The toroidal mode to use.
tol (float) – The tolerance of the fixed point finder.
t (float) – The parameter t for the find method.
nrestart (int) – The number of restarts for the fixed point finder.
niter (int) – The number of iterations for the fixed point finder.
- Returns:
A tuple containing: - np.ndarray: The meshgrid of x1s and x2s, the assigned number for each point in the meshgrid, and the list of all fixed points objects convergent or not. - np.ndarray: The list of fixed points.
- Return type:
tuple
- pyoculus.utils.convergence_domain.plot_convergence_domain(X1s: array, X2s: array, assigned_to: array, fixed_points: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], colors=None, **kwargs) tuple
Plot the convergence domain for the FixedPoint solver in the X1s-X2s plane. If ax is None, a new figure is created, otherwise the plot is added to the existing figure.
- Parameters:
X1s (np.ndarray) – The x1 values of the meshgrid.
X2s (np.ndarray) – The x2 values of the meshgrid.
assigned_to (np.ndarray) – The assigned number for each point in the meshgrid.
fixed_points (list) – The list of fixed points object (FixedPoint.OutputData).
colors (np.ndarray, optional) – The colors to use. Defaults to None. Should be of dimension (k, 3 or 4) for RGB/RGBA with k at least the number of fixed points plus one.
- Keyword Arguments:
ax (matplotlib.axes.Axes, optional) – The axes to plot on. Defaults to None.
- Returns:
- A tuple containing:
fig (matplotlib.figure.Figure): The figure object.
ax (matplotlib.axes.Axes): The axes object.
- Return type:
tuple