romspline/helpers.py
def D(y, x, dx=1, order=4):
  """Deriviative(s) of y with respect to x using finite differencing"""
  # Look up finite differencing weights
  h = x[1]-x[0]
  weights = _FD_weights(dx, order, order/2., h)
  
  # Compute finite difference derivatives
  ans = np.zeros(y.size, dtype=y.dtype)
  for ii, xx in enumerate(x):
    ix_patch, _, ix = _make_patch(xx, x, order)
    if float(ix) != order/2.:
      weights = _FD_weights(dx, order, ix, h)
    ans[ii] = np.dot(y[ix_patch], weights)
  
  return ans
Deriviative(s) of y with respect to x using finite differencing
Deriviative(s) of y with respect to x using finite differencing
Deriviative ( s ) of y with respect to x using finite differencing
def D(y, x, dx=1, order=4):
  h = x[1]-x[0]
  weights = _FD_weights(dx, order, order/2., h)
  ans = np.zeros(y.size, dtype=y.dtype)
  for ii, xx in enumerate(x):
    ix_patch, _, ix = _make_patch(xx, x, order)
    if float(ix) != order/2.:
      weights = _FD_weights(dx, order, ix, h)
    ans[ii] = np.dot(y[ix_patch], weights)
  return ans
def D ( y , x , dx = 1 , order = 4 ) : h = x [ 1 ] - x [ 0 ] weights = _FD_weights ( dx , order , order / 2. , h ) ans = np . zeros ( y . size , dtype = y . dtype ) for ii , xx in enumerate ( x ) : ix_patch , _ , ix = _make_patch ( xx , x , order ) if float ( ix ) != order / 2. : weights = _FD_weights ( dx , order , ix , h ) ans [ ii ] = np . dot ( y [ ix_patch ] , weights ) return ans
Deriviative(s) of y with respect to x using finite differencing
Deriviative ( s ) of y with respect to x using finite differencing
"""Deriviative(s) of y with respect to x using finite differencing""" # Look up finite differencing weights # Compute finite difference derivatives
y
x
dx
order