Changeset 1530 for branches/alma


Ignore:
Timestamp:
03/13/09 16:27:14 (16 years ago)
Author:
Kana Sugimoto
Message:

New Development: No

JIRA Issue: Yes (CAS-1079)

Ready to Release: Yes

Interface Changes: Yes for scantable.stats()

What Interface Changed:
Return value is now a list of abcissa values
when stat='min_abc' and 'max_abc'.

Test Programs:

run scantable.stats() with the parameter stat='min_abc' or 'max_abc'.

Put in Release Notes: No

Module(s): sdstat

Description:

scantable.stats() are modified so that the tool returns abscissa
chan/freq/velocity of min or max when stat='min_abc' or 'max_abc',
respectively.
Minor changes in IPosition mathutil::minMaxPos() to accept both
min (max) and min_abc (max_abc) as a parameter.


Location:
branches/alma
Files:
2 edited

Legend:

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

    r1522 r1530  
    345345        Takes a 'mask' as an optional parameter to specify which
    346346        channels should be excluded.
    347         You can get min/max values with their
    348         channels/frequencies/velocities by selecting stat='min_abc'
    349         or 'max_abc'.
    350347        Parameters:
    351348            stat:    'min', 'max', 'min_abc', 'max_abc', 'sumsq', 'sum',
     
    365362                             "number of channels. Please use setselection() "
    366363                             "to select individual IFs")
    367 
    368         if stat.lower().find('_abc') == -1:
    369             statvals = self._math._stats(self, mask, stat)
    370             getchan = False
    371             sstat = str(stat)
    372         else:
     364        rtnabc = False
     365        if stat.lower().endswith('_abc'): rtnabc = True
     366        getchan = False
     367        if stat.lower().startswith('min') or stat.lower().startswith('max'):
    373368            chan = self._math._minmaxchan(self, mask, stat)
    374369            getchan = True
    375370            statvals = []
    376             sstat = stat.lower().strip('_abc')
     371        if not rtnabc: statvals = self._math._stats(self, mask, stat)
     372
    377373        out = ''
    378374        axes = []
     
    387383            tm = self._gettime(i)
    388384            src = self._getsourcename(i)
    389             xpos = ''
     385            refstr = ''
     386            statunit= ''
    390387            if getchan:
    391388                qx, qy = self.chan2data(rowno=i, chan=chan[i])
    392                 statvals.append(qy['value'])
    393                 xpos = '(x = %3.3f' % (qx['value'])+' ['+qx['unit']+'])'
     389                if rtnabc:
     390                    statvals.append(qx['value'])
     391                    refstr = '(value: %3.3f' % (qy['value'])+' ['+qy['unit']+'])'
     392                    statunit= '['+qx['unit']+']'
     393                else:
     394                    refstr = '(@ %3.3f' % (qx['value'])+' ['+qx['unit']+'])'
     395                    #statunit= ' ['+qy['unit']+']'
    394396            out += 'Scan[%d] (%s) ' % (axis[0], src)
    395397            out += 'Time[%s]:\n' % (tm)
     
    397399            if self.nif(-1) > 1: out +=  ' IF[%d] ' % (axis[2])
    398400            if self.npol(-1) > 1: out +=  ' Pol[%d] ' % (axis[3])
    399             out += '= %3.3f   ' % (statvals[i]) +xpos+'\n'
     401            out += '= %3.3f   ' % (statvals[i]) +refstr+'\n'
    400402            out +=  "--------------------------------------------------\n"
    401403
    402404        if rcParams['verbose']:
    403405            print "--------------------------------------------------"
    404             print " ", sstat
     406            print " ", stat, statunit
    405407            print "--------------------------------------------------"
    406408            print out
     
    422424        """
    423425        if isinstance(rowno, int) and isinstance(chan, int):
    424             x, xlbl = self.get_abcissa(rowno)
    425             qx = {'unit': xlbl, 'value': x[chan]}
     426            qx = {'unit': self.get_unit(),
     427                  'value': self._getabcissa(rowno)[chan]}
    426428            qy = {'unit': self.get_fluxunit(),
    427429                  'value': self._getspectrum(rowno)[chan]}
  • branches/alma/src/MathUtils.cpp

    r1516 r1530  
    8484   String str(which);
    8585   str.upcase();
    86    if (str.matches(String("MIN_ABC"))) {
     86   if (str.contains(String("MIN"))) {
    8787     return minPos;
    88    } else if (str.matches(String("MAX_ABC"))) {
     88   } else if (str.contains(String("MAX"))) {
    8989     return maxPos;
    9090   } else {
Note: See TracChangeset for help on using the changeset viewer.