Changeset 2810
- Timestamp:
- 04/11/13 18:26:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/scantable.py
r2809 r2810 266 266 if lf_params_n == 3: 267 267 dinfo['use_linefinder'] = 'true' 268 elif lf_params_n == 1:268 elif lf_params_n == 0: 269 269 dinfo['use_linefinder'] = 'false' 270 270 dinfo['thresh'] = '' … … 2700 2700 2701 2701 @asaplog_post_dec 2702 def apply_bltable(self, insitu=None, inbltable=None, outbltable=None, overwrite=None):2702 def apply_bltable(self, insitu=None, retfitres=None, inbltable=None, outbltable=None, overwrite=None): 2703 2703 """\ 2704 2704 Subtract baseline based on parameters written in Baseline Table. … … 2706 2706 Parameters: 2707 2707 insitu: if True, baseline fitting/subtraction is done 2708 in-situ and fitting results is returned. If2709 False, a dictionary containing new scantable2710 (with baseline subtracted) and fitting results2711 i s returned.2708 in-situ. If False, a new scantable with 2709 baseline subtracted is returned. Actually, 2710 format of the returned value depends on both 2711 insitu and retfitres (see below). 2712 2712 The default is taken from .asaprc (False) 2713 retfitres: if True, the results of baseline fitting (i.e., 2714 coefficients and rms) are returned. 2715 default is False. 2716 The format of the returned value of this 2717 function varies as follows: 2718 (1) in case insitu=True and retfitres=True: 2719 fitting result. 2720 (2) in case insitu=True and retfitres=False: 2721 None. 2722 (3) in case insitu=False and retfitres=True: 2723 a dictionary containing a new scantable 2724 (with baseline subtracted) and the fitting 2725 results. 2726 (4) in case insitu=False and retfitres=False: 2727 a new scantable (with baseline subtracted). 2713 2728 inbltable: name of input baseline table. The row number of 2714 2729 scantable and that of inbltable must be … … 2725 2740 try: 2726 2741 varlist = vars() 2742 if retfitres is None: retfitres = False 2727 2743 if inbltable is None: raise ValueError("bltable missing.") 2728 2744 if outbltable is None: outbltable = '' … … 2736 2752 2737 2753 sres = workscan._apply_bltable(inbltable, 2754 retfitres, 2738 2755 outbltable, 2739 2756 os.path.exists(outbltable), 2740 2757 overwrite) 2741 res = parse_fitresult(sres)2758 if retfitres: res = parse_fitresult(sres) 2742 2759 2743 2760 workscan._add_history('apply_bltable', varlist) … … 2745 2762 if insitu: 2746 2763 self._assign(workscan) 2747 return res 2764 if retfitres: 2765 return res 2766 else: 2767 return None 2748 2768 else: 2749 return {'scantable': workscan, 'fitresults': res} 2769 if retfitres: 2770 return {'scantable': workscan, 'fitresults': res} 2771 else: 2772 return workscan 2750 2773 2751 2774 except RuntimeError, e: … … 2753 2776 2754 2777 @asaplog_post_dec 2755 def sub_baseline(self, insitu=None, blinfo=None, bltable=None, overwrite=None):2778 def sub_baseline(self, insitu=None, retfitres=None, blinfo=None, bltable=None, overwrite=None): 2756 2779 """\ 2757 2780 Subtract baseline based on parameters written in the input list. … … 2759 2782 Parameters: 2760 2783 insitu: if True, baseline fitting/subtraction is done 2761 in-situ and fitting results is returned. If2762 False, a dictionary containing new scantable2763 (with baseline subtracted) and fitting results2764 i s returned.2784 in-situ. If False, a new scantable with 2785 baseline subtracted is returned. Actually, 2786 format of the returned value depends on both 2787 insitu and retfitres (see below). 2765 2788 The default is taken from .asaprc (False) 2789 retfitres: if True, the results of baseline fitting (i.e., 2790 coefficients and rms) are returned. 2791 default is False. 2792 The format of the returned value of this 2793 function varies as follows: 2794 (1) in case insitu=True and retfitres=True: 2795 fitting result. 2796 (2) in case insitu=True and retfitres=False: 2797 None. 2798 (3) in case insitu=False and retfitres=True: 2799 a dictionary containing a new scantable 2800 (with baseline subtracted) and the fitting 2801 results. 2802 (4) in case insitu=False and retfitres=False: 2803 a new scantable (with baseline subtracted). 2766 2804 blinfo: baseline parameter set stored in a dictionary 2767 2805 or a list of dictionary. Each dictionary … … 2803 2841 try: 2804 2842 varlist = vars() 2843 if retfitres is None: retfitres = False 2805 2844 if blinfo is None: blinfo = [] 2806 2845 if bltable is None: bltable = '' … … 2820 2859 2821 2860 sres = workscan._sub_baseline(in_blinfo, 2861 retfitres, 2822 2862 bltable, 2823 2863 os.path.exists(bltable), 2824 2864 overwrite) 2825 res = parse_fitresult(sres)2865 if retfitres: res = parse_fitresult(sres) 2826 2866 2827 2867 workscan._add_history('sub_baseline', varlist) … … 2829 2869 if insitu: 2830 2870 self._assign(workscan) 2831 return res 2871 if retfitres: 2872 return res 2873 else: 2874 return None 2832 2875 else: 2833 return {'scantable': workscan, 'fitresults': res} 2876 if retfitres: 2877 return {'scantable': workscan, 'fitresults': res} 2878 else: 2879 return workscan 2834 2880 2835 2881 except RuntimeError, e:
Note:
See TracChangeset
for help on using the changeset viewer.