derivatives#
- class cosmicjellyfish.fishermatrix.derivatives.derivatives(observable, fiducial, special_deriv_function=None, derivatives_type=None, freeparams=None, observables_type=None, external_settings=<object object>, feed_lvl=None, *, configuration=None)[source]#
Bases:
objectThis class is the main derivative engine for the different observables. It gives access to different derivative methods. After the constructor is called, the resulting dictionary of derivatives is found in its result attribute.
- der_3pt_stencil(fwd, bwd, step)[source]#
Helper function to compute the 3PT symmetrical finite step size derivative
- Parameters:
fwd (
float,numpy.ndarray) – Observable computed at the forward stepbwd (
float,numpy.ndarray) – Observable computed at the backwards stepstep (
float) – Absolute step size of the numerical derivative
- Returns:
Numerical derivative using the a 3 point stencil
- Return type:
- derivative_3pt()[source]#
One of the possible derivative methods. Computes the numerical derivative using a finite differences 3 point symmetrical derivative
- Returns:
A dictionary containing the derivative of the observable for each varied parameter.
- Return type:
Note
Implements the following equation:
\[\frac{\mathrm{d} \mathcal{O}}{\mathrm{d} \theta} = \frac{\mathcal{O}(\theta+h)-\mathcal{O}(\theta-h)}{2\,h}\]
- der_fwd_4pt(fwdi, step)[source]#
Helper function to compute the 4PT forward finite step size derivative
- Parameters:
fwdi (
list,numpy.ndarray) – Observable computed at the fiducial and at equally spaced points in the forward directionstep (
float) – Absolute distance between the size of the numerical derivative
- Returns:
Numerical derivative using the a 4 point forward stencil
- Return type:
- derivative_forward_4pt()[source]#
Compute a one-sided, four-point forward finite-difference derivative.
The stencil is
(-11 f(x) + 18 f(x + h) - 9 f(x + 2h) + 2 f(x + 3h)) / (6h). Its coefficients were obtained with the Finite Difference Coefficients Calculator.- Returns:
Derivative of the observable for each varied parameter.
- Return type: