LoadPart.spectrum#

PartToolsManager.spectrum(var: ndarray, scale: str = 'lin', vmin: float | None = None, vmax: float | None = None, **kwargs: Unpack[SpectrumKwargs]) tuple[ndarray, ndarray][source]

Compute the spectrum of a given particle variable.

Parameters:
- bins: int | np.ndarray, default 100

The bin edges for the histogram.

- normalize: bool, default True

If True, the histogram is normalized.

- nbins: int

The number of bins wanted for the histogram.

- scale: {‘lin’,’log’}, default ‘lin’

The scale of the histogram, linear or logarithmic.

- var: np.ndarray

The chosen variable for the histogram.

- vmin: float, default min(var)

The minimum value of the chosen variable.

- vmax: float, default max(var)

The maximum value of the chosen variable.

Returns:
  • tuple[np.ndarray, np.ndarray]

Examples

  • Example #1: Compute the spectrum of the particles velocity

    >>> import pyPLUTO as pp
    >>> D = pp.LoadPart(0)
    >>> v2 = D.vx1**2 + D.vx2**2 + D.vx3**2
    >>> pp.spectrum(v2, scale="log")