def fit(self, data=None, old=False, x=None, report=False, plot=False, weights=None, method='leastsq', **kwargs):
    'Fits a model to the sightline data given by the EdiblesSpectrum object.\n\n        Args:\n            data (1darray): Flux data to fit\n            params (lmfit.parameter.Parameters): Initial parameters to fit\n            model (lmfit.model.CompositeModel): The model to fit, default: self.complete_model\n            x (1darray): Wavelength data to fit\n            report (bool): default False: If true, prints the report from the fit.\n            plot (bool): default False: If true, plots the data and the fit model.\n            method (str): The method of fitting. default: leastsq\n\n        '
    if (data is None):
        data = self.flux
    if (x is None):
        x = self.wave
    if (old is True):
        model = self.old_complete_model
        params = self.old_all_pars
    else:
        model = self.complete_model
        params = self.all_pars
    self.result = model.fit(data=data, params=params, x=x, weights=weights, method=method, **kwargs)
    if report:
        print(self.result.fit_report())
        self.result.params.pretty_print()
    if plot:
        self.result.plot_fit()
        plt.show()
    self.all_pars = self.result.params
    if (old is False):
        try:
            tell_pars = Parameters()
            for par_name in self.telluric_pars:
                tell_pars.add(self.all_pars[par_name])
            assert (len(self.telluric_pars) == len(tell_pars))
            self.telluric_pars = tell_pars
        except AttributeError:
            pass
        try:
            non_tell_pars = Parameters()
            for par_name in self.nontelluric_pars:
                non_tell_pars.add(self.all_pars[par_name])
            assert (len(self.nontelluric_pars) == len(non_tell_pars))
            self.nontelluric_pars = non_tell_pars
        except AttributeError:
            pass
        try:
            cont_pars = Parameters()
            for par_name in self.cont_model_pars:
                cont_pars.add(self.all_pars[par_name])
            assert (len(self.cont_model_pars) == len(cont_pars))
            self.cont_model_pars = cont_pars
        except AttributeError:
            pass
Fits a model to the sightline data given by the EdiblesSpectrum object.

Args:
    data (1darray): Flux data to fit
    params (lmfit.parameter.Parameters): Initial parameters to fit
    model (lmfit.model.CompositeModel): The model to fit, default: self.complete_model
    x (1darray): Wavelength data to fit
    report (bool): default False: If true, prints the report from the fit.
    plot (bool): default False: If true, plots the data and the fit model.
    method (str): The method of fitting. default: leastsq
def fit(self, data=None, old=False, x=None, report=False, plot=False, weights=None, method='leastsq', **kwargs):
    'Fits a model to the sightline data given by the EdiblesSpectrum object.\n\n        Args:\n            data (1darray): Flux data to fit\n            params (lmfit.parameter.Parameters): Initial parameters to fit\n            model (lmfit.model.CompositeModel): The model to fit, default: self.complete_model\n            x (1darray): Wavelength data to fit\n            report (bool): default False: If true, prints the report from the fit.\n            plot (bool): default False: If true, plots the data and the fit model.\n            method (str): The method of fitting. default: leastsq\n\n        '
    if (data is None):
        data = self.flux
    if (x is None):
        x = self.wave
    if (old is True):
        model = self.old_complete_model
        params = self.old_all_pars
    else:
        model = self.complete_model
        params = self.all_pars
    self.result = model.fit(data=data, params=params, x=x, weights=weights, method=method, **kwargs)
    if report:
        print(self.result.fit_report())
        self.result.params.pretty_print()
    if plot:
        self.result.plot_fit()
        plt.show()
    self.all_pars = self.result.params
    if (old is False):
        try:
            tell_pars = Parameters()
            for par_name in self.telluric_pars:
                tell_pars.add(self.all_pars[par_name])
            assert (len(self.telluric_pars) == len(tell_pars))
            self.telluric_pars = tell_pars
        except AttributeError:
            pass
        try:
            non_tell_pars = Parameters()
            for par_name in self.nontelluric_pars:
                non_tell_pars.add(self.all_pars[par_name])
            assert (len(self.nontelluric_pars) == len(non_tell_pars))
            self.nontelluric_pars = non_tell_pars
        except AttributeError:
            pass
        try:
            cont_pars = Parameters()
            for par_name in self.cont_model_pars:
                cont_pars.add(self.all_pars[par_name])
            assert (len(self.cont_model_pars) == len(cont_pars))
            self.cont_model_pars = cont_pars
        except AttributeError:
            pass