sarracen.SarracenDataFrame.arrowplot

SarracenDataFrame.arrowplot(target: Tuple[str, str] | Tuple[str, str, str], x: str | None = None, y: str | None = None, z: str | None = None, xsec: int | None = None, kernel: BaseKernel | None = None, integral_samples: int = 1000, rotation: ndarray | list | Rotation | None = None, rot_origin: ndarray | list | str | None = None, x_arrows: int | None = None, y_arrows: int | None = None, xlim: Tuple[float, float] | None = None, ylim: Tuple[float, float] | None = None, ax: Axes | None = None, qkey: bool = True, qkey_kws: dict | None = None, exact: bool = False, backend: str | None = None, dens_weight: bool | None = None, normalize: bool = False, hmin: bool = False, **kwargs: Any) Axes

Create an SPH interpolated vector field plot of a target vector.

Render the data within a SarracenDataFrame to a 2D matplotlib object, by rendering the values of a target vector. The contributions of all particles near the rendered area are summed and stored to a 2D grid for the x & y axes of the target vector. This data is then used to create an arrow plot using ax.quiver().

Parameters:
  • data (SarracenDataFrame) – Particle data, in a SarracenDataFrame.

  • target (str tuple of shape (2) or (3).) – Column label of the target vector. Shape must match the # of dimensions in data.

  • x (str, optional) – Column label of the x, y & z directional axes. Defaults to the columns detected in data.

  • y (str, optional) – Column label of the x, y & z directional axes. Defaults to the columns detected in data.

  • z (str, optional) – Column label of the x, y & z directional axes. Defaults to the columns detected in data.

  • xsec (float, optional) – The z to take a cross-section at. If none, column interpolation is performed.

  • kernel (BaseKernel, optional) – Kernel to use for smoothing the target data. Defaults to the kernel specified in data.

  • integral_samples (int, optional) – If using column interpolation, the number of sample points to take when approximating the 2D column kernel.

  • rotation (array_like or SciPy Rotation, optional) – The rotation to apply to the data before interpolation. If defined as an array, the order of rotations is [z, y, x] in degrees.

  • rot_origin (array_like or ['com', 'midpoint'], optional) – Point of rotation of the data. Only applies to 3D datasets. If array_like, then the [x, y, z] coordinates specify the point around which the data is rotated. If ‘com’, then data is rotated around the centre of mass. If ‘midpoint’, then data is rotated around the midpoint, that is, min + max / 2. Defaults to the midpoint.

  • x_arrows (int, optional) – Number of arrows in the output image in the x & y directions. Default values are chosen to keep a consistent aspect ratio.

  • y_arrows (int, optional) – Number of arrows in the output image in the x & y directions. Default values are chosen to keep a consistent aspect ratio.

  • xlim (tuple of float, optional) – The minimum and maximum values to use in interpolation, in particle data space. Defaults to the minimum and maximum values of x and y.

  • ylim (tuple of float, optional) – The minimum and maximum values to use in interpolation, in particle data space. Defaults to the minimum and maximum values of x and y.

  • ax (Axes, optional) – The main axes in which to draw the rendered image.

  • qkey (bool, optional) – Whether to include a quiver key on the final plot.

  • qkey_kws (dict, optional) – Keywords to pass through to ax.quiver.

  • exact (bool, optional) – Whether to use exact interpolation of the data. For cross-sections this is ignored. Defaults to False.

  • backend (['cpu', 'gpu'], optional) – The computation backend to use when interpolating this data. Defaults to ‘gpu’ if CUDA is enabled, otherwise ‘cpu’ is used. A manually specified backend in data will override the default.

  • dens_weight (bool, optional) – If True, will plot the target mutliplied by the density. Defaults to True for column-integrated views and False for everything else.

  • normalize (bool, optional) – If True, will normalize the interpolation. Defaults to False (this may change in future versions).

  • hmin (bool, optional) – If True, a minimum smoothing length of 0.5 * pixel size will be imposed. This ensures each particle contributes to at least one grid cell / pixel. Defaults to False (this may change in a future verison).

  • kwargs (other keyword arguments) – Keyword arguments to pass to ax.quiver()

Returns:

The resulting matplotlib axes, which contains the arrow plot.

Return type:

Axes

Raises:
  • ValueError – If x_arrows or y_arrows are less than or equal to zero, or if the specified x and y minimum and maximums result in an invalid region, or if the number of dimensions in the target vector does not match the data, or if data is not 2 or 3-dimensional.

  • KeyError – If target, x, y, z (for 3-dimensional data), mass, density, or smoothing length columns do not exist in data.