Changeset 1348


Ignore:
Timestamp:
04/26/07 14:32:17 (17 years ago)
Author:
mar637
Message:

documentation clean up.
added mode 'paired' as the default to auto-quotient.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/scantable.py

    r1338 r1348  
    125125        """
    126126        Return a copy of this scantable.
     127        Note:
     128            This makes a full (deep) copy. scan2 = scan1 makes a reference.
    127129        Parameters:
    128130            none
     
    179181        Return a specific scan (by scanno) or collection of scans (by
    180182        source name) in a new scantable.
     183        Note:
     184            See scantable.drop_scan() for the inverse operation.
    181185        Parameters:
    182186            scanid:    a (list of) scanno or a source name, unix-style
     
    377381        """
    378382        Return the System temperatures.
    379         Parameters:
    380 
    381383        Returns:
    382384            a list of Tsys values for the current selection
     
    427429
    428430
    429     def get_time(self, row=-1):
     431    def get_time(self, row=-1, asdatetime=False):
    430432        """
    431433        Get a list of time stamps for the observations.
    432         Return a string for each integration in the scantable.
    433         Parameters:
    434             row:    row no of integration. Default -1 return all rows
     434        Return a datetime object for each integration time stamp in the scantable.
     435        Parameters:
     436            row:          row no of integration. Default -1 return all rows
     437            asdatetime:   return values as datetime objects rather than strings
    435438        Example:
    436439            none
     
    438441        from time import strptime
    439442        from datetime import datetime
    440         times = self._get_column(self._gettime, row)
     443        if not asdatetime:
     444            return self._get_column(self._gettime, row)
    441445        format = "%Y/%m/%d/%H:%M:%S"
    442446        if isinstance(times, list):
     
    445449            return datetime(*strptime(times, format)[:6])
    446450
     451
     452    def get_inttime(self, row=-1):
     453        """
     454        Get a list of integration times for the observations.
     455        Return a time in seconds for each integration in the scantable.
     456        Parameters:
     457            row:    row no of integration. Default -1 return all rows.
     458        Example:
     459            none
     460        """
     461        return self._get_column(self._getinttime, row)       
     462       
     463
    447464    def get_sourcename(self, row=-1):
    448465        """
     
    450467        Return a string for each integration in the scantable.
    451468        Parameters:
    452             row:    row no of integration. Default -1 return all rows
     469            row:    row no of integration. Default -1 return all rows.
    453470        Example:
    454471            none
     
    461478        Return a float for each integration in the scantable.
    462479        Parameters:
    463             row:    row no of integration. Default -1 return all rows
     480            row:    row no of integration. Default -1 return all rows.
    464481        Example:
    465482            none
     
    472489        Return a float for each integration in the scantable.
    473490        Parameters:
    474             row:    row no of integration. Default -1 return all rows
     491            row:    row no of integration. Default -1 return all rows.
    475492        Example:
    476493            none
     
    483500        Return a float for each integration in the scantable.
    484501        Parameters:
    485             row:    row no of integration. Default -1 return all rows
     502            row:    row no of integration. Default -1 return all rows.
    486503        Example:
    487504            none
     
    517534    def set_instrument(self, instr):
    518535        """
    519         Set the instrument for subsequent processing
     536        Set the instrument for subsequent processing.
    520537        Parameters:
    521538            instr:    Select from 'ATPKSMB', 'ATPKSHOH', 'ATMOPRA',
     
    599616        """
    600617        Get the default unit set in this scantable
    601         Parameters:
    602618        Returns:
    603619            A unit string
     
    616632                      first row, i.e. rowno=0
    617633        Returns:
    618             The abcissa values and it's format string (as a dictionary)
     634            The abcissa values and the format string (as a dictionary)
    619635        """
    620636        abc = self._getabcissa(rowno)
     
    648664        No taper is applied.
    649665        Parameters:
    650             frequency:    the frequency (really a period within the bandwidth) to remove
    651             width:        the width of the frequency to remove, to remove a range
    652                           of frequencies aroung the centre.
     666            frequency:    the frequency (really a period within the bandwidth)
     667                          to remove
     668            width:        the width of the frequency to remove, to remove a
     669                          range of frequencies aroung the centre.
    653670            unit:         the frequency unit (default "GHz")
    654671        Notes:
    655             It is recommended to flag edges of the band or strong signals beforehand.
     672            It is recommended to flag edges of the band or strong
     673            signals beforehand.
    656674        """
    657675        if insitu is None: insitu = rcParams['insitu']
     
    771789            # set the given restfrequency for the whole table
    772790            scan.set_restfreqs(freqs=1.4e9)
    773             # If thee number of IFs in the data is >= 2 the IF0 gets the first
     791            # If thee number of IFs in the data is >= 2 IF0 gets the first
    774792            # value IF1 the second...
    775793            scan.set_restfreqs(freqs=[1.4e9, 1.67e9])
     
    839857        """
    840858        Print the history. Optionally to a file.
     859        Parameters:
     860            filename:    The name  of the file to save the history to.
    841861        """
    842862        hist = list(self._gethistory())
     
    10631083        """
    10641084        Return a scan where all spectra have been binned up.
     1085        Parameters:
    10651086            width:       The bin width (default=5) in pixels
    10661087            insitu:      if False a new scantable is returned.
     
    10801101    def resample(self, width=5, method='cubic', insitu=None):
    10811102        """
    1082         Return a scan where all spectra have been binned up
     1103        Return a scan where all spectra have been binned up.
     1104       
     1105        Parameters:
    10831106            width:       The bin width (default=5) in pixels
    10841107            method:      Interpolation method when correcting from a table.
     
    11591182        Smooth the spectrum by the specified kernel (conserving flux).
    11601183        Parameters:
    1161             scan:       The input scan
    11621184            kernel:     The type of smoothing kernel. Select from
    11631185                        'hanning' (default), 'gaussian' and 'boxcar'.
     
    11871209        Return a scan which has been baselined (all rows) by a polynomial.
    11881210        Parameters:
    1189             scan:       a scantable
    11901211            mask:       an optional mask
    11911212            order:      the order of the polynomial (default is 0)
     
    13781399    def swap_linears(self):
    13791400        """
    1380         Swap the linear polarisations XX and YY
     1401        Swap the linear polarisations XX and YY, or better the first two
     1402        polarisations as this also works for ciculars.
    13811403        """
    13821404        varlist = vars()
     
    14381460            return s
    14391461
    1440     def auto_quotient(self, mode='paired', preserve=True):
     1462    def auto_quotient(self, preserve=True, mode='paired'):
    14411463        """
    14421464        This function allows to build quotients automatically.
    14431465        It assumes the observation to have the same numer of
    14441466        "ons" and "offs"
    1445         It will support "closest off in time" in the future
    1446         Parameters:
    1447             mode:           the on/off detection mode
    1448                             'paired' (default)
    1449                                identifies 'off' scans by the
    1450                                trailing '_R' (Mopra/Parkes) or
    1451                                '_e'/'_w' (Tid) and matches
    1452                                on/off pairs from the observing pattern
    1453                             'time'
    1454                                finds the closest off in time
     1467        Parameters:
    14551468            preserve:       you can preserve (default) the continuum or
    14561469                            remove it.  The equations used are
    14571470                            preserve: Output = Toff * (on/off) - Toff
    14581471                            remove:   Output = Toff * (on/off) - Ton
    1459         """
    1460         modes = ["time", "suffix"]
     1472            mode:           the on/off detection mode
     1473                            'paired' (default)
     1474                            identifies 'off' scans by the
     1475                            trailing '_R' (Mopra/Parkes) or
     1476                            '_e'/'_w' (Tid) and matches
     1477                            on/off pairs from the observing pattern
     1478                'time'
     1479                   finds the closest off in time
     1480
     1481        """
     1482        modes = ["time", "paired"]
    14611483        if not mode in modes:
    14621484            msg = "please provide valid mode. Valid modes are %s" % (modes)
    14631485            raise ValueError(msg)
    14641486        varlist = vars()
    1465         s = None
    1466         if mode.lower() == "suffix":
    1467             basesel = self.get_selection()
    1468             sel = selector()
    1469             self.set_selection(basesel+sel)
    1470             offs = self.copy()
    1471             sel.set_query("SRCTYPE==0")
    1472             self.set_selection(basesel+sel)
    1473             ons = self.copy()
    1474             s = scantable(self._math._quotient(ons, offs, preserve))
    1475             self.set_selection(basesel)
    1476         elif mode.lower() == "time":
    1477             s = scantable(self._math._auto_quotient(self, mode, preserve))
     1487        s = None
     1488        if mode.lower() == "paired":
     1489            basesel = self.get_selection()
     1490            sel = selector()
     1491            self.set_selection(basesel+sel)
     1492            offs = self.copy()
     1493            sel.set_query("SRCTYPE==0")
     1494            self.set_selection(basesel+sel)
     1495            ons = self.copy()
     1496            s = scantable(self._math._quotient(ons, offs, preserve))
     1497            self.set_selection(basesel)
     1498        elif mode.lower() == "time":
     1499            s = scantable(self._math._auto_quotient(self, mode, preserve))
    14781500        s._add_history("auto_quotient", varlist)
    14791501        print_log()
Note: See TracChangeset for help on using the changeset viewer.