Changeset 1697


Ignore:
Timestamp:
02/11/10 11:46:14 (14 years ago)
Author:
Malte Marquarding
Message:

Some minor tidy up and documentation

Location:
trunk/python
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/__init__.py

    r1691 r1697  
    450450            get_elevation   - get the elevation of the scans
    451451            get_parangle    - get the parallactic angle of the scans
     452            get_coordinate  - get the spectral coordinate for the given row,
     453                              which can be used for coordinate conversions
    452454            get_unit        - get the current unit
    453455            set_unit        - set the abcissa unit to be used from this
     
    581583            plot            - plot a scantable
    582584            plot_lines      - plot a linecatalog overlay
     585            plotazel        - plot azimuth and elevation versus time
     586            plotpointing    - plot telescope pointings
    583587            save            - save the plot to a file ('png' ,'ps' or 'eps')
    584588            set_mode        - set the state of the plotter, i.e.
     
    632636        mask_not            - boolean operations on masks created with
    633637                              scantable.create_mask
     638        skydip              - gain opacity values from a sky dip observation
    634639
    635640    Note:
  • trunk/python/coordinate.py

    r1600 r1697  
    22
    33class coordinate(_coordinate):
    4     """Representation of the spectrall coordinate of the data (frequency axis).
     4    """Representation of the spectral coordinate of the data (frequency axis).
    55    """
    66    def to_frequency(self, pixel, unit='Hz'):
  • trunk/python/lagflagger.py

    r1585 r1697  
    11from asap import scantable
    2 from pylab import *
     2from matplotlib.pylab import *
    33from numpy import array, ma, logical_not
    44from numpy.fft import fft, ifft
     
    2525            self.fftaxes.cla()
    2626            self.resultaxes.cla()
    27            
     27
    2828
    2929    def flag(self):
     
    5757            inp = raw_input("Commit flags (c), keep (k) or ignore(i)? ")\
    5858                            .lower()
    59             if inp.startswith("c")
     59            if inp.startswith("c"):
    6060                self.flags.append([flagstart, flagend])
    6161                self._scan.set_spectrum(yi.real, i)
  • trunk/python/scantable.py

    r1691 r1697  
     1import os
    12try:
    23    from functools import wraps as wraps_dec
     
    2223        return val
    2324    return wrap
     25
     26
     27def is_scantable(filename):
     28    return (os.path.isdir(filename)
     29            and not os.path.exists(filename+'/table.f1')
     30            and os.path.exists(filename+'/table.info'))
    2431
    2532
     
    5966            Scantable.__init__(self, filename)
    6067        else:
    61             if isinstance(filename, str):# or \
    62 #                (isinstance(filename, list) or isinstance(filename, tuple)) \
    63 #                  and isinstance(filename[-1], str):
    64                 import os.path
     68            if isinstance(filename, str):
    6569                filename = os.path.expandvars(filename)
    6670                filename = os.path.expanduser(filename)
     
    6973                    if rcParams['verbose']:
    7074                        asaplog.push(s)
    71                         #print asaplog.pop().strip()
    7275                        return
    7376                    raise IOError(s)
    74                 if os.path.isdir(filename) \
    75                     and not os.path.exists(filename+'/table.f1'):
    76                     # crude check if asap table
    77                     if os.path.exists(filename+'/table.info'):
    78                         ondisk = rcParams['scantable.storage'] == 'disk'
    79                         Scantable.__init__(self, filename, ondisk)
    80                         if unit is not None:
    81                             self.set_fluxunit(unit)
    82                         self.set_freqframe(rcParams['scantable.freqframe'])
    83                     else:
    84                         msg = "The given file '%s'is not a valid " \
    85                               "asap table." % (filename)
    86                         if rcParams['verbose']:
    87                             print msg
    88                             return
    89                         else:
    90                             raise IOError(msg)
     77                if is_scantable(filename):
     78                    ondisk = rcParams['scantable.storage'] == 'disk'
     79                    Scantable.__init__(self, filename, ondisk)
     80                    if unit is not None:
     81                        self.set_fluxunit(unit)
     82                    self.set_freqframe(rcParams['scantable.freqframe'])
    9183                else:
    9284                    self._fill([filename], unit, average)
     
    260252            filename:    the name of a file to write the putput to
    261253                         Default - no file output
    262             verbose:     print extra info such as the frequency table
    263                          The default (False) is taken from .asaprc
    264254        """
    265255        info = Scantable._summary(self, True)
     
    347337        are only applied to thi selection.
    348338        Parameters:
    349             selection:    a selector object (default unset the selection)
     339            selection:    a selector object (default unset the selection),
     340
     341            or
     342
     343            any combination of
     344            "pols", "ifs", "beams", "scans", "cycles", "name", "query"
     345
    350346        Examples:
    351347            sel = selector()         # create a selection object
    352348            self.set_scans([0, 3])    # select SCANNO 0 and 3
    353349            scan.set_selection(sel)  # set the selection
     350            scan.summary()           # will only print summary of scanno 0 an 3
     351            scan.set_selection()     # unset the selection
     352            # or the equivalent
     353            scan.set_selection(scans=[0,3])
    354354            scan.summary()           # will only print summary of scanno 0 an 3
    355355            scan.set_selection()     # unset the selection
Note: See TracChangeset for help on using the changeset viewer.