emulsim.elements.points module
Provides an element that represents a collection of points.
Element representing a collection of points. |
|
Element representing a collection of points with direction. |
- class ArrowsElement(data: ndarray | None = None, parameters: dict[str, Any] | None = None)[source]
Bases:
PointsElementElement representing a collection of points with direction.
- Parameters:
data (
recarray) – The structured array with entries for ‘position’ and ‘direction’ for all points. For example, the dtype of the array should be [(“position”, float, (dim,)), (“direction”, float, (dim,))], where dim is the dimension of space.parameters (dict) – Additional parameters. Call
show_parameters()for details.
- Parameters Dictionary:
plot_args: Extra arguments for plotting this element (default={})
plot_radius: Radius used for representing the point when plotting (default=1.0)
Parameters of ArrowsElement:
- plot_args
Extra arguments for plotting this element (Default value:
{})- plot_radius
Radius used for representing the point when plotting (Default value:
1.0)
- Parameters:
data – The data describing the state
parameters – Additional parameters that affect the element
Parameters of ArrowsElement:
- plot_args
Extra arguments for plotting this element (Default value:
{})- plot_radius
Radius used for representing the point when plotting (Default value:
1.0)
- classmethod from_position_direction(positions: ndarray, directions: ndarray, parameters: dict[str, Any] | None = None) ArrowsElement[source]
Create element from separately specified positions and directions.
- classmethod from_position_random_direction(positions: ndarray, direction_magnitude: float | ndarray = 1, parameters: dict[str, Any] | None = None, *, rng: Generator | None = None) ArrowsElement[source]
Create element from separately specified positions and directions.
- Parameters:
positions (
ndarray) – The positions of all pointsdirections (float or
ndarray) – The magnitude of the direction vector. Either a single number or an array specifying values for each point can be givenparameters (dict) – Additional parameters. Call
show_parameters()for details.rng (
Generator) – Random number generator (default:default_rng())
- plot(color='red', *args, title: str | None = None, filename: str | None = None, action: Literal['auto', 'close', 'none', 'sca', 'show'] = 'auto', ax_style: dict[str, Any] | None = None, fig_style: dict[str, Any] | None = None, ax=None, **kwargs)[source]
Plot all points of this element.
- Parameters:
color (matplotlib color) – The color with which the points are shown
title (str) – Title of the plot. If omitted, the title might be chosen automatically.
filename (str, optional) – If given, the plot is written to the specified file.
action (str) – Decides what to do with the final figure. If the argument is set to show,
matplotlib.pyplot.show()will be called to show the plot. If the value is auto or none, the figure will be created, but not necessarily shown. The value close closes the figure, after saving it to a file when filename is given.ax_style (dict) – Dictionary with properties that will be changed on the axis after the plot has been drawn by calling
matplotlib.pyplot.setp(). A special item i this dictionary is use_offset, which is flag that can be used to control whether offset are shown along the axes of the plot.fig_style (dict) – Dictionary with properties that will be changed on the figure after the plot has been drawn by calling
matplotlib.pyplot.setp(). For instance, using fig_style={‘dpi’: 200} increases the resolution of the figure.ax (
matplotlib.axes.Axes) – Figure axes to be used for plotting. The special value “create” creates a new figure, while “reuse” attempts to reuse an existing figure, which is the default.
- class PointsElement(data: ndarray | None = None, parameters: dict[str, Any] | None = None)[source]
Bases:
ArrayElementBaseElement representing a collection of points.
- Parameters Dictionary:
plot_args: Extra arguments for plotting this element (default={})
plot_radius: Radius used for representing the point when plotting (default=1.0)
- Parameters:
data – The data describing the state
parameters – Additional parameters that affect the element
Parameters of PointsElement:
- plot_args
Extra arguments for plotting this element (Default value:
{})- plot_radius
Radius used for representing the point when plotting (Default value:
1.0)
- parameters_default = [Parameter(name='plot_radius', default_value=1, cls=<class 'float'>, description='Radius used for representing the point when plotting', choices=None, required=False, hidden=False, extra={})]
parameters (with default values) of this subclass
- Type:
- plot(color='red', *args, title: str | None = None, filename: str | None = None, action: Literal['auto', 'close', 'none', 'sca', 'show'] = 'auto', ax_style: dict[str, Any] | None = None, fig_style: dict[str, Any] | None = None, ax=None, **kwargs)[source]
Plot all points of this element.
- Parameters:
color (matplotlib color) – The color with which the points are shown
title (str) – Title of the plot. If omitted, the title might be chosen automatically.
filename (str, optional) – If given, the plot is written to the specified file.
action (str) – Decides what to do with the final figure. If the argument is set to show,
matplotlib.pyplot.show()will be called to show the plot. If the value is auto or none, the figure will be created, but not necessarily shown. The value close closes the figure, after saving it to a file when filename is given.ax_style (dict) – Dictionary with properties that will be changed on the axis after the plot has been drawn by calling
matplotlib.pyplot.setp(). A special item i this dictionary is use_offset, which is flag that can be used to control whether offset are shown along the axes of the plot.fig_style (dict) – Dictionary with properties that will be changed on the figure after the plot has been drawn by calling
matplotlib.pyplot.setp(). For instance, using fig_style={‘dpi’: 200} increases the resolution of the figure.ax (
matplotlib.axes.Axes) – Figure axes to be used for plotting. The special value “create” creates a new figure, while “reuse” attempts to reuse an existing figure, which is the default.