@classmethod
def fromspectrum(cls, spectrum, **kwargs):
    """
    Fitter.fromspectrum(spectrum,**kwargs)

    An alternate way to initialise Fitter, by directly giving it
    a spectrum. Extracted data from the spectrum are the x, y,
    and (if the spectrum has been baselined) dy parameters.

    Parameters
    ----------
    spectrum : `omnifit.spectrum.BaseSpectrum` or its child class
      The input spectrum.
    **kwargs : Arguments, optional
      Additional initialisation arguments can be passed to `Fitter`
      using this. Note that x and y (and dy, if applicable) are defined
      using the data contained in the input spectrum.
    """
    if spectrum.baselined:
        return cls(spectrum.x.value, spectrum.y.value, spectrum.dy, **kwargs)
    else:
        return cls(spectrum.x.value, spectrum.y.value, **kwargs)
