# Path: PySpectrograph/WavelengthSolution/LineSolution.py
# class LineSolution(interfit):
# 
#     """LineSolution is a task describing the functional form for transforming
#        pixel position to wavelength.
# 
#     * x - list or array of x data
#     * y - list or array of y data
#     * yerr - error on y data
#     * coef - Initial coefficients for fit
#     * function - function to be fit to the data:
#                  options include polynomial, legendre, chebyshev, or spline
#     * order - order of the function that is fit
#     * thresh - threshold for rejection
#     * niter - number of times to iterate
# 
#     """
# 
#     def value(self, x):
#         """Calculate the value of the array
#         """
#         return self(x)


import numpy as np
import pylab as pl
from PySpectrograph.WavelengthSolution import LineSolution as LS



xp = np.array([1134.87, 1239.11, 1498.22, 1687.21, 1904.49, 1997.15, 2025.77, 2202.59, 2559.72, 2673.74, 3124.34])
wp = np.array([4500.9772,
               4524.6805,
               4582.7474,
               4624.2757,
               4671.226,
               4690.9711,
               4697.02,
               4734.1524,
               4807.019,
               4829.709,
               4916.51])


def test_LineSolution():
    ls = LS.LineSolution(xp, wp, function='legendre')

# Path: PySpectrograph/WavelengthSolution/LineSolution.py
# class LineSolution(interfit):
# 
#     """LineSolution is a task describing the functional form for transforming
#        pixel position to wavelength.
# 
#     * x - list or array of x data
#     * y - list or array of y data
#     * yerr - error on y data
#     * coef - Initial coefficients for fit
#     * function - function to be fit to the data:
#                  options include polynomial, legendre, chebyshev, or spline
#     * order - order of the function that is fit
#     * thresh - threshold for rejection
#     * niter - number of times to iterate
# 
#     """
# 
#     def value(self, x):
#         """Calculate the value of the array
#         """
#         return self(x)


# Path: PySpectrograph/unit_tests/ut_LineSolution.py
import numpy as np
import pylab as pl
from PySpectrograph.WavelengthSolution import LineSolution as LS




xp = np.array([1134.87, 1239.11, 1498.22, 1687.21, 1904.49, 1997.15, 2025.77, 2202.59, 2559.72, 2673.74, 3124.34])
wp = np.array([4500.9772,
               4524.6805,
               4582.7474,
               4624.2757,
               4671.226,
               4690.9711,
               4697.02,
               4734.1524,
               4807.019,
               4829.709,
               4916.51])


def test_LineSolution():
    ls = LS.LineSolution(xp, wp, function='legendre')

    ls.interfit()