synthesizer.integrate

A module containing integration helper functions.

This module contains functions that help with numerical integration. These functions wrap C extensions and abstract away boilerplate code (i.e. deciding which integration method to use, etc.).

Example

integrate_last_axis(xs, ys, nthreads=1, method=”trapz”)

Functions

synthesizer.integrate.integrate_last_axis(xs, ys, nthreads=1, method='trapz')[source]

Integrate the last axis of an N-dimensional array.

Parameters:
  • xs (array-like) – The x-values to integrate over.

  • ys (array-like) – The y-values to integrate.

  • nthreads (int) – The number of threads to use for the integration. If -1, all available threads will be used.

  • method (str) – The integration method to use. Options are ‘trapz’ or ‘simps’.

Returns:

The result of the integration.

Return type:

array-like

Raises:

InconsistentArguments – If an invalid method is passed.