Changeset 259


Ignore:
Timestamp:
01/21/05 22:33:45 (19 years ago)
Author:
mar637
Message:

*renaming in scantable

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/asapfitter.py

    r190 r259  
    11import _asap
     2from asap import rcParams
    23
    34class fitter:
     
    8081        """
    8182        #default poly order 0
    82         self.fitfunc = 'poly'
    83         n=0
     83       
     84
    8485        if kwargs.has_key('poly'):
    8586            self.fitfunc = 'poly'
     
    110111        else:
    111112            if self.data is not None:
    112                 self.x = self.data.getabcissa()
    113                 self.y = self.data.getspectrum()
     113                self.x = self.data._getabcissa()
     114                self.y = self.data._getspectrum()
    114115                print "Fitting:"
    115                 vb = self.data._verbose
    116                 self.data._verbose(True)
    117                 s = self.data.get_selection()
    118                 self.data._verbose(vb)
     116                vb = self.data._vb
     117                self.data._vb = True
     118                s = self.data.get_cursor()
     119                self.data._vb = vb
    119120       
    120121        self.fitter.setdata(self.x,self.y,self.mask)
     
    213214            return
    214215        scan = self.data.copy()
    215         scan.setspectrum(self.fitter.getresidual())
     216        scan._setspectrum(self.fitter.getresidual())
    216217
    217218    def plot(self, residual=False):
     
    235236        if self.data:
    236237            tlab = self.data._getsourcename(0)
    237             xlab = self.data.getabcissalabel(0)
     238            xlab = self.data._getabcissalabel(0)
    238239        ylab = r'Flux'
    239240        m = self.data.getmask(0)
     
    252253
    253254
    254     def auto_fit(self):
     255    def auto_fit(self, insitu=None):
    255256        """
    256257        Return a scan where the function is applied to all rows for all Beams/IFs/Pols.
     
    261262            print "Only works with scantables"
    262263            return
    263         scan = self.data.copy()
    264         vb = scan._verbose
    265         scan._verbose(False)
    266         sel = scan.get_selection()
     264        if insitu is None: insitu = rcParams['insitu']
     265        if not insitu:
     266            scan = self.data.copy()
     267        else:
     268            scan = self.data
     269        vb = scan._vb
     270        scan._vb = False
     271        sel = scan.get_cursor()
    267272        rows = range(scan.nrow())
    268273        for i in range(scan.nbeam()):
     
    276281                        print 'Beam[%d], IF[%d], Pol[%d]' % (i,j,k)
    277282                    for iRow in rows:
    278                         self.x = scan.getabcissa(iRow)
    279                         self.y = scan.getspectrum(iRow)
     283                        self.x = scan._getabcissa(iRow)
     284                        self.y = scan._getspectrum(iRow)
    280285                        self.data = None
    281286                        self.fit()                   
    282287                        x = self.get_parameters()
    283                         scan.setspectrum(self.fitter.getresidual(),iRow)
    284         scan.set_selection(sel[0],sel[1],sel[2])
    285         scan._verbose(vb)
    286         return scan
     288                        scan._setspectrum(self.fitter.getresidual(),iRow)
     289        scan.set_cursor(sel[0],sel[1],sel[2])
     290        scan._vb = vb
     291        if not insitu:
     292            return scan
Note: See TracChangeset for help on using the changeset viewer.