Coverage for navipy/errorprop/__init__.py : 74%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
""" Numerical error propagation
tools to propogate the error by using an estimate of the jacobian matrix (matrix of derivatives) """
""" Estimate the error by using the deviation from the median distance between two markers """ if not isinstance(rigid_marker_id, list): raise TypeError('rigid_marker_id should be a list') if len(rigid_marker_id) != 2: raise ValueError('rigid_marker_id should be a list with two elements') dist = np.sqrt(((markers.loc[:, rigid_marker_id[0]] - markers.loc[:, rigid_marker_id[1]])**2).sum( axis=1, skipna=False)) median_dist = np.nanmedian(dist) return np.abs(dist - median_dist)
"""Estimate the jacobian matrix
:param fun: The objective function to be derivated. Must be in \ the form f(x, *args). \ The argument, x, is a 1-D array of points, and args is a tuple of \ any additional \ fixed parameters needed to completely specify the function. :param x: values at which the jacobian should be calculated :param args: Extra arguments passed to the objective function :param epsilon: step used to estimate the jacobian :returns: An estimated jacobian matrix """
else: dfs1 = fun(x_minus, args) dfs2 = fun(x_plus, args) else: else: deriv = (fun(x_plus, args) - fun(x_minus, args)) / (2 * epsilon)
"""Estimate the jacobian matrix
:param fun: The objective function to be error propagated. \ Must be in the form f(x, *args). \ The argument, x, is a 1-D array of points, and args is a tuple of \ any additional \ fixed parameters needed to completely specify the function. :param x: values at which the error should be calculated :param covar: variance-covariance matrix :param args: Extra arguments passed to the objective function :param epsilon: step used to estimate the jacobian :returns: An estimated jacobian matrix """ else: |