# Path: skyfield/_compatibility.py
# def interp(*args):
#     return np.array(np.interp(*args))
# 
# Path: skyfield/descriptorlib.py
# class reify(object):
#     """Adapted from Pyramid's `reify()` memoizing decorator."""
#     def __init__(self, method):
#         self.method = method
#         update_wrapper(self, method)
# 
#     def __get__(self, instance, objtype=None):
#         if instance is None:
#             return self
#         value = self.method(instance)
#         instance.__dict__[self.__name__] = value
#         return value
# 
# Path: skyfield/functions.py
# def _to_array(value):
#     """Convert plain Python sequences into NumPy arrays.
# 
#     This helps Skyfield endpoints convert caller-provided tuples and
#     lists into NumPy arrays.  If the ``value`` is not a sequence, then
#     it is coerced to a Numpy float object, but not an actual array.
# 
#     """
#     if hasattr(value, 'shape'):
#         return value
#     elif hasattr(value, '__len__'):
#         return array(value)
#     else:
#         return float64(value)


from numpy import arange
from ._compatibility import interp
from .descriptorlib import reify
from .functions import _to_array
"""Various curves."""


class Splines(object):
    def __init__(self, table):
        table = _to_array(table)
        if len(table.shape) < 2:  # Let caller provide a single row.
            table = table.reshape(table.shape + (1,))
        self.table = table
        self.lower = lower = table[0]
        self.upper = upper = table[1]
        self._width = upper - lower
        self._n = arange(len(lower))
        self.coefficients = table[2:]

    def __call__(self, x):

# Path: skyfield/_compatibility.py
# def interp(*args):
#     return np.array(np.interp(*args))
# 
# Path: skyfield/descriptorlib.py
# class reify(object):
#     """Adapted from Pyramid's `reify()` memoizing decorator."""
#     def __init__(self, method):
#         self.method = method
#         update_wrapper(self, method)
# 
#     def __get__(self, instance, objtype=None):
#         if instance is None:
#             return self
#         value = self.method(instance)
#         instance.__dict__[self.__name__] = value
#         return value
# 
# Path: skyfield/functions.py
# def _to_array(value):
#     """Convert plain Python sequences into NumPy arrays.
# 
#     This helps Skyfield endpoints convert caller-provided tuples and
#     lists into NumPy arrays.  If the ``value`` is not a sequence, then
#     it is coerced to a Numpy float object, but not an actual array.
# 
#     """
#     if hasattr(value, 'shape'):
#         return value
#     elif hasattr(value, '__len__'):
#         return array(value)
#     else:
#         return float64(value)


# Path: skyfield/curvelib.py
from numpy import arange
from ._compatibility import interp
from .descriptorlib import reify
from .functions import _to_array

"""Various curves."""


class Splines(object):
    def __init__(self, table):
        table = _to_array(table)
        if len(table.shape) < 2:  # Let caller provide a single row.
            table = table.reshape(table.shape + (1,))
        self.table = table
        self.lower = lower = table[0]
        self.upper = upper = table[1]
        self._width = upper - lower
        self._n = arange(len(lower))
        self.coefficients = table[2:]

    def __call__(self, x):

        i = interp(x, self.lower, self._n)