Ignore:
Timestamp:
03/06/06 11:51:04 (18 years ago)
Author:
mar637
Message:

move to asap2 container

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/asapfitter.py

    r794 r876  
    130130                from asap import asaplog
    131131                asaplog.push("Fitting:")
    132                 self.selection = self.data.get_cursor()
     132                out = "Scan[%d] Beam[%d] IF[%d] Pol[%d] Cycle[%d]" (self.data.getscan(i),self.data.getbeam(i),self.data.getif(i),self.data.getpol(i), self.data.getcycle(i))
     133                asaplog.push(out)
    133134        self.fitter.setdata(self.x, self.y, self.mask)
    134135        if self.fitfunc == 'gauss':
     
    432433        print_log()
    433434
    434     def auto_fit(self, insitu=None, allaxes=True):
     435    def auto_fit(self, insitu=None):
    435436        """
    436437        Return a scan where the function is applied to all rows for
     
    451452        else:
    452453            scan = self.data
    453         sel = scan.get_cursor()
    454454        rows = range(scan.nrow())
    455455        from asap import asaplog
    456         if allaxes:
    457             for i in range(scan.nbeam()):
    458                 scan.setbeam(i)
    459                 for j in range(scan.nif()):
    460                     scan.setif(j)
    461                     for k in range(scan.npol()):
    462                         scan.setpol(k)
    463                         asaplog.push("Fitting:")
    464                         out = 'Beam[%d], IF[%d], Pol[%d]' % (i,j,k)
    465                         asaplog.push(out)
    466                         for iRow in rows:
    467                             self.x = scan._getabcissa(iRow)
    468                             self.y = scan._getspectrum(iRow)
    469                             self.data = None
    470                             self.fit()
    471                             x = self.get_parameters()
    472                             scan._setspectrum(self.fitter.getresidual(),iRow)
    473         else:
    474             asaplog.push("Fitting:")
    475             out = 'Beam[%d], IF[%d], Pol[%d]' % sel
     456        asaplog.push("Fitting:")
     457        for r in rows:
     458            out = "Scan[%d] Beam[%d] IF[%d] Pol[%d] Cycle[%d]" %        (self.data.getscan(r),self.data.getbeam(r),self.data.getif(r),self.data.getpol(r), self.data.getcycle(r))
    476459            asaplog.push(out)
    477             for iRow in rows:
    478                 self.x = scan._getabcissa(iRow)
    479                 self.y = scan._getspectrum(iRow)
    480                 self.data = None
    481                 self.fit()
    482                 x = self.get_parameters()
    483                 scan._setspectrum(self.fitter.getresidual(),iRow)
    484 
    485         scan.set_cursor(sel[0],sel[1],sel[2])
     460            self.x = scan._getabcissa(r)
     461            self.y = scan._getspectrum(r)
     462            self.data = None
     463            self.fit()
     464            x = self.get_parameters()
     465            scan._setspectrum(self.fitter.getresidual(),iRow)
    486466        print_log()
    487         if not insitu:
    488             return scan
     467        return scan
     468
Note: See TracChangeset for help on using the changeset viewer.