WallGo.PotentialTools.integrals.JfIntegral

class JfIntegral(bUseAdaptiveInterpolation=True, initialInterpolationPointCount=1000, returnValueCount=2)[source]

Bases: InterpolatableFunction

Fermionic \(J_f(x)\), in practice use with \(x = m^2 / T^2\). This is very similar to the bosonic counterpart \(J_b\).

Optional argument returnValueCount should be set by the user if using list-valued functions.

Parameters:
  • bUseAdaptiveInterpolation (bool, optional) – Whether or not to use adaptive interpolation. The default is True.

  • initialInterpolationPointCount (int, optional) – Initial number of points for the interpolation. The default is 1000.

  • returnValueCount (int, optional) – Number of outputs returned by the function. The default is 1.

__init__(bUseAdaptiveInterpolation=True, initialInterpolationPointCount=1000, returnValueCount=2)[source]

Optional argument returnValueCount should be set by the user if using list-valued functions.

Parameters:
  • bUseAdaptiveInterpolation (bool, optional) – Whether or not to use adaptive interpolation. The default is True.

  • initialInterpolationPointCount (int, optional) – Initial number of points for the interpolation. The default is 1000.

  • returnValueCount (int, optional) – Number of outputs returned by the function. The default is 1.

Return type:

None

Methods

__init__([bUseAdaptiveInterpolation, ...])

Optional argument returnValueCount should be set by the user if using list-valued functions.

derivative(x[, order, bUseInterpolation, ...])

Takes derivative of the function at points x.

disableAdaptiveInterpolation()

Disables adaptive interpolation functionality.

enableAdaptiveInterpolation()

Enables adaptive interpolation functionality.

evaluate(x[, bUseInterpolatedValues])

Evaluate the function.

evaluateInterpolation(x)

Evaluates our interpolated function at input x

extendInterpolationTable(newMin, newMax, ...)

Extend our interpolation table.

hasInterpolation()

Returns true if we have an interpolation table.

interpolationRangeMax()

Get upper limit of our current interpolation table.

interpolationRangeMin()

Get lower limit of our current interpolation table.

newInterpolationTable(xMin, xMax, numberOfPoints)

Creates a new interpolation table over given range.

newInterpolationTableFromValues(x, fx[, ...])

Like initializeInterpolationTable but takes in precomputed function values 'fx'

numPoints()

How many input points in our interpolation table.

readInterpolationTable(fileToRead)

Reads precalculated values from a file and does cubic interpolation.

scheduleForInterpolation(x, fx)

Add x, f(x) pairs to our pending interpolation table update

setExtrapolationType(extrapolationTypeLower, ...)

Changes extrapolation behavior, default is NONE.

writeInterpolationTable(outputFileName)

Write our interpolation table to file.

Attributes

SMALL_NUMBER

derivative(x, order=1, bUseInterpolation=True, epsilon=1e-16, scale=1.0)

Takes derivative of the function at points x. If bUseInterpolation=True, will compute derivatives from the interpolated function (if it exists). nth order derivative can be taken with order=n, however we only support interpolated derivative of order=1,2 for now. epsilon and scale are parameters for the helpers.derivative() routine.

Parameters:
  • x (list[float] or np.ndarray) – Points where the derivative will be evaluated.

  • order (int, optional) – Order of the derivative to take. The default is 1.

  • bUseInterpolation (bool, optional) – Whether or not to use interpolation to evaluate the function. The default is True.

  • epsilon (float, optional) – Relative accuracy at which the function is evaluated. The default is 1e-16.

  • scale (float, optional) – Scale at which the function changes by O(1). The default is 1.0.

Returns:

Value of the derivative at x.

Return type:

list[float | np.ndarray] or np.ndarray

disableAdaptiveInterpolation()

Disables adaptive interpolation functionality.

Return type:

None

enableAdaptiveInterpolation()

Enables adaptive interpolation functionality. Will clear internal work arrays.

Return type:

None

evaluate(x, bUseInterpolatedValues=True)

Evaluate the function.

Parameters:
  • x (list[float] or np.ndarray) – Points where the function will be evaluated.

  • bUseInterpolatedValues (bool, optional) – Whether or not to use interpolation to evaluate the function. The default is True.

Returns:

Value of the function at x.

Return type:

list[float | np.ndarray] or np.ndarray

evaluateInterpolation(x)

Evaluates our interpolated function at input x

Parameters:

x (list[float] | ndarray | float)

Return type:

ndarray

extendInterpolationTable(newMin, newMax, pointsMin, pointsMax)

Extend our interpolation table. NB: This will reset internally accumulated data of adaptive interpolation.

Parameters:
  • newMin (float) – New minimal value at which the interpolation starts.

  • newMax (float) – New maximal value at which the interpolation starts.

  • pointsMin (int) – Minimal number of points to use.

  • pointsMax (int) – Maximal number of points to use.

Return type:

None

hasInterpolation()

Returns true if we have an interpolation table.

Return type:

bool

interpolationRangeMax()

Get upper limit of our current interpolation table.

Return type:

float

interpolationRangeMin()

Get lower limit of our current interpolation table.

Return type:

float

newInterpolationTable(xMin, xMax, numberOfPoints)

Creates a new interpolation table over given range. This will purge any existing interpolation information.

Parameters:
  • xMin (float) – Minimal interpolation point.

  • xMax (float) – Maximal interpolation point.

  • numberOfPoints (int) – Number of points to use in the interpolation.

Return type:

None

newInterpolationTableFromValues(x, fx, derivatives=None, splineDegree=3)

Like initializeInterpolationTable but takes in precomputed function values ‘fx’

Parameters:
  • x (list[float] or np.ndarray) – Points where the function was evaluated.

  • fx (list[float | np.ndarray] or np.ndarray) – Value of the function at x.

  • derivatives (list[outputType] | None) – List containing the values of each derivative of the function at x. If None, computes the derivatives from the interpolated spline.

  • splineDegree (int)

Return type:

None

numPoints()

How many input points in our interpolation table.

Return type:

int

readInterpolationTable(fileToRead)

Reads precalculated values from a file and does cubic interpolation. Each line in the file must be of form x f(x). For vector valued functions: x f1(x) f2(x)

Parameters:

fileToRead (str) – Path of the file where the interpolation table is stored.

Return type:

None

scheduleForInterpolation(x, fx)

Add x, f(x) pairs to our pending interpolation table update

Parameters:
  • x (list[float] or np.ndarray) – Points where the function was evaluated.

  • fx (list[float | np.ndarray] or np.ndarray) – Value of the function at x.

Return type:

None

setExtrapolationType(extrapolationTypeLower, extrapolationTypeUpper)

Changes extrapolation behavior, default is NONE. See the enum class EExtrapolationType. NOTE: This will effectively prevent adaptive updates to the interpolation table. NOTE 2: Calling this function will force a rebuild of our interpolation table.

Parameters:
  • extrapolationTypeLower (EExtrapolationType) – Extrapolation type when below the interpolation range.

  • extrapolationTypeUpper (EExtrapolationType) – Extrapolation type when above the interpolation range.

Return type:

None

writeInterpolationTable(outputFileName)

Write our interpolation table to file.

Parameters:

outputFileName (str) – Name of the file where the interpolation table will be written.

Return type:

None