Changeset 1517 for branches


Ignore:
Timestamp:
02/24/09 14:22:57 (16 years ago)
Author:
Kana Sugimoto
Message:

New Development: No

JIRA Issue: Yes (CAS-1079)

Ready to Release: Yes

Interface Changes: Yes

What Interface Changed:
Name of function scantable.pos2data() changed to scantable.chan2data().
And names of selection for the parameter stat are changed in scantable.stats().
NEW: OLD:
min_abc minpos
max_abc maxpos

Test Programs:

You can get min/max values with their position (channels/frequencies/velocities)

by selecting stat='min_abc' or 'max_abc'.

Put in Release Notes: No

Module(s): scantable.stats()

Description:

Change in names for a function and parameters.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/alma/python/scantable.py

    r1515 r1517  
    341341        Takes a 'mask' as an optional parameter to specify which
    342342        channels should be excluded.
    343         You can get min/max values with their position
    344         (channels/frequencies/velocities) by selecting stat='minpos'
    345         or 'maxpos'.
    346         Parameters:
    347             stat:    'min', 'max', 'minpos', 'maxpos', 'sumsq', 'sum',
     343        You can get min/max values with their
     344        channels/frequencies/velocities by selecting stat='min_abc'
     345        or 'max_abc'.
     346        Parameters:
     347            stat:    'min', 'max', 'min_abc', 'max_abc', 'sumsq', 'sum',
    348348                     'mean', 'var', 'stddev', 'avdev', 'rms', 'median'
    349349            mask:    an optional mask specifying where the statistic
     
    362362                             "to select individual IFs")
    363363
    364         if stat.lower().find('pos') == -1:
     364        if stat.lower().find('_abc') == -1:
    365365            statvals = self._math._stats(self, mask, stat)
    366             position = False
     366            getchan = False
    367367            sstat = str(stat)
    368368        else:
    369             pos = self._math._minmaxpos(self, mask, stat)
    370             position = True
     369            chan = self._math._minmaxchan(self, mask, stat)
     370            getchan = True
    371371            statvals = []
    372             sstat = stat.lower().strip('pos')
     372            sstat = stat.lower().strip('_abc')
    373373        out = ''
    374374        axes = []
     
    384384            src = self._getsourcename(i)
    385385            xpos = ''
    386             if position:
    387                 qx, y = self.pos2data(rowno=i, pos=pos[i])
    388                 statvals.append(y)
     386            if getchan:
     387                qx, qy = self.chan2data(rowno=i, chan=chan[i])
     388                statvals.append(qy['value'])
    389389                xpos = '(x = %3.3f' % (qx['value'])+' ['+qx['unit']+'])'
    390390            out += 'Scan[%d] (%s) ' % (axis[0], src)
     
    407407        return statvals
    408408
    409     def pos2data(self, rowno=0, pos=0):
    410         """
    411         Returns the abcissa and ordinate value of a spectrum
     409    def chan2data(self, rowno=0, chan=0):
     410        """
     411        Returns channel/frequency/velocity and spectral value
    412412        at an arbitrary row and channel in the scantable.
    413413        Parameters:
    414414            rowno:   a row number in the scantable. Default is the
    415415                     first row, i.e. rowno=0
    416             pos:     a channel in the scantable. Default is the first
     416            chan:    a channel in the scantable. Default is the first
    417417                     channel, i.e. pos=0
    418418        """
    419         if isinstance(rowno, int) and isinstance(pos, int):
     419        if isinstance(rowno, int) and isinstance(chan, int):
    420420            x, xlbl = self.get_abcissa(rowno)
    421             qx = {'unit': xlbl, 'value': x[pos]}
    422             return qx, self._getspectrum(rowno)[pos]
     421            qx = {'unit': xlbl, 'value': x[chan]}
     422            qy = {'unit': self.get_fluxunit(),
     423                  'value': self._getspectrum(rowno)[chan]}
     424            return qx, qy
    423425
    424426    def stddev(self, mask=None):
Note: See TracChangeset for help on using the changeset viewer.