Changeset 2189 for trunk/python


Ignore:
Timestamp:
06/09/11 19:17:30 (14 years ago)
Author:
WataruKawasaki
Message:

New Development: No

JIRA Issue: Yes CAS-3149

Ready for Test: Yes

Interface Changes: Yes

What Interface Changed: scantable.*_baseline() parameter

Test Programs:

Put in Release Notes: No

Module(s):

Description: Added two parameters 'showprogress' and 'minnrow' to scantable.*_baseline() to enable to show progress status during time-consuming processes.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/scantable.py

    r2186 r2189  
    169169    else:
    170170        raise RuntimeError(str(e)+'\n'+msg)
    171    
     171
     172def pack_progress_params(showprogress, minnrow):
     173    return str(showprogress).lower() + ',' + str(minnrow)
    172174
    173175class scantable(Scantable):
     
    22912293    def sinusoid_baseline(self, insitu=None, mask=None, applyfft=None, fftmethod=None, fftthresh=None,
    22922294                          addwn=None, rejwn=None, clipthresh=None, clipniter=None, plot=None,
    2293                           getresidual=None, outlog=None, blfile=None):
     2295                          getresidual=None, showprogress=None, minnrow=None, outlog=None, blfile=None):
    22942296        """\
    22952297        Return a scan which has been baselined (all rows) with sinusoidal functions.
     
    23362338            getresidual:   if False, returns best-fit values instead of
    23372339                           residual. (default is True)
     2340            showprogress:  show progress status for large data.
     2341                           default is True.
     2342            minnrow:       minimum number of input spectra to show.
     2343                           default is 1000.
    23382344            outlog:        Output the coefficients of the best-fit
    23392345                           function to logger (default is False)
     
    23722378            if plot          is None: plot          = False
    23732379            if getresidual   is None: getresidual   = True
     2380            if showprogress  is None: showprogress  = True
     2381            if minnrow       is None: minnrow       = 1000
    23742382            if outlog        is None: outlog        = False
    23752383            if blfile        is None: blfile        = ''
    23762384
    23772385            #CURRENTLY, PLOT=true is UNAVAILABLE UNTIL sinusoidal fitting is implemented as a fitter method.
    2378             workscan._sinusoid_baseline(mask, applyfft, fftmethod.lower(), str(fftthresh).lower(), workscan._parse_wn(addwn), workscan._parse_wn(rejwn), clipthresh, clipniter, getresidual, outlog, blfile)
     2386            workscan._sinusoid_baseline(mask, applyfft, fftmethod.lower(), str(fftthresh).lower(), workscan._parse_wn(addwn), workscan._parse_wn(rejwn), clipthresh, clipniter, getresidual, pack_progress_params(showprogress, minnrow), outlog, blfile)
    23792387            workscan._add_history('sinusoid_baseline', varlist)
    23802388           
     
    23912399    def auto_sinusoid_baseline(self, insitu=None, mask=None, applyfft=None, fftmethod=None, fftthresh=None,
    23922400                               addwn=None, rejwn=None, clipthresh=None, clipniter=None, edge=None, threshold=None,
    2393                                chan_avg_limit=None, plot=None, getresidual=None, outlog=None, blfile=None):
     2401                               chan_avg_limit=None, plot=None, getresidual=None, showprogress=None, minnrow=None,
     2402                               outlog=None, blfile=None):
    23942403        """\
    23952404        Return a scan which has been baselined (all rows) with sinusoidal functions.
     
    23982407
    23992408        Parameters:
    2400             insitu:        if False a new scantable is returned.
    2401                            Otherwise, the scaling is done in-situ
    2402                            The default is taken from .asaprc (False)
    2403             mask:          an optional mask retreived from scantable
    2404             applyfft:      if True use some method, such as FFT, to find
    2405                            strongest sinusoidal components in the wavenumber
    2406                            domain to be used for baseline fitting.
    2407                            default is True.
    2408             fftmethod:     method to find the strong sinusoidal components.
    2409                            now only 'fft' is available and it is the default.
    2410             fftthresh:     the threshold to select wave numbers to be used for
    2411                            fitting from the distribution of amplitudes in the
    2412                            wavenumber domain.
    2413                            both float and string values accepted.
    2414                            given a float value, the unit is set to sigma.
    2415                            for string values, allowed formats include:
    2416                                'xsigma' or 'x' (= x-sigma level. e.g., '3sigma'), or
    2417                                'topx' (= the x strongest ones, e.g. 'top5').
    2418                            default is 3.0 (unit: sigma).
    2419             addwn:         the additional wave numbers to be used for fitting.
    2420                            list or integer value is accepted to specify every
    2421                            wave numbers. also string value can be used in case
    2422                            you need to specify wave numbers in a certain range,
    2423                            e.g., 'a-b' (= a, a+1, a+2, ..., b-1, b),
    2424                                  '<a'  (= 0,1,...,a-2,a-1),
    2425                                  '>=a' (= a, a+1, ... up to the maximum wave
    2426                                         number corresponding to the Nyquist
    2427                                         frequency for the case of FFT).
    2428                            default is [].
    2429             rejwn:         the wave numbers NOT to be used for fitting.
    2430                            can be set just as addwn but has higher priority:
    2431                            wave numbers which are specified both in addwn
    2432                            and rejwn will NOT be used. default is [].
    2433             clipthresh:    Clipping threshold. (default is 3.0, unit: sigma)
    2434             clipniter:     maximum number of iteration of 'clipthresh'-sigma clipping (default is 0)
    2435             edge:          an optional number of channel to drop at
    2436                            the edge of spectrum. If only one value is
    2437                            specified, the same number will be dropped
    2438                            from both sides of the spectrum. Default
    2439                            is to keep all channels. Nested tuples
    2440                            represent individual edge selection for
    2441                            different IFs (a number of spectral channels
    2442                            can be different)
    2443             threshold:     the threshold used by line finder. It is
    2444                            better to keep it large as only strong lines
    2445                            affect the baseline solution.
    2446             chan_avg_limit:a maximum number of consequtive spectral
    2447                            channels to average during the search of
    2448                            weak and broad lines. The default is no
    2449                            averaging (and no search for weak lines).
    2450                            If such lines can affect the fitted baseline
    2451                            (e.g. a high order polynomial is fitted),
    2452                            increase this parameter (usually values up
    2453                            to 8 are reasonable). Most users of this
    2454                            method should find the default value sufficient.
    2455             plot:      *** CURRENTLY UNAVAILABLE, ALWAYS FALSE ***
    2456                            plot the fit and the residual. In this each
    2457                            indivual fit has to be approved, by typing 'y'
    2458                            or 'n'
    2459             getresidual:   if False, returns best-fit values instead of
    2460                            residual. (default is True)
    2461             outlog:        Output the coefficients of the best-fit
    2462                            function to logger (default is False)
    2463             blfile:        Name of a text file in which the best-fit
    2464                            parameter values to be written
    2465                            (default is "": no file/logger output)
     2409            insitu:         if False a new scantable is returned.
     2410                            Otherwise, the scaling is done in-situ
     2411                            The default is taken from .asaprc (False)
     2412            mask:           an optional mask retreived from scantable
     2413            applyfft:       if True use some method, such as FFT, to find
     2414                            strongest sinusoidal components in the wavenumber
     2415                            domain to be used for baseline fitting.
     2416                            default is True.
     2417            fftmethod:      method to find the strong sinusoidal components.
     2418                            now only 'fft' is available and it is the default.
     2419            fftthresh:      the threshold to select wave numbers to be used for
     2420                            fitting from the distribution of amplitudes in the
     2421                            wavenumber domain.
     2422                            both float and string values accepted.
     2423                            given a float value, the unit is set to sigma.
     2424                            for string values, allowed formats include:
     2425                                'xsigma' or 'x' (= x-sigma level. e.g., '3sigma'), or
     2426                                'topx' (= the x strongest ones, e.g. 'top5').
     2427                            default is 3.0 (unit: sigma).
     2428            addwn:          the additional wave numbers to be used for fitting.
     2429                            list or integer value is accepted to specify every
     2430                            wave numbers. also string value can be used in case
     2431                            you need to specify wave numbers in a certain range,
     2432                            e.g., 'a-b' (= a, a+1, a+2, ..., b-1, b),
     2433                                  '<a'  (= 0,1,...,a-2,a-1),
     2434                                  '>=a' (= a, a+1, ... up to the maximum wave
     2435                                         number corresponding to the Nyquist
     2436                                         frequency for the case of FFT).
     2437                            default is [].
     2438            rejwn:          the wave numbers NOT to be used for fitting.
     2439                            can be set just as addwn but has higher priority:
     2440                            wave numbers which are specified both in addwn
     2441                            and rejwn will NOT be used. default is [].
     2442            clipthresh:     Clipping threshold. (default is 3.0, unit: sigma)
     2443            clipniter:      maximum number of iteration of 'clipthresh'-sigma clipping (default is 0)
     2444            edge:           an optional number of channel to drop at
     2445                            the edge of spectrum. If only one value is
     2446                            specified, the same number will be dropped
     2447                            from both sides of the spectrum. Default
     2448                            is to keep all channels. Nested tuples
     2449                            represent individual edge selection for
     2450                            different IFs (a number of spectral channels
     2451                            can be different)
     2452            threshold:      the threshold used by line finder. It is
     2453                            better to keep it large as only strong lines
     2454                            affect the baseline solution.
     2455            chan_avg_limit: a maximum number of consequtive spectral
     2456                            channels to average during the search of
     2457                            weak and broad lines. The default is no
     2458                            averaging (and no search for weak lines).
     2459                            If such lines can affect the fitted baseline
     2460                            (e.g. a high order polynomial is fitted),
     2461                            increase this parameter (usually values up
     2462                            to 8 are reasonable). Most users of this
     2463                            method should find the default value sufficient.
     2464            plot:       *** CURRENTLY UNAVAILABLE, ALWAYS FALSE ***
     2465                            plot the fit and the residual. In this each
     2466                            indivual fit has to be approved, by typing 'y'
     2467                            or 'n'
     2468            getresidual:    if False, returns best-fit values instead of
     2469                            residual. (default is True)
     2470            showprogress:   show progress status for large data.
     2471                            default is True.
     2472            minnrow:        minimum number of input spectra to show.
     2473                            default is 1000.
     2474            outlog:         Output the coefficients of the best-fit
     2475                            function to logger (default is False)
     2476            blfile:         Name of a text file in which the best-fit
     2477                            parameter values to be written
     2478                            (default is "": no file/logger output)
    24662479
    24672480        Example:
     
    24952508            if plot           is None: plot           = False
    24962509            if getresidual    is None: getresidual    = True
     2510            if showprogress   is None: showprogress   = True
     2511            if minnrow        is None: minnrow        = 1000
    24972512            if outlog         is None: outlog         = False
    24982513            if blfile         is None: blfile         = ''
    24992514
    25002515            #CURRENTLY, PLOT=true is UNAVAILABLE UNTIL sinusoidal fitting is implemented as a fitter method.
    2501             workscan._auto_sinusoid_baseline(mask, applyfft, fftmethod.lower(), str(fftthresh).lower(), workscan._parse_wn(addwn), workscan._parse_wn(rejwn), clipthresh, clipniter, normalise_edge_param(edge), threshold, chan_avg_limit, getresidual, outlog, blfile)
     2516            workscan._auto_sinusoid_baseline(mask, applyfft, fftmethod.lower(), str(fftthresh).lower(), workscan._parse_wn(addwn), workscan._parse_wn(rejwn), clipthresh, clipniter, normalise_edge_param(edge), threshold, chan_avg_limit, getresidual, pack_progress_params(showprogress, minnrow), outlog, blfile)
    25022517            workscan._add_history("auto_sinusoid_baseline", varlist)
    25032518           
     
    25112526
    25122527    @asaplog_post_dec
    2513     def cspline_baseline(self, insitu=None, mask=None, npiece=None,
    2514                          clipthresh=None, clipniter=None, plot=None, getresidual=None, outlog=None, blfile=None):
     2528    def cspline_baseline(self, insitu=None, mask=None, npiece=None, clipthresh=None, clipniter=None,
     2529                         plot=None, getresidual=None, showprogress=None, minnrow=None, outlog=None, blfile=None):
    25152530        """\
    25162531        Return a scan which has been baselined (all rows) by cubic spline function (piecewise cubic polynomial).
    25172532        Parameters:
    2518             insitu:     If False a new scantable is returned.
    2519                         Otherwise, the scaling is done in-situ
    2520                         The default is taken from .asaprc (False)
    2521             mask:       An optional mask
    2522             npiece:     Number of pieces. (default is 2)
    2523             clipthresh: Clipping threshold. (default is 3.0, unit: sigma)
    2524             clipniter:  maximum number of iteration of 'clipthresh'-sigma clipping (default is 0)
    2525             plot:   *** CURRENTLY UNAVAILABLE, ALWAYS FALSE ***
    2526                         plot the fit and the residual. In this each
    2527                         indivual fit has to be approved, by typing 'y'
    2528                         or 'n'
    2529             getresidual:if False, returns best-fit values instead of
    2530                         residual. (default is True)
    2531             outlog:     Output the coefficients of the best-fit
    2532                         function to logger (default is False)
    2533             blfile:     Name of a text file in which the best-fit
    2534                         parameter values to be written
    2535                         (default is "": no file/logger output)
     2533            insitu:       If False a new scantable is returned.
     2534                          Otherwise, the scaling is done in-situ
     2535                          The default is taken from .asaprc (False)
     2536            mask:         An optional mask
     2537            npiece:       Number of pieces. (default is 2)
     2538            clipthresh:   Clipping threshold. (default is 3.0, unit: sigma)
     2539            clipniter:    maximum number of iteration of 'clipthresh'-sigma clipping (default is 0)
     2540            plot:     *** CURRENTLY UNAVAILABLE, ALWAYS FALSE ***
     2541                          plot the fit and the residual. In this each
     2542                          indivual fit has to be approved, by typing 'y'
     2543                          or 'n'
     2544            getresidual:  if False, returns best-fit values instead of
     2545                          residual. (default is True)
     2546            showprogress: show progress status for large data.
     2547                          default is True.
     2548            minnrow:      minimum number of input spectra to show.
     2549                          default is 1000.
     2550            outlog:       Output the coefficients of the best-fit
     2551                          function to logger (default is False)
     2552            blfile:       Name of a text file in which the best-fit
     2553                          parameter values to be written
     2554                          (default is "": no file/logger output)
    25362555
    25372556        Example:
     
    25542573                workscan = self.copy()
    25552574
    2556             if mask        is None: mask        = [True for i in xrange(workscan.nchan())]
    2557             if npiece      is None: npiece      = 2
    2558             if clipthresh  is None: clipthresh  = 3.0
    2559             if clipniter   is None: clipniter   = 0
    2560             if plot        is None: plot        = False
    2561             if getresidual is None: getresidual = True
    2562             if outlog      is None: outlog      = False
    2563             if blfile      is None: blfile      = ''
     2575            if mask         is None: mask         = [True for i in xrange(workscan.nchan())]
     2576            if npiece       is None: npiece       = 2
     2577            if clipthresh   is None: clipthresh   = 3.0
     2578            if clipniter    is None: clipniter    = 0
     2579            if plot         is None: plot         = False
     2580            if getresidual  is None: getresidual  = True
     2581            if showprogress is None: showprogress = True
     2582            if minnrow      is None: minnrow      = 1000
     2583            if outlog       is None: outlog       = False
     2584            if blfile       is None: blfile       = ''
    25642585
    25652586            #CURRENTLY, PLOT=true UNAVAILABLE UNTIL cubic spline fitting is implemented as a fitter method.
    2566             workscan._cspline_baseline(mask, npiece, clipthresh, clipniter, getresidual, outlog, blfile)
     2587            workscan._cspline_baseline(mask, npiece, clipthresh, clipniter, getresidual, pack_progress_params(showprogress, minnrow), outlog, blfile)
    25672588            workscan._add_history("cspline_baseline", varlist)
    25682589           
     
    25762597
    25772598    @asaplog_post_dec
    2578     def auto_cspline_baseline(self, insitu=None, mask=None, npiece=None, clipthresh=None,
    2579                               clipniter=None, edge=None, threshold=None,
    2580                               chan_avg_limit=None, getresidual=None, plot=None, outlog=None, blfile=None):
     2599    def auto_cspline_baseline(self, insitu=None, mask=None, npiece=None, clipthresh=None, clipniter=None,
     2600                              edge=None, threshold=None, chan_avg_limit=None, getresidual=None, plot=None,
     2601                              showprogress=None, minnrow=None, outlog=None, blfile=None):
    25812602        """\
    25822603        Return a scan which has been baselined (all rows) by cubic spline
     
    25862607
    25872608        Parameters:
    2588             insitu:     if False a new scantable is returned.
    2589                         Otherwise, the scaling is done in-situ
    2590                         The default is taken from .asaprc (False)
    2591             mask:       an optional mask retreived from scantable
    2592             npiece:     Number of pieces. (default is 2)
    2593             clipthresh: Clipping threshold. (default is 3.0, unit: sigma)
    2594             clipniter:  maximum number of iteration of 'clipthresh'-sigma clipping (default is 0)
    2595             edge:       an optional number of channel to drop at
    2596                         the edge of spectrum. If only one value is
    2597                         specified, the same number will be dropped
    2598                         from both sides of the spectrum. Default
    2599                         is to keep all channels. Nested tuples
    2600                         represent individual edge selection for
    2601                         different IFs (a number of spectral channels
    2602                         can be different)
    2603             threshold:  the threshold used by line finder. It is
    2604                         better to keep it large as only strong lines
    2605                         affect the baseline solution.
    2606             chan_avg_limit:
    2607                         a maximum number of consequtive spectral
    2608                         channels to average during the search of
    2609                         weak and broad lines. The default is no
    2610                         averaging (and no search for weak lines).
    2611                         If such lines can affect the fitted baseline
    2612                         (e.g. a high order polynomial is fitted),
    2613                         increase this parameter (usually values up
    2614                         to 8 are reasonable). Most users of this
    2615                         method should find the default value sufficient.
    2616             plot:   *** CURRENTLY UNAVAILABLE, ALWAYS FALSE ***
    2617                         plot the fit and the residual. In this each
    2618                         indivual fit has to be approved, by typing 'y'
    2619                         or 'n'
    2620             getresidual:if False, returns best-fit values instead of
    2621                         residual. (default is True)
    2622             outlog:     Output the coefficients of the best-fit
    2623                         function to logger (default is False)
    2624             blfile:     Name of a text file in which the best-fit
    2625                         parameter values to be written
    2626                         (default is "": no file/logger output)
     2609            insitu:         if False a new scantable is returned.
     2610                            Otherwise, the scaling is done in-situ
     2611                            The default is taken from .asaprc (False)
     2612            mask:           an optional mask retreived from scantable
     2613            npiece:         Number of pieces. (default is 2)
     2614            clipthresh:     Clipping threshold. (default is 3.0, unit: sigma)
     2615            clipniter:      maximum number of iteration of 'clipthresh'-sigma clipping (default is 0)
     2616            edge:           an optional number of channel to drop at
     2617                            the edge of spectrum. If only one value is
     2618                            specified, the same number will be dropped
     2619                            from both sides of the spectrum. Default
     2620                            is to keep all channels. Nested tuples
     2621                            represent individual edge selection for
     2622                            different IFs (a number of spectral channels
     2623                            can be different)
     2624            threshold:      the threshold used by line finder. It is
     2625                            better to keep it large as only strong lines
     2626                            affect the baseline solution.
     2627            chan_avg_limit: a maximum number of consequtive spectral
     2628                            channels to average during the search of
     2629                            weak and broad lines. The default is no
     2630                            averaging (and no search for weak lines).
     2631                            If such lines can affect the fitted baseline
     2632                            (e.g. a high order polynomial is fitted),
     2633                            increase this parameter (usually values up
     2634                            to 8 are reasonable). Most users of this
     2635                            method should find the default value sufficient.
     2636            plot:       *** CURRENTLY UNAVAILABLE, ALWAYS FALSE ***
     2637                            plot the fit and the residual. In this each
     2638                            indivual fit has to be approved, by typing 'y'
     2639                            or 'n'
     2640            getresidual:    if False, returns best-fit values instead of
     2641                            residual. (default is True)
     2642            showprogress:   show progress status for large data.
     2643                            default is True.
     2644            minnrow:        minimum number of input spectra to show.
     2645                            default is 1000.
     2646            outlog:         Output the coefficients of the best-fit
     2647                            function to logger (default is False)
     2648            blfile:         Name of a text file in which the best-fit
     2649                            parameter values to be written
     2650                            (default is "": no file/logger output)
    26272651
    26282652        Example:
     
    26522676            if plot           is None: plot           = False
    26532677            if getresidual    is None: getresidual    = True
     2678            if showprogress   is None: showprogress   = True
     2679            if minnrow        is None: minnrow        = 1000
    26542680            if outlog         is None: outlog         = False
    26552681            if blfile         is None: blfile         = ''
    26562682
    26572683            #CURRENTLY, PLOT=true UNAVAILABLE UNTIL cubic spline fitting is implemented as a fitter method.
    2658             workscan._auto_cspline_baseline(mask, npiece, clipthresh, clipniter, normalise_edge_param(edge), threshold, chan_avg_limit, getresidual, outlog, blfile)
     2684            workscan._auto_cspline_baseline(mask, npiece, clipthresh, clipniter, normalise_edge_param(edge), threshold, chan_avg_limit, getresidual, pack_progress_params(showprogress, minnrow), outlog, blfile)
    26592685            workscan._add_history("auto_cspline_baseline", varlist)
    26602686           
     
    26682694
    26692695    @asaplog_post_dec
    2670     def poly_baseline(self, insitu=None, mask=None, order=None, plot=None, getresidual=None, outlog=None, blfile=None):
     2696    def poly_baseline(self, insitu=None, mask=None, order=None, plot=None, getresidual=None,
     2697                      showprogress=None, minnrow=None, outlog=None, blfile=None):
    26712698        """\
    26722699        Return a scan which has been baselined (all rows) by a polynomial.
    26732700        Parameters:
    2674             insitu:     if False a new scantable is returned.
    2675                         Otherwise, the scaling is done in-situ
    2676                         The default is taken from .asaprc (False)
    2677             mask:       an optional mask
    2678             order:      the order of the polynomial (default is 0)
    2679             plot:       plot the fit and the residual. In this each
    2680                         indivual fit has to be approved, by typing 'y'
    2681                         or 'n'
    2682             getresidual:if False, returns best-fit values instead of
    2683                         residual. (default is True)
    2684             outlog:     Output the coefficients of the best-fit
    2685                         function to logger (default is False)
    2686             blfile:     Name of a text file in which the best-fit
    2687                         parameter values to be written
    2688                         (default is "": no file/logger output)
     2701            insitu:       if False a new scantable is returned.
     2702                          Otherwise, the scaling is done in-situ
     2703                          The default is taken from .asaprc (False)
     2704            mask:         an optional mask
     2705            order:        the order of the polynomial (default is 0)
     2706            plot:         plot the fit and the residual. In this each
     2707                          indivual fit has to be approved, by typing 'y'
     2708                          or 'n'
     2709            getresidual:  if False, returns best-fit values instead of
     2710                          residual. (default is True)
     2711            showprogress: show progress status for large data.
     2712                          default is True.
     2713            minnrow:      minimum number of input spectra to show.
     2714                          default is 1000.
     2715            outlog:       Output the coefficients of the best-fit
     2716                          function to logger (default is False)
     2717            blfile:       Name of a text file in which the best-fit
     2718                          parameter values to be written
     2719                          (default is "": no file/logger output)
    26892720
    26902721        Example:
     
    27032734                workscan = self.copy()
    27042735
    2705             if mask        is None: mask        = [True for i in xrange(workscan.nchan())]
    2706             if order       is None: order       = 0
    2707             if plot        is None: plot        = False
    2708             if getresidual is None: getresidual = True
    2709             if outlog      is None: outlog      = False
    2710             if blfile      is None: blfile      = ""
     2736            if mask         is None: mask         = [True for i in xrange(workscan.nchan())]
     2737            if order        is None: order        = 0
     2738            if plot         is None: plot         = False
     2739            if getresidual  is None: getresidual  = True
     2740            if showprogress is None: showprogress = True
     2741            if minnrow      is None: minnrow      = 1000
     2742            if outlog       is None: outlog       = False
     2743            if blfile       is None: blfile       = ""
    27112744
    27122745            if plot:
     
    27482781                if outblfile: blf.close()
    27492782            else:
    2750                 workscan._poly_baseline(mask, order, getresidual, outlog, blfile)
     2783                workscan._poly_baseline(mask, order, getresidual, pack_progress_params(showprogress, minnrow), outlog, blfile)
    27512784           
    27522785            workscan._add_history("poly_baseline", varlist)
     
    27612794
    27622795    @asaplog_post_dec
    2763     def auto_poly_baseline(self, insitu=None, mask=None, order=None, edge=None, threshold=None,
    2764                            chan_avg_limit=None, plot=None, getresidual=None, outlog=None, blfile=None):
     2796    def auto_poly_baseline(self, insitu=None, mask=None, order=None, edge=None, threshold=None, chan_avg_limit=None,
     2797                           plot=None, getresidual=None, showprogress=None, minnrow=None, outlog=None, blfile=None):
    27652798        """\
    27662799        Return a scan which has been baselined (all rows) by a polynomial.
     
    27692802
    27702803        Parameters:
    2771             insitu:     if False a new scantable is returned.
    2772                         Otherwise, the scaling is done in-situ
    2773                         The default is taken from .asaprc (False)
    2774             mask:       an optional mask retreived from scantable
    2775             order:      the order of the polynomial (default is 0)
    2776             edge:       an optional number of channel to drop at
    2777                         the edge of spectrum. If only one value is
    2778                         specified, the same number will be dropped
    2779                         from both sides of the spectrum. Default
    2780                         is to keep all channels. Nested tuples
    2781                         represent individual edge selection for
    2782                         different IFs (a number of spectral channels
    2783                         can be different)
    2784             threshold:  the threshold used by line finder. It is
    2785                         better to keep it large as only strong lines
    2786                         affect the baseline solution.
    2787             chan_avg_limit:
    2788                         a maximum number of consequtive spectral
    2789                         channels to average during the search of
    2790                         weak and broad lines. The default is no
    2791                         averaging (and no search for weak lines).
    2792                         If such lines can affect the fitted baseline
    2793                         (e.g. a high order polynomial is fitted),
    2794                         increase this parameter (usually values up
    2795                         to 8 are reasonable). Most users of this
    2796                         method should find the default value sufficient.
    2797             plot:       plot the fit and the residual. In this each
    2798                         indivual fit has to be approved, by typing 'y'
    2799                         or 'n'
    2800             getresidual:if False, returns best-fit values instead of
    2801                         residual. (default is True)
    2802             outlog:     Output the coefficients of the best-fit
    2803                         function to logger (default is False)
    2804             blfile:     Name of a text file in which the best-fit
    2805                         parameter values to be written
    2806                         (default is "": no file/logger output)
     2804            insitu:         if False a new scantable is returned.
     2805                            Otherwise, the scaling is done in-situ
     2806                            The default is taken from .asaprc (False)
     2807            mask:           an optional mask retreived from scantable
     2808            order:          the order of the polynomial (default is 0)
     2809            edge:           an optional number of channel to drop at
     2810                            the edge of spectrum. If only one value is
     2811                            specified, the same number will be dropped
     2812                            from both sides of the spectrum. Default
     2813                            is to keep all channels. Nested tuples
     2814                            represent individual edge selection for
     2815                            different IFs (a number of spectral channels
     2816                            can be different)
     2817            threshold:      the threshold used by line finder. It is
     2818                            better to keep it large as only strong lines
     2819                            affect the baseline solution.
     2820            chan_avg_limit: a maximum number of consequtive spectral
     2821                            channels to average during the search of
     2822                            weak and broad lines. The default is no
     2823                            averaging (and no search for weak lines).
     2824                            If such lines can affect the fitted baseline
     2825                            (e.g. a high order polynomial is fitted),
     2826                            increase this parameter (usually values up
     2827                            to 8 are reasonable). Most users of this
     2828                            method should find the default value sufficient.
     2829            plot:           plot the fit and the residual. In this each
     2830                            indivual fit has to be approved, by typing 'y'
     2831                            or 'n'
     2832            getresidual:    if False, returns best-fit values instead of
     2833                            residual. (default is True)
     2834            showprogress:   show progress status for large data.
     2835                            default is True.
     2836            minnrow:        minimum number of input spectra to show.
     2837                            default is 1000.
     2838            outlog:         Output the coefficients of the best-fit
     2839                            function to logger (default is False)
     2840            blfile:         Name of a text file in which the best-fit
     2841                            parameter values to be written
     2842                            (default is "": no file/logger output)
    28072843
    28082844        Example:
     
    28262862            if plot           is None: plot           = False
    28272863            if getresidual    is None: getresidual    = True
     2864            if showprogress   is None: showprogress   = True
     2865            if minnrow        is None: minnrow        = 1000
    28282866            if outlog         is None: outlog         = False
    28292867            if blfile         is None: blfile         = ''
     
    28772915                if outblfile: blf.close()
    28782916            else:
    2879                 workscan._auto_poly_baseline(mask, order, edge, threshold, chan_avg_limit, getresidual, outlog, blfile)
     2917                workscan._auto_poly_baseline(mask, order, edge, threshold, chan_avg_limit, getresidual, pack_progress_params(showprogress, minnrow), outlog, blfile)
    28802918
    28812919            workscan._add_history("auto_poly_baseline", varlist)
Note: See TracChangeset for help on using the changeset viewer.