def fit_trace_polynomial(trace, deg, axis=0):
    '''
    Fit a trace information table to a polynomial.

    Parameters
    ----------
    trace 
           A 2D array, 2 columns and n rows
    deg : int
           Degree of polynomial
    axis : {0, 1}
           Spatial axis of the array (0 is Y, 1 is X).
    '''

    dispaxis = axis_to_dispaxis(axis)

    # FIT to a polynomial
    pfit = numpy.polyfit(trace[:,0], trace[:,1], deg)
    start = trace[0,0]
    stop = trace[-1,0],
    return PolyTrace(start, stop, axis, pfit)
Fit a trace information table to a polynomial.

    Parameters
    ----------
    trace 
           A 2D array, 2 columns and n rows
    deg : int
           Degree of polynomial
    axis : {0, 1}
           Spatial axis of the array (0 is Y, 1 is X).