Changeset 1637 for branches/alma/python
- Timestamp:
- 09/25/09 19:04:34 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/alma/python/scantable.py
r1631 r1637 1521 1521 if mask is None: 1522 1522 mask = [True for i in xrange(self.nchan(-1))] 1523 1523 1524 from asap.asapfitter import fitter 1524 1525 try: 1525 1526 f = fitter() 1526 f.set_scan(self, mask)1527 1527 if uselin: 1528 1528 f.set_function(lpoly=order) 1529 1529 else: 1530 1530 f.set_function(poly=order) 1531 s = f.auto_fit(insitu, plot=plot) 1532 # Save parameters of baseline fits as a class attribute. 1533 # NOTICE: It does not reflect changes in scantable! 1534 self.blpars = f.blpars 1531 1532 rows = range(self.nrow()) 1533 if len(rows) > 0: 1534 self.blpars = [] 1535 1536 for r in rows: 1537 # take into account flagtra info (CAS-1434) 1538 flagtra = self._getmask(r) 1539 actualmask = mask[:] 1540 if len(actualmask) == 0: 1541 actualmask = list(flagtra[:]) 1542 else: 1543 if len(actualmask) != len(flagtra): 1544 raise RuntimeError, "Mask and flagtra have different length" 1545 else: 1546 for i in range(0, len(actualmask)): 1547 actualmask[i] = actualmask[i] and flagtra[i] 1548 f.set_scan(self, actualmask) 1549 f.x = self._getabcissa(r) 1550 f.y = self._getspectrum(r) 1551 f.data = None 1552 f.fit() 1553 fpar = f.get_parameters() 1554 self.blpars.append(fpar) 1555 1556 #f.set_scan(self, mask) 1557 #s = f.auto_fit(insitu, plot=plot) 1558 ## Save parameters of baseline fits as a class attribute. 1559 ## NOTICE: It does not reflect changes in scantable! 1560 #self.blpars = f.blpars 1535 1561 s._add_history("poly_baseline", varlist) 1536 1562 print_log() … … 1650 1676 curedge = edge[workscan.getif(r)] 1651 1677 1678 # take into account flagtra info (CAS-1434) 1679 flagtra = workscan._getmask(r) 1680 actualmask = mask[:] 1681 if len(actualmask) == 0: 1682 actualmask = list(flagtra[:]) 1683 else: 1684 if len(actualmask) != len(flagtra): 1685 raise RuntimeError, "Mask and flagtra have different length" 1686 else: 1687 for i in range(0, len(actualmask)): 1688 actualmask[i] = actualmask[i] and flagtra[i] 1689 1652 1690 # setup line finder 1653 fl.find_lines(r, mask, curedge)1691 fl.find_lines(r, actualmask, curedge) 1654 1692 outmask=fl.get_mask() 1655 1693 f.set_scan(workscan, fl.get_mask())
Note:
See TracChangeset
for help on using the changeset viewer.