swiftsimio.visualisation.projection_backends.subsampled_extreme module

Sub-samples smoothing kernel with at least 64^2 samples.

Sub-sampled smoothing kernel with each kernel evaluated at least 64^2 times. This uses a dithered pre-calculated kernel for cell overlaps at small scales, and at large scales uses subsampling.

Uses double precision.

This is the original smoothing code. This provides a paranoid supersampling of the kernel.

swiftsimio.visualisation.projection_backends.subsampled_extreme.scatter(x: float64, y: float64, m: float32, h: float32, res: int, box_x: float64 = 0.0, box_y: float64 = 0.0) ndarray[source]

Create a weighted scatter plot.

Computes contributions to from particles with positions (x,`y`) with smoothing lengths h weighted by quantities m. This includes periodic boundary effects.

Parameters:
  • x (np.ndarray[np.float64]) – Array of x-positions of the particles. Must be bounded by [0, 1].

  • y (np.ndarray[np.float64]) – Array of y-positions of the particles. Must be bounded by [0, 1].

  • m (np.ndarray[np.float32]) – Array of masses (or otherwise weights) of the particles.

  • h (np.ndarray[np.float32]) – Array of smoothing lengths of the particles.

  • res (int) – The number of pixels along one axis, i.e. this returns a square of res * res.

  • box_x (np.float64) – Box size in x, in the same rescaled length units as x and y. Used for periodic wrapping.

  • box_y (np.float64) – Box size in y, in the same rescaled length units as x and y. Used for periodic wrapping.

Returns:

Pixel grid of quantity.

Return type:

np.ndarray[np.float32, np.float32, np.float32]

See also

scatter_parallel

Parallel implementation of this function.

Notes

Explicitly defining the types in this function allows for a 25-50% performance improvement. In our testing, using numpy floats and integers is also an improvement over using the numba ones.

Uses 4x the number of sampling points as in scatter in subsampled.py.

swiftsimio.visualisation.projection_backends.subsampled_extreme.scatter_parallel(x: float64, y: float64, m: float32, h: float32, res: int, box_x: float64 = 0.0, box_y: float64 = 0.0) ndarray[source]

Parallel implementation of scatter.

Create a weighted scatter plot. Computes contributions from particles with positions (x,`y`) with smoothing lengths h weighted by quantities m.

This includes periodic boundary effects.

Parameters:
  • x (np.ndarray[np.float64]) – Array of x-positions of the particles. Must be bounded by [0, 1].

  • y (np.ndarray[np.float64]) – Array of y-positions of the particles. Must be bounded by [0, 1].

  • m (np.ndarray[np.float32]) – Array of masses (or otherwise weights) of the particles.

  • h (np.ndarray[np.float32]) – Array of smoothing lengths of the particles.

  • res (int) – The number of pixels along one axis, i.e. this returns a square of res * res.

  • box_x (np.float64) – Box size in x, in the same rescaled length units as x and y. Used for periodic wrapping.

  • box_y (np.float64) – Box size in y, in the same rescaled length units as x and y. Used for periodic wrapping.

Returns:

Pixel grid of quantity.

Return type:

np.ndarray[np.float32, np.float32, np.float32]

See also

scatter

Creates 2D scatter plot from SWIFT data.

Notes

Explicitly defining the types in this function allows for a 25-50% performance improvement. In our testing, using numpy floats and integers is also an improvement over using the numba ones.

Uses 4x the number of sampling points as in scatter_parallel in subsampled.py.