romspline/helpers.py
def _make_patch(x, x_grid, dim):
  """Make patch with dim elements centered around x"""
  
  # Find grid points closest to x
  ix = _get_arg(x_grid, x)
  
  # Find how many elements to take on either side of x
  if dim % 2:    # Check if dim is odd...
    a = int((dim+1)/2.)
    b = a
  else:          #...or even
    a = int(dim/2.)
    b = a+1
  
  # Ensure patch doesn't cross the training grid boundary
  ix = _check_patch(ix, a, b, x_grid.size)
  
  # Indices of the patch 
  ipatch = np.arange(ix-a, ix+b)
  return ipatch, ix, _get_arg(ipatch, ix)
Make patch with dim elements centered around x
Make patch with dim elements centered around x
Make patch with dim elements centered around x
def _make_patch(x, x_grid, dim):
  ix = _get_arg(x_grid, x)
  if dim % 2:    
    a = int((dim+1)/2.)
    b = a
  else:          
    a = int(dim/2.)
    b = a+1
  ix = _check_patch(ix, a, b, x_grid.size)
  ipatch = np.arange(ix-a, ix+b)
  return ipatch, ix, _get_arg(ipatch, ix)
def _make_patch ( x , x_grid , dim ) : ix = _get_arg ( x_grid , x ) if dim % 2 : a = int ( ( dim + 1 ) / 2. ) b = a else : a = int ( dim / 2. ) b = a + 1 ix = _check_patch ( ix , a , b , x_grid . size ) ipatch = np . arange ( ix - a , ix + b ) return ipatch , ix , _get_arg ( ipatch , ix )
Make patch with dim elements centered around x
Make patch with dim elements centered around x
"""Make patch with dim elements centered around x""" # Find grid points closest to x # Find how many elements to take on either side of x # Check if dim is odd... #...or even # Ensure patch doesn't cross the training grid boundary # Indices of the patch 
x
x_grid
dim