Changeset 1842


Ignore:
Timestamp:
08/03/10 18:56:51 (14 years ago)
Author:
Malte Marquarding
Message:

use generator to also test all masked stats

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/test_scantable.py

    r1840 r1842  
    7878        assert_equal(self.st.getpolnos(), (0,))
    7979
     80
     81    def stats(self, key, value, mask=False):
     82        msk = None
     83        if mask:
     84            msk = self.st.create_mask([0,100], [3900,4096])
     85        sval = self.st.stats(stat=key, mask=msk)
     86        assert_almost_equal(sval[0], value)
     87
     88    def test_masked_stats(self):
     89        stats = { 'min': 113.767166138,
     90                  'max':128.21571350, 'sumsq':4180516.75,
     91                  'sum':35216.87890625, 'mean':118.5753479,
     92                  'var':15.75608253, 'stddev':3.9693932533,
     93                  'avdev':3.395271778, 'rms':118.6415405,
     94                  'median':117.5024261}
     95        for k,v in stats.items():
     96            yield self.stats, k, v, True
     97
    8098    def test_stats(self):
    8199        stats = { 'min': 113.767166138,
     
    85103                  'avdev':16.3966751099, 'rms':177.300170898,
    86104                  'median':182.891845703}
    87         for k,v in stats.iteritems():
    88             sval = self.st.stats(stat=k)
    89             assert_almost_equal(sval[0], v)
    90         msk = self.st.create_mask([0,100], [3900,4096])
    91         assert_almost_equal(self.st.stats("sum", msk)[0], 35216.87890625)
     105        for k,v in stats.items():
     106            yield self.stats, k, v
    92107
    93108    def test_get_column_names(self):
Note: See TracChangeset for help on using the changeset viewer.