Sweep¶
-
class
Sweep
(x, y, data, labels=None, tags=None)¶ 2D parameter sweep with
x
andy
1D array parameters anddata
2D array resultAttributes: - x : array_like
1D array with x-axis values – usually the primary parameter being swept.
- y : array_like
1D array with y-axis values – usually the secondary parameter.
- data : array_like
2D array with
shape == (x.size, y.size)
containing the main result data.- labels : dict
Plot labels: ‘title’, ‘x’, ‘y’ and ‘data’.
- tags : dict
Any additional user defined variables.
Methods
__getitem__
(item)Same rules as numpy indexing colorbar
(**kwargs)Draw a colorbar with the label of Sweep.data
cropped
([x, y])Return a copy with data cropped to the limits in the x and/or y axes interpolated
([mul, size, kind])Return a copy with interpolate data using scipy.interpolate.interp1d
mirrored
([axis])Return a copy with data mirrored in around specified axis plot
(**kwargs)Plot a 2D colormap of Sweep.data
save_txt
(filename)Save text file with 3 columns: x, y, data. -
__getitem__
(item)¶ Same rules as numpy indexing
-
colorbar
(**kwargs)¶ Draw a colorbar with the label of
Sweep.data
-
cropped
(x=None, y=None)¶ Return a copy with data cropped to the limits in the x and/or y axes
A call with x=[-1, 2] will leave data only where -1 <= x <= 2.
Parameters: - x, y : Tuple[float, float]
Min and max data limit.
Returns:
-
interpolated
(mul=None, size=None, kind='linear')¶ Return a copy with interpolate data using
scipy.interpolate.interp1d
Call with
mul=2
to double the size of the x-axis and interpolate data to match. To interpolate in both axes pass a tuple, e.g.mul=(4, 2)
.Parameters: - mul : Union[int, Tuple[int, int]]
Number of times the size of the axes should be multiplied.
- size : Union[int, Tuple[int, int]]
New size of the axes. Zero will leave size unchanged.
- kind
Forwarded to
scipy.interpolate.interp1d
.
Returns:
-
mirrored
(axis='x')¶ Return a copy with data mirrored in around specified axis
Only makes sense if the axis starts at 0.Parameters: - axis : ‘x’ or ‘y’
Returns:
-
plot
(**kwargs)¶ Plot a 2D colormap of
Sweep.data
Parameters: - **kwargs
Forwarded to
matplotlib.pyplot.pcolormesh()
.
-
save_txt
(filename)¶ Save text file with 3 columns: x, y, data.
Parameters: - filename : str