Update the arc line from least squares fit to data.

        Parameters
        ----------
        x : 1d numpy array, float
            X coordinates of the data being fitted.
        y : 1d numpy array, float
            Y coordinates of the data being fitted.
        deg : int
            Degree of the fitting polynomial.
        w : 1d numpy array, float
            Weights to be employed in the polynomial fit.
        y_vs_x : bool
            If True, the fit is Y vs X. Otherwise, X vs Y is computed.
        times_sigma_reject : float
            If not None, deviant point are rejected.
        title : string
            Plot title.
        debugplot : int
            Determines whether intermediate computations and/or plots
            are displayed:
            00 : no debug, no plots
            01 : no debug, plots without pauses
            02 : no debug, plots with pauses
            10 : debug, no plots
            11 : debug, plots without pauses
            12 : debug, plots with pauses

def fit(self, x, y, deg, w=None, y_vs_x=True,
            times_sigma_reject=None, title=None, debugplot=0):
        """Update the arc line from least squares fit to data.

        Parameters
        ----------
        x : 1d numpy array, float
            X coordinates of the data being fitted.
        y : 1d numpy array, float
            Y coordinates of the data being fitted.
        deg : int
            Degree of the fitting polynomial.
        w : 1d numpy array, float
            Weights to be employed in the polynomial fit.
        y_vs_x : bool
            If True, the fit is Y vs X. Otherwise, X vs Y is computed.
        times_sigma_reject : float
            If not None, deviant point are rejected.
        title : string
            Plot title.
        debugplot : int
            Determines whether intermediate computations and/or plots
            are displayed:
            00 : no debug, no plots
            01 : no debug, plots without pauses
            02 : no debug, plots with pauses
            10 : debug, no plots
            11 : debug, plots without pauses
            12 : debug, plots with pauses

        """

        # protections
        if type(x) is not np.ndarray:
            raise ValueError("x=" + str(x) + " must be a numpy.ndarray")
        if type(y) is not np.ndarray:
            raise ValueError("y=" + str(y) + " must be a numpy.ndarray")
        if x.size != y.size:
            raise ValueError("x.size != y.size")
        if w is not None:
            if type(w) is not np.ndarray:
                raise ValueError(
                    "w=" + str(w) + " must be None or a numpy.ndarray")
            if w.size != x.size:
                raise ValueError("w.size != x.size")
        if type(deg) not in [np.int, np.int64]:
            raise ValueError("deg=" + str(deg) +
                             " is not a valid integer")

        # update bounding box of the CCD line
        self.bb_nc1_orig = min(x)
        self.bb_nc2_orig = max(x)
        self.bb_ns1_orig = min(y)
        self.bb_ns2_orig = max(y)

        # compute polynomial from fit to data
        if y_vs_x:
            if times_sigma_reject is None:
                # fit using the minimal domain that covers the x data
                poly_funct = \
                    Polynomial.fit(x=x, y=y, deg=deg, w=w,
                                   domain=None, window=None, full=False)
                # restore the class domain
                self.poly_funct = Polynomial.cast(poly_funct)
                # display resulting fit when requested
                if debugplot % 10 != 0:
                    polfit_residuals(x=x, y=y, deg=deg,
                                     title=title,
                                     debugplot=debugplot)
            else:
                self.poly_funct, yres_dum, reject_dum = \
                    polfit_residuals_with_sigma_rejection(
                        x=x, y=y, deg=deg,
                        title=title,
                        times_sigma_reject=times_sigma_reject,
                        debugplot=debugplot
                    )
            self.xlower_line = self.bb_nc1_orig
            self.ylower_line = self.poly_funct(self.xlower_line)
            self.xupper_line = self.bb_nc2_orig
            self.yupper_line = self.poly_funct(self.xupper_line)
        else:
            if times_sigma_reject is None:
                # fit using the minimal domain that covers the y data
                poly_funct = \
                    Polynomial.fit(x=y, y=x, deg=deg, w=w,
                                   domain=None, window=None, full=False)
                # restore the class domain
                self.poly_funct = Polynomial.cast(poly_funct)
                # display resulting fit when requested
                if debugplot % 10 != 0:
                    polfit_residuals(x=y, y=x, deg=deg,
                                     title=title, debugplot=debugplot)
            else:
                self.poly_funct, yres_dum, reject_dum = \
                    polfit_residuals_with_sigma_rejection(
                        x=y, y=x, deg=deg,
                        title=title,
                        times_sigma_reject=times_sigma_reject,
                        debugplot=debugplot
                    )
            self.ylower_line = self.bb_ns1_orig
            self.xlower_line = self.poly_funct(self.ylower_line)
            self.yupper_line = self.bb_ns2_orig
            self.xupper_line = self.poly_funct(self.yupper_line)

        # CCD line has been defined
        self.available = True