swiftsimio.visualisation.projection_backends.renormalised module

Renormalised projection visualisation.

This version of the function is the same as fast but provides an explicit renormalisation of each kernel such that the mass is conserved up to floating point precision.

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

Creates 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.array[float64]) – array of x-positions of the particles. Must be bounded by [0, 1].

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

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

  • h (np.array[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 (float64) – box size in x, in the same rescaled length units as x and y. Used for periodic wrapping.

  • box_y (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.array[float32, float32, 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.

swiftsimio.visualisation.projection_backends.renormalised.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

Creates 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.array[float64]) – array of x-positions of the particles. Must be bounded by [0, 1].

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

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

  • h (np.array[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 (float64) – box size in x, in the same rescaled length units as x and y. Used for periodic wrapping.

  • box_y (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.array[float32, float32, 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.