synthesizer.particle.utils

A submodule containing utility functions for particle distributions.

Functions

synthesizer.particle.utils.calculate_smoothing_lengths(coordinates, kernel_gamma=1.4, num_neighbours=32, speedup_fac=2, dimension=3, boxsize=None)[source]

Calculate smoothing lengths based on the kth nearest neighbour distance.

This is approximately what is done in SPH codes to calculate the smoothing length for each particle.

Adapted from the Swiftsimio implementation (https://github.com/SWIFTSIM/swiftsimio)

Parameters:
  • coordinates (unyt_array) – The coordinates to calculate the smoothing lengths for.

  • kernel_gamma (optional) – The kernel gamma of the kernel being used. (default: 1.4)

  • num_neighbours (optional) – The number of neighbours to encompass.

  • speedup_fac (optional) – A parameter that neighbours is divided by to provide a speed-up by only searching for a lower number of neighbours. For example, if neighbours is 32, and speedup_fac is 2, we only search for 16 (32 / 2) neighbours, and extend the smoothing length out to (speedup)**(1/dimension) such that we encompass an approximately higher number of neighbours. A factor of 2 gives smoothing lengths the same as the full search within 10%, good enough for visualisation.

  • dimension (optional) – The dimensionality of the problem (used for speedup_fac calculation).

  • boxsize (optional) – The boxsize to use for the periodic boundary conditions. If None, no periodic boundary conditions are used

Returns:

An unyt array of smoothing lengths.

Return type:

smoothing lengths

Examples using synthesizer.particle.utils.calculate_smoothing_lengths

Plot line of sight diagnostics

Plot line of sight diagnostics

Plot line of sight optical depth calculations

Plot line of sight optical depth calculations

Rotating particle distributions

Rotating particle distributions