def _do_save_as(self, filename):
        """Saves spectrum back to FITS file."""

        if len(self.spectrum.x) < 2:
            raise RuntimeError("Spectrum must have at least two points")
        if os.path.isfile(filename):
            os.unlink(filename)  # PyFITS does not overwrite file

        hdu = self.spectrum.to_hdu()
        overwrite_fits(hdu, filename)