Changeset 2810 for trunk/python


Ignore:
Timestamp:
04/11/13 18:26:00 (11 years ago)
Author:
WataruKawasaki
Message:

New Development: No

JIRA Issue: No

Ready for Test: Yes

Interface Changes: No

What Interface Changed:

Test Programs:

Put in Release Notes: No

Module(s): sd.scantable

Description: a bug fix in sd.scantable.pack_blinfo().


File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/scantable.py

    r2809 r2810  
    266266    if lf_params_n == 3:
    267267        dinfo['use_linefinder'] = 'true'
    268     elif lf_params_n == 1:
     268    elif lf_params_n == 0:
    269269        dinfo['use_linefinder'] = 'false'
    270270        dinfo['thresh']         = ''
     
    27002700
    27012701    @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):
    27032703        """\
    27042704        Subtract baseline based on parameters written in Baseline Table.
     
    27062706        Parameters:
    27072707            insitu:        if True, baseline fitting/subtraction is done
    2708                            in-situ and fitting results is returned. If
    2709                            False, a dictionary containing new scantable
    2710                            (with baseline subtracted) and fitting results
    2711                            is 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).
    27122712                           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).
    27132728            inbltable:     name of input baseline table. The row number of
    27142729                           scantable and that of inbltable must be
     
    27252740        try:
    27262741            varlist = vars()
     2742            if retfitres      is None: retfitres      = False
    27272743            if inbltable      is None: raise ValueError("bltable missing.")
    27282744            if outbltable     is None: outbltable     = ''
     
    27362752
    27372753            sres = workscan._apply_bltable(inbltable,
     2754                                           retfitres,
    27382755                                           outbltable,
    27392756                                           os.path.exists(outbltable),
    27402757                                           overwrite)
    2741             res = parse_fitresult(sres)
     2758            if retfitres: res = parse_fitresult(sres)
    27422759
    27432760            workscan._add_history('apply_bltable', varlist)
     
    27452762            if insitu:
    27462763                self._assign(workscan)
    2747                 return res
     2764                if retfitres:
     2765                    return res
     2766                else:
     2767                    return None
    27482768            else:
    2749                 return {'scantable': workscan, 'fitresults': res}
     2769                if retfitres:
     2770                    return {'scantable': workscan, 'fitresults': res}
     2771                else:
     2772                    return workscan
    27502773       
    27512774        except RuntimeError, e:
     
    27532776
    27542777    @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):
    27562779        """\
    27572780        Subtract baseline based on parameters written in the input list.
     
    27592782        Parameters:
    27602783            insitu:        if True, baseline fitting/subtraction is done
    2761                            in-situ and fitting results is returned. If
    2762                            False, a dictionary containing new scantable
    2763                            (with baseline subtracted) and fitting results
    2764                            is 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).
    27652788                           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).
    27662804            blinfo:        baseline parameter set stored in a dictionary
    27672805                           or a list of dictionary. Each dictionary
     
    28032841        try:
    28042842            varlist = vars()
     2843            if retfitres      is None: retfitres      = False
    28052844            if blinfo         is None: blinfo         = []
    28062845            if bltable        is None: bltable        = ''
     
    28202859
    28212860            sres = workscan._sub_baseline(in_blinfo,
     2861                                          retfitres,
    28222862                                          bltable,
    28232863                                          os.path.exists(bltable),
    28242864                                          overwrite)
    2825             res = parse_fitresult(sres)
     2865            if retfitres: res = parse_fitresult(sres)
    28262866           
    28272867            workscan._add_history('sub_baseline', varlist)
     
    28292869            if insitu:
    28302870                self._assign(workscan)
    2831                 return res
     2871                if retfitres:
     2872                    return res
     2873                else:
     2874                    return None
    28322875            else:
    2833                 return {'scantable': workscan, 'fitresults': res}
     2876                if retfitres:
     2877                    return {'scantable': workscan, 'fitresults': res}
     2878                else:
     2879                    return workscan
    28342880
    28352881        except RuntimeError, e:
Note: See TracChangeset for help on using the changeset viewer.