Commits

Adam Ginsburg committed 437d173

baseline fixed to have fit_original set to TRUE by default (in order to
conserve the baseline). I don't think information should be lost using default
parameters (unless smooth, crop are explicitly called)

ObsBlock is now a subclass of Spectra. Let's see if that works... I think it makes sense, but it might not...

Comments (0)

Files changed (3)

pyspeckit/spectrum/baseline.py

 
     def __call__(self, order=1, annotate=False, excludefit=False, save=True,
             exclude=None, exclusionlevel=0.01, interactive=False, 
-            LoudDebug=False, fit_original=False, **kwargs):
+            LoudDebug=False, fit_original=True, **kwargs):
         """
         Fit and remove a polynomial from the spectrum.  
         It will be saved in the variable "self.basespec"

pyspeckit/spectrum/classes.py

         self.data = self.data[indices]
         self.error = self.error[indices]
 
+    def smooth(self,smooth,**kwargs):
+        """
+        Smooth the spectrum by factor "smooth".  Options are defined in sm.smooth
 
-class ObsBlock(Spectrum):
+        because 'Spectra' does not have a header attribute, don't do anything to it...
+        """
+        smooth = round(smooth)
+        self.data = sm.smooth(self.data,smooth,**kwargs)
+        self.xarr = self.xarr[::smooth]
+        if len(self.xarr) != len(self.data):
+            raise ValueError("Convolution resulted in different X and Y array lengths.  Convmode should be 'same'.")
+        self.error = sm.smooth(self.error,smooth,**kwargs)
+        self.baseline.downsample(smooth)
+        self.specfit.downsample(smooth)
+
+class ObsBlock(Spectra):
     """
     An Observation Block
 

pyspeckit/wrappers/showspec_splat1d.py

         sp.units = units
 
     if dobaseline:
-        sp.baseline(order=order, exclude=exclude, annotate=annotatebaseline)
+        sp.baseline(order=order, exclude=exclude, annotate=annotatebaseline, subtract=False)
 
     if plotspectrum:
-        sp.plotter(figure=fignum, axis=axis, autorefresh=autorefresh, color=color, clear=clear, silent=quiet, reset_ylimits=True, title=title)
+        if color is None:
+            sp.plotter(figure=fignum, axis=axis, autorefresh=autorefresh, clear=clear, silent=quiet, reset_ylimits=True, title=title)
+        else:
+            sp.plotter(figure=fignum, axis=axis, autorefresh=autorefresh, color=color, clear=clear, silent=quiet, reset_ylimits=True, title=title)
 
     if savepre is not None:
         glon,glat = sp.header.get("GLON"),sp.header.get("GLAT")