Changeset 1846


Ignore:
Timestamp:
08/04/10 14:52:53 (14 years ago)
Author:
Malte Marquarding
Message:

Documentation update to play nicer with sphinx

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/scantable.py

    r1845 r1846  
     1"""This module defines the scantable class."""
     2
    13import os
    24try:
     
    2527    return wrap
    2628
    27 
    2829def is_scantable(filename):
     30    """Is the given file a scantable?
     31
     32    Parameters:
     33
     34        filename: the name of the file/directory to test
     35
     36    """
    2937    return (os.path.isdir(filename)
    3038            and not os.path.exists(filename+'/table.f1')
     
    3341
    3442class scantable(Scantable):
    35     """
    36         The ASAP container for scans
     43    """\
     44        The ASAP container for scans (single-dish data).
    3745    """
    3846
     
    4048    def __init__(self, filename, average=None, unit=None, getpt=None,
    4149                 antenna=None, parallactify=None):
    42         """
     50        """\
    4351        Create a scantable from a saved one or make a reference
    44         Parameters:
    45             filename:    the name of an asap table on disk
    46                          or
    47                          the name of a rpfits/sdfits/ms file
    48                          (integrations within scans are auto averaged
    49                          and the whole file is read)
    50                          or
    51                          [advanced] a reference to an existing
    52                          scantable
    53             average:     average all integrations withinb a scan on read.
    54                          The default (True) is taken from .asaprc.
     52
     53        Parameters:
     54
     55            filename:     the name of an asap table on disk
     56                          or
     57                          the name of a rpfits/sdfits/ms file
     58                          (integrations within scans are auto averaged
     59                          and the whole file is read) or
     60                          [advanced] a reference to an existing scantable
     61
     62            average:      average all integrations withinb a scan on read.
     63                          The default (True) is taken from .asaprc.
     64
    5565            unit:         brightness unit; must be consistent with K or Jy.
    56                          Over-rides the default selected by the filler
    57                          (input rpfits/sdfits/ms) or replaces the value
    58                          in existing scantables
    59             getpt:       for MeasurementSet input data only:
    60                          If True, all pointing data are filled.
    61                          The deafult is False, which makes time to load
    62                          the MS data faster in some cases.
    63             antenna:     Antenna selection. integer (id) or string (name
    64                          or id).
    65             parallactify: Indicate that the data had been parallatified.
    66                           Default is taken form rc file.
     66                          Over-rides the default selected by the filler
     67                          (input rpfits/sdfits/ms) or replaces the value
     68                          in existing scantables
     69
     70            getpt:        for MeasurementSet input data only:
     71                          If True, all pointing data are filled.
     72                          The deafult is False, which makes time to load
     73                          the MS data faster in some cases.
     74
     75            antenna:      Antenna selection. integer (id) or string (name or id).
     76
     77            parallactify: Indicate that the data had been parallatified. Default
     78                          is taken from rc file.
     79
    6780        """
    6881        if average is None:
     
    136149    @print_log_dec
    137150    def save(self, name=None, format=None, overwrite=False):
    138         """
     151        """\
    139152        Store the scantable on disk. This can be an asap (aips++) Table,
    140153        SDFITS or MS2 format.
    141         Parameters:
     154
     155        Parameters:
     156
    142157            name:        the name of the outputfile. For format "ASCII"
    143158                         this is the root file name (data in 'name'.txt
     
    155170                         The default False is to return with warning
    156171                         without writing the output. USE WITH CARE.
    157         Example:
     172        Example::
     173
    158174            scan.save('myscan.asap')
    159175            scan.save('myscan.sdfits', 'SDFITS')
     176
    160177        """
    161178        from os import path
     
    188205
    189206    def copy(self):
    190         """
    191         Return a copy of this scantable.
    192         Note:
     207        """Return a copy of this scantable.
     208
     209        *Note*:
     210
    193211            This makes a full (deep) copy. scan2 = scan1 makes a reference.
    194         Parameters:
    195             none
    196         Example:
     212
     213        Example::
     214
    197215            copiedscan = scan.copy()
     216
    198217        """
    199218        sd = scantable(Scantable._copy(self))
     
    201220
    202221    def drop_scan(self, scanid=None):
    203         """
     222        """\
    204223        Return a new scantable where the specified scan number(s) has(have)
    205224        been dropped.
    206         Parameters:
     225
     226        Parameters:
     227
    207228            scanid:    a (list of) scan number(s)
     229
    208230        """
    209231        from asap import _is_sequence_or_number as _is_valid
     
    255277        Return a specific scan (by scanno) or collection of scans (by
    256278        source name) in a new scantable.
    257         Note:
     279
     280        *Note*:
     281
    258282            See scantable.drop_scan() for the inverse operation.
    259         Parameters:
     283
     284        Parameters:
     285
    260286            scanid:    a (list of) scanno or a source name, unix-style
    261287                       patterns are accepted for source name matching, e.g.
    262288                       '*_R' gets all 'ref scans
    263         Example:
     289
     290        Example::
     291
    264292            # get all scans containing the source '323p459'
    265293            newscan = scan.get_scan('323p459')
     
    268296            # get a susbset of scans by scanno (as listed in scan.summary())
    269297            newscan = scan.get_scan([0, 2, 7, 10])
     298
    270299        """
    271300        if scanid is None:
     
    273302                #print "Please specify a scan no or name to " \
    274303                #      "retrieve from the scantable"
    275                 asaplog.push( 'Please specify a scan no or name to retrieve from the scantable' )
     304                asaplog.push( 'Please specify a scan no or name to retrieve'
     305                             ' from the scantable' )
    276306                print_log( 'ERROR' )
    277307                return
     
    311341
    312342    def summary(self, filename=None):
    313         """
     343        """\
    314344        Print a summary of the contents of this scantable.
    315         Parameters:
     345
     346        Parameters:
     347
    316348            filename:    the name of a file to write the putput to
    317349                         Default - no file output
     350
    318351        """
    319352        info = Scantable._summary(self, True)
     
    346379    def get_spectrum(self, rowno):
    347380        """Return the spectrum for the current row in the scantable as a list.
    348         Parameters:
     381
     382        Parameters:
     383
    349384             rowno:   the row number to retrieve the spectrum from
     385
    350386        """
    351387        return self._getspectrum(rowno)
     
    353389    def get_mask(self, rowno):
    354390        """Return the mask for the current row in the scantable as a list.
    355         Parameters:
     391
     392        Parameters:
     393
    356394             rowno:   the row number to retrieve the mask from
     395
    357396        """
    358397        return self._getmask(rowno)
     
    360399    def set_spectrum(self, spec, rowno):
    361400        """Return the spectrum for the current row in the scantable as a list.
    362         Parameters:
     401
     402        Parameters:
     403
    363404             spec:   the spectrum
    364405             rowno:    the row number to set the spectrum for
     406
    365407        """
    366408        assert(len(spec) == self.nchan())
     
    369411    def get_coordinate(self, rowno):
    370412        """Return the (spectral) coordinate for a a given 'rowno'.
    371         NOTE:
     413
     414        *Note*:
     415
    372416            * This coordinate is only valid until a scantable method modifies
    373417              the frequency axis.
     
    376420              specified frame (e.g. LSRK/TOPO). To get the 'real' coordinate,
    377421              use scantable.freq_align first. Without it there is no closure,
    378               i.e.
    379               c = myscan.get_coordinate(0)
    380               c.to_frequency(c.get_reference_pixel()) != c.get_reference_value()
    381 
    382         Parameters:
     422              i.e.::
     423
     424                  c = myscan.get_coordinate(0)
     425                  c.to_frequency(c.get_reference_pixel()) != c.get_reference_value()
     426
     427        Parameters:
     428
    383429             rowno:    the row number for the spectral coordinate
    384430
     
    387433
    388434    def get_selection(self):
    389         """
     435        """\
    390436        Get the selection object currently set on this scantable.
    391         Parameters:
    392             none
    393         Example:
     437
     438        Example::
     439
    394440            sel = scan.get_selection()
    395441            sel.set_ifs(0)              # select IF 0
    396442            scan.set_selection(sel)     # apply modified selection
     443
    397444        """
    398445        return selector(self._getselection())
    399446
    400447    def set_selection(self, selection=None, **kw):
    401         """
     448        """\
    402449        Select a subset of the data. All following operations on this scantable
    403450        are only applied to thi selection.
    404         Parameters:
    405             selection:    a selector object (default unset the selection),
    406 
    407             or
    408 
    409             any combination of
    410             "pols", "ifs", "beams", "scans", "cycles", "name", "query"
    411 
    412         Examples:
     451
     452        Parameters:
     453
     454            selection:    a selector object (default unset the selection), or
     455                          any combination of "pols", "ifs", "beams", "scans",
     456                          "cycles", "name", "query"
     457
     458        Examples::
     459
    413460            sel = selector()         # create a selection object
    414461            self.set_scans([0, 3])    # select SCANNO 0 and 3
     
    420467            scan.summary()           # will only print summary of scanno 0 an 3
    421468            scan.set_selection()     # unset the selection
     469
    422470        """
    423471        if selection is None:
     
    434482
    435483    def get_row(self, row=0, insitu=None):
    436         """
     484        """\
    437485        Select a row in the scantable.
    438486        Return a scantable with single row.
    439         Parameters:
    440             row: row no of integration, default is 0.
    441             insitu: if False a new scantable is returned.
    442                     Otherwise, the scaling is done in-situ
    443                     The default is taken from .asaprc (False)
     487
     488        Parameters:
     489
     490            row:    row no of integration, default is 0.
     491            insitu: if False a new scantable is returned. Otherwise, the
     492                    scaling is done in-situ. The default is taken from .asaprc
     493                    (False)
     494
    444495        """
    445496        if insitu is None: insitu = rcParams['insitu']
     
    468519    #def stats(self, stat='stddev', mask=None):
    469520    def stats(self, stat='stddev', mask=None, form='3.3f'):
    470         """
     521        """\
    471522        Determine the specified statistic of the current beam/if/pol
    472523        Takes a 'mask' as an optional parameter to specify which
    473524        channels should be excluded.
    474         Parameters:
     525
     526        Parameters:
     527
    475528            stat:    'min', 'max', 'min_abc', 'max_abc', 'sumsq', 'sum',
    476529                     'mean', 'var', 'stddev', 'avdev', 'rms', 'median'
     
    478531                     should be determined.
    479532            form:    format string to print statistic values
    480         Example:
     533
     534        Example::
     535
    481536            scan.set_unit('channel')
    482537            msk = scan.create_mask([100, 200], [500, 600])
    483538            scan.stats(stat='mean', mask=m)
     539
    484540        """
    485541        mask = mask or []
     
    557613
    558614    def chan2data(self, rowno=0, chan=0):
    559         """
     615        """\
    560616        Returns channel/frequency/velocity and spectral value
    561617        at an arbitrary row and channel in the scantable.
    562         Parameters:
     618
     619        Parameters:
     620
    563621            rowno:   a row number in the scantable. Default is the
    564622                     first row, i.e. rowno=0
    565623            chan:    a channel in the scantable. Default is the first
    566624                     channel, i.e. pos=0
     625
    567626        """
    568627        if isinstance(rowno, int) and isinstance(chan, int):
     
    574633
    575634    def stddev(self, mask=None):
    576         """
     635        """\
    577636        Determine the standard deviation of the current beam/if/pol
    578637        Takes a 'mask' as an optional parameter to specify which
    579638        channels should be excluded.
    580         Parameters:
     639
     640        Parameters:
     641
    581642            mask:    an optional mask specifying where the standard
    582643                     deviation should be determined.
    583644
    584         Example:
     645        Example::
     646
    585647            scan.set_unit('channel')
    586648            msk = scan.create_mask([100, 200], [500, 600])
    587649            scan.stddev(mask=m)
     650
    588651        """
    589652        return self.stats(stat='stddev', mask=mask);
     
    591654
    592655    def get_column_names(self):
    593         """
     656        """\
    594657        Return a  list of column names, which can be used for selection.
    595658        """
     
    597660
    598661    def get_tsys(self, row=-1):
    599         """
     662        """\
    600663        Return the System temperatures.
     664
     665        Parameters:
     666
     667            row:    the rowno to get the information for. (default all rows)
     668
    601669        Returns:
     670
    602671            a list of Tsys values for the current selection
     672
    603673        """
    604674        if row > -1:
     
    608678
    609679    def get_weather(self, row=-1):
     680        """\
     681        Return the weather informations.
     682
     683        Parameters:
     684
     685            row:    the rowno to get the information for. (default all rows)
     686
     687        Returns:
     688
     689            a dict or list of of dicts of values for the current selection
     690
     691        """
     692
    610693        values = self._get_column(self._get_weather, row)
    611694        if row > -1:
     
    659742
    660743    def get_time(self, row=-1, asdatetime=False):
    661         """
     744        """\
    662745        Get a list of time stamps for the observations.
    663746        Return a datetime object for each integration time stamp in the scantable.
    664         Parameters:
     747
     748        Parameters:
     749
    665750            row:          row no of integration. Default -1 return all rows
    666751            asdatetime:   return values as datetime objects rather than strings
    667         Example:
    668             none
     752
    669753        """
    670754        from time import strptime
     
    681765
    682766    def get_inttime(self, row=-1):
    683         """
     767        """\
    684768        Get a list of integration times for the observations.
    685769        Return a time in seconds for each integration in the scantable.
    686         Parameters:
     770
     771        Parameters:
     772
    687773            row:    row no of integration. Default -1 return all rows.
    688         Example:
    689             none
     774
    690775        """
    691776        return self._get_column(self._getinttime, row)
     
    693778
    694779    def get_sourcename(self, row=-1):
    695         """
     780        """\
    696781        Get a list source names for the observations.
    697782        Return a string for each integration in the scantable.
    698783        Parameters:
     784
    699785            row:    row no of integration. Default -1 return all rows.
    700         Example:
    701             none
     786
    702787        """
    703788        return self._get_column(self._getsourcename, row)
    704789
    705790    def get_elevation(self, row=-1):
    706         """
     791        """\
    707792        Get a list of elevations for the observations.
    708793        Return a float for each integration in the scantable.
    709         Parameters:
     794
     795        Parameters:
     796
    710797            row:    row no of integration. Default -1 return all rows.
    711         Example:
    712             none
     798
    713799        """
    714800        return self._get_column(self._getelevation, row)
    715801
    716802    def get_azimuth(self, row=-1):
    717         """
     803        """\
    718804        Get a list of azimuths for the observations.
    719805        Return a float for each integration in the scantable.
     806
    720807        Parameters:
    721808            row:    row no of integration. Default -1 return all rows.
    722         Example:
    723             none
     809
    724810        """
    725811        return self._get_column(self._getazimuth, row)
    726812
    727813    def get_parangle(self, row=-1):
    728         """
     814        """\
    729815        Get a list of parallactic angles for the observations.
    730816        Return a float for each integration in the scantable.
    731         Parameters:
     817
     818        Parameters:
     819
    732820            row:    row no of integration. Default -1 return all rows.
    733         Example:
    734             none
     821
    735822        """
    736823        return self._get_column(self._getparangle, row)
     
    748835
    749836    def get_directionval(self, row=-1):
    750         """
     837        """\
    751838        Get a list of Positions on the sky (direction) for the observations.
    752839        Return a float for each integration in the scantable.
    753         Parameters:
     840
     841        Parameters:
     842
    754843            row:    row no of integration. Default -1 return all rows
    755         Example:
    756             none
     844
    757845        """
    758846        return self._get_column(self._getdirectionvec, row)
     
    760848    @print_log_dec
    761849    def set_unit(self, unit='channel'):
    762         """
     850        """\
    763851        Set the unit for all following operations on this scantable
    764         Parameters:
    765             unit:    optional unit, default is 'channel'
    766                      one of '*Hz', 'km/s', 'channel', ''
     852
     853        Parameters:
     854
     855            unit:    optional unit, default is 'channel'. Use one of '*Hz',
     856                     'km/s', 'channel' or equivalent ''
     857
    767858        """
    768859        varlist = vars()
     
    776867    @print_log_dec
    777868    def set_instrument(self, instr):
    778         """
     869        """\
    779870        Set the instrument for subsequent processing.
    780         Parameters:
     871
     872        Parameters:
     873
    781874            instr:    Select from 'ATPKSMB', 'ATPKSHOH', 'ATMOPRA',
    782875                      'DSS-43' (Tid), 'CEDUNA', and 'HOBART'
     876
    783877        """
    784878        self._setInstrument(instr)
     
    788882    @print_log_dec
    789883    def set_feedtype(self, feedtype):
    790         """
     884        """\
    791885        Overwrite the feed type, which might not be set correctly.
    792         Parameters:
     886
     887        Parameters:
     888
    793889            feedtype:     'linear' or 'circular'
     890
    794891        """
    795892        self._setfeedtype(feedtype)
     
    799896    @print_log_dec
    800897    def set_doppler(self, doppler='RADIO'):
    801         """
     898        """\
    802899        Set the doppler for all following operations on this scantable.
    803         Parameters:
     900
     901        Parameters:
     902
    804903            doppler:    One of 'RADIO', 'OPTICAL', 'Z', 'BETA', 'GAMMA'
     904
    805905        """
    806906        varlist = vars()
     
    813913    @print_log_dec
    814914    def set_freqframe(self, frame=None):
    815         """
     915        """\
    816916        Set the frame type of the Spectral Axis.
    817         Parameters:
     917
     918        Parameters:
     919
    818920            frame:   an optional frame type, default 'LSRK'. Valid frames are:
    819921                     'TOPO', 'LSRD', 'LSRK', 'BARY',
    820922                     'GEO', 'GALACTO', 'LGROUP', 'CMB'
    821         Examples:
     923
     924        Example::
     925
    822926            scan.set_freqframe('BARY')
     927
    823928        """
    824929        frame = frame or rcParams['scantable.freqframe']
     
    846951
    847952    def set_dirframe(self, frame=""):
    848         """
     953        """\
    849954        Set the frame type of the Direction on the sky.
    850         Parameters:
     955
     956        Parameters:
     957
    851958            frame:   an optional frame type, default ''. Valid frames are:
    852959                     'J2000', 'B1950', 'GALACTIC'
    853         Examples:
     960
     961        Example:
     962
    854963            scan.set_dirframe('GALACTIC')
     964
    855965        """
    856966        varlist = vars()
     
    868978
    869979    def get_unit(self):
    870         """
     980        """\
    871981        Get the default unit set in this scantable
     982
    872983        Returns:
     984
    873985            A unit string
     986
    874987        """
    875988        inf = self._getcoordinfo()
     
    879992
    880993    def get_abcissa(self, rowno=0):
    881         """
     994        """\
    882995        Get the abcissa in the current coordinate setup for the currently
    883996        selected Beam/IF/Pol
    884         Parameters:
     997
     998        Parameters:
     999
    8851000            rowno:    an optional row number in the scantable. Default is the
    8861001                      first row, i.e. rowno=0
     1002
    8871003        Returns:
     1004
    8881005            The abcissa values and the format string (as a dictionary)
     1006
    8891007        """
    8901008        abc = self._getabcissa(rowno)
     
    8941012
    8951013    def flag(self, mask=None, unflag=False):
    896         """
     1014        """\
    8971015        Flag the selected data using an optional channel mask.
    898         Parameters:
     1016
     1017        Parameters:
     1018
    8991019            mask:   an optional channel mask, created with create_mask. Default
    9001020                    (no mask) is all channels.
    9011021            unflag:    if True, unflag the data
     1022
    9021023        """
    9031024        varlist = vars()
     
    9161037
    9171038    def flag_row(self, rows=[], unflag=False):
    918         """
     1039        """\
    9191040        Flag the selected data in row-based manner.
    920         Parameters:
     1041
     1042        Parameters:
     1043
    9211044            rows:   list of row numbers to be flagged. Default is no row
    9221045                    (must be explicitly specified to execute row-based flagging).
    9231046            unflag: if True, unflag the data.
     1047
    9241048        """
    9251049        varlist = vars()
     
    9361060
    9371061    def clip(self, uthres=None, dthres=None, clipoutside=True, unflag=False):
    938         """
     1062        """\
    9391063        Flag the selected data outside a specified range (in channel-base)
    940         Parameters:
     1064
     1065        Parameters:
     1066
    9411067            uthres:      upper threshold.
    9421068            dthres:      lower threshold
     1069
    9431070            clipoutside: True for flagging data outside the range [dthres:uthres].
    9441071                         False for glagging data inside the range.
    945             unflag     : if True, unflag the data.
     1072            unflag:      if True, unflag the data.
     1073
    9461074        """
    9471075        varlist = vars()
     
    9591087    @print_log_dec
    9601088    def lag_flag(self, start, end, unit="MHz", insitu=None):
    961     #def lag_flag(self, frequency, width=0.0, unit="GHz", insitu=None):
    962         """
     1089        """\
    9631090        Flag the data in 'lag' space by providing a frequency to remove.
    9641091        Flagged data in the scantable gets interpolated over the region.
    9651092        No taper is applied.
    966         Parameters:
     1093
     1094        Parameters:
     1095
    9671096            start:    the start frequency (really a period within the
    9681097                      bandwidth)  or period to remove
     
    9701099            unit:     the frequency unit (default "MHz") or "" for
    9711100                      explicit lag channels
    972         Notes:
     1101
     1102        *Notes*:
     1103
    9731104            It is recommended to flag edges of the band or strong
    9741105            signals beforehand.
     1106
    9751107        """
    9761108        if insitu is None: insitu = rcParams['insitu']
     
    10031135    @print_log_dec
    10041136    def create_mask(self, *args, **kwargs):
    1005         """
     1137        """\
    10061138        Compute and return a mask based on [min, max] windows.
    10071139        The specified windows are to be INCLUDED, when the mask is
    10081140        applied.
    1009         Parameters:
     1141
     1142        Parameters:
     1143
    10101144            [min, max], [min2, max2], ...
    10111145                Pairs of start/end points (inclusive)specifying the regions
     
    10171151                        unit conversions, default is row=0
    10181152                        only necessary if frequency varies over rows.
    1019         Example:
     1153
     1154        Examples::
     1155
    10201156            scan.set_unit('channel')
    1021             a)
     1157            # a)
    10221158            msk = scan.create_mask([400, 500], [800, 900])
    10231159            # masks everything outside 400 and 500
    10241160            # and 800 and 900 in the unit 'channel'
    10251161
    1026             b)
     1162            # b)
    10271163            msk = scan.create_mask([400, 500], [800, 900], invert=True)
    10281164            # masks the regions between 400 and 500
    10291165            # and 800 and 900 in the unit 'channel'
    1030             c)
    1031             mask only channel 400
     1166
     1167            # c)
     1168            #mask only channel 400
    10321169            msk =  scan.create_mask([400])
     1170
    10331171        """
    10341172        row = kwargs.get("row", 0)
     
    10671205
    10681206    def get_masklist(self, mask=None, row=0):
    1069         """
     1207        """\
    10701208        Compute and return a list of mask windows, [min, max].
    1071         Parameters:
     1209
     1210        Parameters:
     1211
    10721212            mask:       channel mask, created with create_mask.
    10731213            row:        calcutate the masklist using the specified row
    10741214                        for unit conversions, default is row=0
    10751215                        only necessary if frequency varies over rows.
     1216
    10761217        Returns:
     1218
    10771219            [min, max], [min2, max2], ...
    10781220                Pairs of start/end points (inclusive)specifying
    10791221                the masked regions
     1222
    10801223        """
    10811224        if not (isinstance(mask,list) or isinstance(mask, tuple)):
     
    11061249
    11071250    def get_mask_indices(self, mask=None):
    1108         """
     1251        """\
    11091252        Compute and Return lists of mask start indices and mask end indices.
    11101253         Parameters:
    11111254            mask:       channel mask, created with create_mask.
     1255
    11121256        Returns:
     1257
    11131258            List of mask start indices and that of mask end indices,
    11141259            i.e., [istart1,istart2,....], [iend1,iend2,....].
     1260
    11151261        """
    11161262        if not (isinstance(mask,list) or isinstance(mask, tuple)):
     
    11471293
    11481294    def get_restfreqs(self, ids=None):
    1149         """
     1295        """\
    11501296        Get the restfrequency(s) stored in this scantable.
    11511297        The return value(s) are always of unit 'Hz'
    1152         Parameters:
     1298
     1299        Parameters:
     1300
    11531301            ids: (optional) a list of MOLECULE_ID for that restfrequency(s) to
    11541302                 be retrieved
     1303
    11551304        Returns:
     1305
    11561306            dictionary containing ids and a list of doubles for each id
     1307
    11571308        """
    11581309        if ids is None:
     
    11731324
    11741325    def set_restfreqs(self, freqs=None, unit='Hz'):
    1175         """
    1176         ********NEED TO BE UPDATED begin************
     1326        """\
    11771327        Set or replace the restfrequency specified and
    11781328        If the 'freqs' argument holds a scalar,
     
    11861336        E.g. 'freqs=[1e9, 2e9]'  would mean IF 0 gets restfreq 1e9 and
    11871337        IF 1 gets restfreq 2e9.
    1188         ********NEED TO BE UPDATED end************
     1338
    11891339        You can also specify the frequencies via a linecatalog.
    11901340
    11911341        Parameters:
     1342
    11921343            freqs:   list of rest frequency values or string idenitfiers
    11931344            unit:    unit for rest frequency (default 'Hz')
    11941345
    1195         Example:
     1346
     1347        Example::
     1348
    11961349            # set the given restfrequency for the all currently selected IFs
    11971350            scan.set_restfreqs(freqs=1.4e9)
     
    12071360            scan.set_restfreqs(freqs=[[1.4e9, 1.41e9], [1.67e9]])
    12081361
    1209 
    1210         Note:
     1362       *Note*:
     1363
    12111364            To do more sophisticate Restfrequency setting, e.g. on a
    12121365            source and IF basis, use scantable.set_selection() before using
    1213             this function.
    1214             # provided your scantable is called scan
    1215             selection = selector()
    1216             selection.set_name("ORION*")
    1217             selection.set_ifs([1])
    1218             scan.set_selection(selection)
    1219             scan.set_restfreqs(freqs=86.6e9)
     1366            this function::
     1367
     1368                # provided your scantable is called scan
     1369                selection = selector()
     1370                selection.set_name("ORION*")
     1371                selection.set_ifs([1])
     1372                scan.set_selection(selection)
     1373                scan.set_restfreqs(freqs=86.6e9)
    12201374
    12211375        """
     
    12831437
    12841438    def shift_refpix(self, delta):
    1285         """
     1439        """\
    12861440        Shift the reference pixel of the Spectra Coordinate by an
    12871441        integer amount.
    1288         Parameters:
     1442
     1443        Parameters:
     1444
    12891445            delta:   the amount to shift by
    1290         Note:
     1446
     1447        *Note*:
     1448
    12911449            Be careful using this with broadband data.
     1450
    12921451        """
    12931452        Scantable.shift_refpix(self, delta)
    12941453
    12951454    def history(self, filename=None):
    1296         """
     1455        """\
    12971456        Print the history. Optionally to a file.
    1298         Parameters:
     1457
     1458        Parameters:
     1459
    12991460            filename:    The name  of the file to save the history to.
     1461
    13001462        """
    13011463        hist = list(self._gethistory())
     
    13461508    @print_log_dec
    13471509    def average_time(self, mask=None, scanav=False, weight='tint', align=False):
    1348         """
     1510        """\
    13491511        Return the (time) weighted average of a scan.
    1350         Note:
     1512
     1513        *Note*:
     1514
    13511515            in channels only - align if necessary
    1352         Parameters:
     1516
     1517        Parameters:
     1518
    13531519            mask:     an optional mask (only used for 'var' and 'tsys'
    13541520                      weighting)
     
    13651531            align:    align the spectra in velocity before averaging. It takes
    13661532                      the time of the first spectrum as reference time.
    1367         Example:
     1533
     1534        Example::
     1535
    13681536            # time average the scantable without using a mask
    13691537            newscan = scan.average_time()
     1538
    13701539        """
    13711540        varlist = vars()
     
    13981567    @print_log_dec
    13991568    def convert_flux(self, jyperk=None, eta=None, d=None, insitu=None):
    1400         """
     1569        """\
    14011570        Return a scan where all spectra are converted to either
    14021571        Jansky or Kelvin depending upon the flux units of the scan table.
     
    14051574        specify EITHER jyperk OR eta (and D which it will try to look up
    14061575        also if you don't set it). jyperk takes precedence if you set both.
    1407         Parameters:
     1576
     1577        Parameters:
     1578
    14081579            jyperk:      the Jy / K conversion factor
    14091580            eta:         the aperture efficiency
     
    14121583                         Otherwise, the scaling is done in-situ
    14131584                         The default is taken from .asaprc (False)
     1585
    14141586        """
    14151587        if insitu is None: insitu = rcParams['insitu']
     
    14271599    @print_log_dec
    14281600    def gain_el(self, poly=None, filename="", method="linear", insitu=None):
    1429         """
     1601        """\
    14301602        Return a scan after applying a gain-elevation correction.
    14311603        The correction can be made via either a polynomial or a
     
    14361608        will occur if the instrument is not known).
    14371609        The data and Tsys are *divided* by the scaling factors.
    1438         Parameters:
     1610
     1611        Parameters:
     1612
    14391613            poly:        Polynomial coefficients (default None) to compute a
    14401614                         gain-elevation correction as a function of
     
    14641638                         Otherwise, the scaling is done in-situ
    14651639                         The default is taken from .asaprc (False)
     1640
    14661641        """
    14671642
     
    14821657    @print_log_dec
    14831658    def freq_align(self, reftime=None, method='cubic', insitu=None):
    1484         """
     1659        """\
    14851660        Return a scan where all rows have been aligned in frequency/velocity.
    14861661        The alignment frequency frame (e.g. LSRK) is that set by function
    14871662        set_freqframe.
     1663
    14881664        Parameters:
    14891665            reftime:     reference time to align at. By default, the time of
     
    14951671                         Otherwise, the scaling is done in-situ
    14961672                         The default is taken from .asaprc (False)
     1673
    14971674        """
    14981675        if insitu is None: insitu = rcParams["insitu"]
     
    15081685    @print_log_dec
    15091686    def opacity(self, tau=None, insitu=None):
    1510         """
     1687        """\
    15111688        Apply an opacity correction. The data
    15121689        and Tsys are multiplied by the correction factor.
     1690
    15131691        Parameters:
    15141692            tau:         (list of) opacity from which the correction factor is
     
    15231701                         Otherwise, the scaling is done in-situ
    15241702                         The default is taken from .asaprc (False)
     1703
    15251704        """
    15261705        if insitu is None: insitu = rcParams['insitu']
     
    15371716    @print_log_dec
    15381717    def bin(self, width=5, insitu=None):
    1539         """
     1718        """\
    15401719        Return a scan where all spectra have been binned up.
    1541         Parameters:
     1720
     1721        Parameters:
     1722
    15421723            width:       The bin width (default=5) in pixels
    15431724            insitu:      if False a new scantable is returned.
    15441725                         Otherwise, the scaling is done in-situ
    15451726                         The default is taken from .asaprc (False)
     1727
    15461728        """
    15471729        if insitu is None: insitu = rcParams['insitu']
     
    15581740    @print_log_dec
    15591741    def resample(self, width=5, method='cubic', insitu=None):
    1560         """
     1742        """\
    15611743        Return a scan where all spectra have been binned up.
    15621744
    15631745        Parameters:
     1746
    15641747            width:       The bin width (default=5) in pixels
    15651748            method:      Interpolation method when correcting from a table.
     
    15691752                         Otherwise, the scaling is done in-situ
    15701753                         The default is taken from .asaprc (False)
     1754
    15711755        """
    15721756        if insitu is None: insitu = rcParams['insitu']
     
    15811765    @print_log_dec
    15821766    def average_pol(self, mask=None, weight='none'):
    1583         """
     1767        """\
    15841768        Average the Polarisations together.
    1585         Parameters:
     1769
     1770        Parameters:
     1771
    15861772            mask:        An optional mask defining the region, where the
    15871773                         averaging will be applied. The output will have all
     
    15891775            weight:      Weighting scheme. 'none' (default), 'var' (1/var(spec)
    15901776                         weighted), or 'tsys' (1/Tsys**2 weighted)
     1777
    15911778        """
    15921779        varlist = vars()
     
    15991786    @print_log_dec
    16001787    def average_beam(self, mask=None, weight='none'):
    1601         """
     1788        """\
    16021789        Average the Beams together.
     1790
    16031791        Parameters:
    16041792            mask:        An optional mask defining the region, where the
     
    16071795            weight:      Weighting scheme. 'none' (default), 'var' (1/var(spec)
    16081796                         weighted), or 'tsys' (1/Tsys**2 weighted)
     1797
    16091798        """
    16101799        varlist = vars()
     
    16161805
    16171806    def parallactify(self, pflag):
    1618         """
     1807        """\
    16191808        Set a flag to indicate whether this data should be treated as having
    16201809        been 'parallactified' (total phase == 0.0)
     1810
    16211811        Parameters:
    16221812            pflag:  Bool indicating whether to turn this on (True) or
    16231813                    off (False)
     1814
    16241815        """
    16251816        varlist = vars()
     
    16291820    @print_log_dec
    16301821    def convert_pol(self, poltype=None):
    1631         """
     1822        """\
    16321823        Convert the data to a different polarisation type.
    16331824        Note that you will need cross-polarisation terms for most conversions.
     1825
    16341826        Parameters:
    16351827            poltype:    The new polarisation type. Valid types are:
    16361828                        "linear", "circular", "stokes" and "linpol"
     1829
    16371830        """
    16381831        varlist = vars()
     
    16541847    @print_log_dec
    16551848    def smooth(self, kernel="hanning", width=5.0, order=2, plot=False, insitu=None):
    1656         """
     1849        """\
    16571850        Smooth the spectrum by the specified kernel (conserving flux).
    1658         Parameters:
     1851
     1852        Parameters:
     1853
    16591854            kernel:     The type of smoothing kernel. Select from
    16601855                        'hanning' (default), 'gaussian', 'boxcar', 'rmedian'
     
    16741869                        Otherwise, the scaling is done in-situ
    16751870                        The default is taken from .asaprc (False)
    1676         Example:
    1677              none
     1871
    16781872        """
    16791873        if insitu is None: insitu = rcParams['insitu']
     
    17291923    def poly_baseline(self, mask=None, order=0, plot=False, uselin=False,
    17301924                      insitu=None):
    1731         """
     1925        """\
    17321926        Return a scan which has been baselined (all rows) by a polynomial.
    1733         Parameters:
     1927
     1928        Parameters:
     1929
    17341930            mask:       an optional mask
    17351931            order:      the order of the polynomial (default is 0)
     
    17411937                        Otherwise, the scaling is done in-situ
    17421938                        The default is taken from .asaprc (False)
    1743         Example:
     1939
     1940        Example::
     1941
    17441942            # return a scan baselined by a third order polynomial,
    17451943            # not using a mask
    17461944            bscan = scan.poly_baseline(order=3)
     1945
    17471946        """
    17481947        if insitu is None: insitu = rcParams['insitu']
     
    18152014                           threshold=3, chan_avg_limit=1, plot=False,
    18162015                           insitu=None):
    1817         """
     2016        """\
    18182017        Return a scan which has been baselined (all rows) by a polynomial.
    18192018        Spectral lines are detected first using linefinder and masked out
     
    18212020
    18222021        Parameters:
     2022
    18232023            mask:       an optional mask retreived from scantable
    1824             edge:       an optional number of channel to drop at
    1825                         the edge of spectrum. If only one value is
     2024
     2025            edge:       an optional number of channel to drop at the edge of
     2026                        spectrum. If only one value is
    18262027                        specified, the same number will be dropped from
    18272028                        both sides of the spectrum. Default is to keep
     
    18292030                        edge selection for different IFs (a number of spectral
    18302031                        channels can be different)
     2032
    18312033            order:      the order of the polynomial (default is 0)
     2034
    18322035            threshold:  the threshold used by line finder. It is better to
    18332036                        keep it large as only strong lines affect the
    18342037                        baseline solution.
     2038
    18352039            chan_avg_limit:
    18362040                        a maximum number of consequtive spectral channels to
     
    18422046                        users of this method should find the default value
    18432047                        sufficient.
     2048
    18442049            plot:       plot the fit and the residual. In this each
    18452050                        indivual fit has to be approved, by typing 'y'
    18462051                        or 'n'
     2052
    18472053            insitu:     if False a new scantable is returned.
    18482054                        Otherwise, the scaling is done in-situ
    18492055                        The default is taken from .asaprc (False)
    18502056
    1851         Example:
    1852             scan2=scan.auto_poly_baseline(order=7)
     2057
     2058        Example::
     2059
     2060            scan2 = scan.auto_poly_baseline(order=7, insitu=False)
     2061
    18532062        """
    18542063        if insitu is None: insitu = rcParams['insitu']
     
    19612170    @print_log_dec
    19622171    def rotate_linpolphase(self, angle):
    1963         """
     2172        """\
    19642173        Rotate the phase of the complex polarization O=Q+iU correlation.
    19652174        This is always done in situ in the raw data.  So if you call this
    19662175        function more than once then each call rotates the phase further.
    1967         Parameters:
     2176
     2177        Parameters:
     2178
    19682179            angle:   The angle (degrees) to rotate (add) by.
    1969         Examples:
     2180
     2181        Example::
     2182
    19702183            scan.rotate_linpolphase(2.3)
     2184
    19712185        """
    19722186        varlist = vars()
     
    19782192    @print_log_dec
    19792193    def rotate_xyphase(self, angle):
    1980         """
     2194        """\
    19812195        Rotate the phase of the XY correlation.  This is always done in situ
    19822196        in the data.  So if you call this function more than once
    19832197        then each call rotates the phase further.
    1984         Parameters:
     2198
     2199        Parameters:
     2200
    19852201            angle:   The angle (degrees) to rotate (add) by.
    1986         Examples:
     2202
     2203        Example::
     2204
    19872205            scan.rotate_xyphase(2.3)
     2206
    19882207        """
    19892208        varlist = vars()
     
    19952214    @print_log_dec
    19962215    def swap_linears(self):
    1997         """
     2216        """\
    19982217        Swap the linear polarisations XX and YY, or better the first two
    19992218        polarisations as this also works for ciculars.
     
    20072226    @print_log_dec
    20082227    def invert_phase(self):
    2009         """
     2228        """\
    20102229        Invert the phase of the complex polarisation
    20112230        """
     
    20132232        self._math._invert_phase(self)
    20142233        self._add_history("invert_phase", varlist)
    2015         print_log()
    20162234        return
    20172235
    20182236    @print_log_dec
    20192237    def add(self, offset, insitu=None):
    2020         """
     2238        """\
    20212239        Return a scan where all spectra have the offset added
    2022         Parameters:
     2240
     2241        Parameters:
     2242
    20232243            offset:      the offset
    20242244            insitu:      if False a new scantable is returned.
    20252245                         Otherwise, the scaling is done in-situ
    20262246                         The default is taken from .asaprc (False)
     2247
    20272248        """
    20282249        if insitu is None: insitu = rcParams['insitu']
     
    20312252        s = scantable(self._math._unaryop(self, offset, "ADD", False))
    20322253        s._add_history("add", varlist)
    2033         print_log()
    20342254        if insitu:
    20352255            self._assign(s)
     
    20392259    @print_log_dec
    20402260    def scale(self, factor, tsys=True, insitu=None):
    2041         """
     2261        """\
     2262
    20422263        Return a scan where all spectra are scaled by the give 'factor'
    2043         Parameters:
     2264
     2265        Parameters:
     2266
    20442267            factor:      the scaling factor (float or 1D float list)
    20452268            insitu:      if False a new scantable is returned.
     
    20482271            tsys:        if True (default) then apply the operation to Tsys
    20492272                         as well as the data
     2273
    20502274        """
    20512275        if insitu is None: insitu = rcParams['insitu']
     
    20712295    def set_sourcetype(self, match, matchtype="pattern",
    20722296                       sourcetype="reference"):
    2073         """
     2297        """\
    20742298        Set the type of the source to be an source or reference scan
    2075         using the provided pattern:
    2076         Parameters:
     2299        using the provided pattern.
     2300
     2301        Parameters:
     2302
    20772303            match:          a Unix style pattern, regular expression or selector
    20782304            matchtype:      'pattern' (default) UNIX style pattern or
    20792305                            'regex' regular expression
    20802306            sourcetype:     the type of the source to use (source/reference)
     2307
    20812308        """
    20822309        varlist = vars()
     
    21072334    @print_log_dec
    21082335    def auto_quotient(self, preserve=True, mode='paired', verify=False):
    2109         """
     2336        """\
    21102337        This function allows to build quotients automatically.
    21112338        It assumes the observation to have the same number of
    21122339        "ons" and "offs"
    2113         Parameters:
     2340
     2341        Parameters:
     2342
    21142343            preserve:       you can preserve (default) the continuum or
    21152344                            remove it.  The equations used are
     
    21512380    @print_log_dec
    21522381    def mx_quotient(self, mask = None, weight='median', preserve=True):
    2153         """
     2382        """\
    21542383        Form a quotient using "off" beams when observing in "MX" mode.
    2155         Parameters:
     2384
     2385        Parameters:
     2386
    21562387            mask:           an optional mask to be used when weight == 'stddev'
    21572388            weight:         How to average the off beams.  Default is 'median'.
     
    21602391                            preserve: Output = Toff * (on/off) - Toff
    21612392                            remove:   Output = Toff * (on/off) - Ton
     2393
    21622394        """
    21632395        mask = mask or ()
     
    21742406    @print_log_dec
    21752407    def freq_switch(self, insitu=None):
    2176         """
     2408        """\
    21772409        Apply frequency switching to the data.
    2178         Parameters:
     2410
     2411        Parameters:
     2412
    21792413            insitu:      if False a new scantable is returned.
    21802414                         Otherwise, the swictching is done in-situ
    21812415                         The default is taken from .asaprc (False)
    2182         Example:
    2183             none
     2416
    21842417        """
    21852418        if insitu is None: insitu = rcParams['insitu']
     
    21942427    @print_log_dec
    21952428    def recalc_azel(self):
    2196         """
    2197         Recalculate the azimuth and elevation for each position.
    2198         Parameters:
    2199             none
    2200         Example:
    2201         """
     2429        """Recalculate the azimuth and elevation for each position."""
    22022430        varlist = vars()
    22032431        self._recalcazel()
     
    22712499
    22722500    def get_fit(self, row=0):
    2273         """
     2501        """\
    22742502        Print or return the stored fits for a row in the scantable
    2275         Parameters:
     2503
     2504        Parameters:
     2505
    22762506            row:    the row which the fit has been applied to.
     2507
    22772508        """
    22782509        if row > self.nrow():
     
    22892520
    22902521    def flag_nans(self):
    2291         """
     2522        """\
    22922523        Utility function to flag NaN values in the scantable.
    22932524        """
Note: See TracChangeset for help on using the changeset viewer.