Exemplo n.º 1
0
 def __init__(self, *args, **kwds):
     NumpyTestCase.__init__(self, *args, **kwds)
     dfile = open(os.path.join('tests','madeup_data'), 'r')
     dfile.readline()
     x = fromiter((float(v) for v in dfile.readline().rstrip().split()),
                  float_).reshape(-1,2)
     x = marray(x) 
     dfile.readline()
     y = fromiter((float(v) for v in dfile.readline().rstrip().split()),
                  float_)
     y = marray(y)
     #
     rfile = open(os.path.join('tests','madeup_result'), 'r')
     results = []
     for i in range(8):
         rfile.readline()
         z = fromiter((float(v) for v in rfile.readline().rstrip().split()),
                      float_)
         results.append(z)
     #
     newdata1 = numpy.array([[-2.5, 0.0, 2.5], [0., 0., 0.]])
     newdata2 = numpy.array([[-0.5, 0.5], [0., 0.]])
     #
     madeup = loess(x,y)
     self.d = (x, y, results, newdata1, newdata2, madeup)
Exemplo n.º 2
0
 def __init__(self, *args, **kwds):
     NumpyTestCase.__init__(self, *args, **kwds)
     self.data = numeric.arange(25)
     self.maskeddata = MaskedArray(self.data)
     self.maskeddata[10] = masked
     self.func_pairs = [
         (MF.mov_average, MA.mean),
         (MF.mov_median, mstats.mmedian),
         ((lambda x, span : MF.mov_stddev(x, span, bias=True)), MA.std)]
Exemplo n.º 3
0
    def __init__(self, *args, **kwds):
        NumpyTestCase.__init__(self, *args, **kwds)
        NOx = marray([4.818, 2.849, 3.275, 4.691, 4.255, 5.064, 2.118, 4.602,
                      2.286, 0.970, 3.965, 5.344, 3.834, 1.990, 5.199, 5.283,
                      3.752, 0.537, 1.640, 5.055, 4.937, 1.561])
        E = marray([0.831, 1.045, 1.021, 0.970, 0.825, 0.891, 0.71, 0.801,
                    1.074, 1.148, 1.000, 0.928, 0.767, 0.701, 0.807, 0.902,
                    0.997, 1.224, 1.089, 0.973, 0.980, 0.665])
        gas_fit_E = numpy.array([0.665, 0.949, 1.224])
        newdata = numpy.array([0.6650000, 0.7581667, 0.8513333, 0.9445000,
                               1.0376667, 1.1308333, 1.2240000])
        coverage = 0.99

        rfile = open(os.path.join('tests','gas_result'), 'r')
        results = []
        for i in range(8):
            rfile.readline()
            z = fromiter((float(v) for v in rfile.readline().rstrip().split()),
                         float_)
            results.append(z)        
        self.d = (E, NOx, gas_fit_E, newdata, coverage, results)
Exemplo n.º 4
0
 def __init__(self, *args, **kwds):
     NumpyTestCase.__init__(self, *args, **kwds)
     # Get CO2 data ................    
     filename = os.path.join('tests','co2_data')
     F = open(filename, 'r')
     data = []
     for line in F.readlines():
         data.append([float(x) for x in line.rstrip().split()])
     co2_data = numpy.concatenate(data)
     # Get CO2 results .............
     filename = os.path.join('tests','co2_results_double')
     F = open(filename, 'r')
     co2_results = []
     for line in F.readlines():
         co2_results.append(fromiter((float(x) for x in line.rstrip().split()),
                                     float_))        
     #
     parameters = dict(np=12, ns=35, nt=19, nl=13, no=2, ni=1,
                       nsjump=4, ntjump=2, nljump=2,
                       isdeg=1, itdeg=1, ildeg=1)
     self.d = (co2_data, co2_results, parameters)
Exemplo n.º 5
0
 def __init__(self, *args, **kwds):
     NumpyTestCase.__init__(self, *args, **kwds)
     self.setUp()
Exemplo n.º 6
0
 def __init__(self, *args, **kwds):
     NumpyTestCase.__init__(self, *args, **kwds)
Exemplo n.º 7
0
 def __init__(self, *args, **kwds):
     NumpyTestCase.__init__(self, *args, **kwds)
     self.data = numeric.arange(25)
     self.maskeddata = MaskedArray(self.data)
     self.maskeddata[10] = masked
Exemplo n.º 8
0
 def __init__(self, *args, **kwds):
     NumpyTestCase.__init__(self, *args, **kwds)
     dlist = ['2007-01-%02i' % i for i in range(1,16)]
     dates = date_array_fromlist(dlist)
     data = masked_array(numeric.arange(15), mask=[1,0,0,0,0]*3)
     self.d = (dlist, dates, data)
Exemplo n.º 9
0
 def __init__(self, *args, **kwds):
     NumpyTestCase.__init__(self, *args, **kwds)
     dlist = ['2007-01-%02i' % i for i in range(1,16)]
     dates = date_array_fromlist(dlist)
     data = masked_array(numeric.arange(15), mask=[1,0,0,0,0]*3, dtype=float_)
     self.d = (time_series(data, dlist), data, dates)
Exemplo n.º 10
0
 def __init__(self, *args, **kwds):
     NumpyTestCase.__init__(self, *args, **kwds)
     X = marray([ 1, 2, 3, 4, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 8,10,12,14,50])
     Y = marray([18, 2,15, 6,10, 4,16,11, 7, 3,14,17,20,12, 9,13, 1, 8, 5,19])
     idx = X.argsort()
     self.data = (X[idx], Y[idx])
Exemplo n.º 11
0
 def __init__(self, *args, **kwds):
     NumpyTestCase.__init__(self, *args, **kwds)
     self.dateWrap = [(dArrayWrap, assert_array_equal),
                      (noWrap, assert_equal)]
Exemplo n.º 12
0
 def __init__(self, *args, **kwds):
     NumpyTestCase.__init__(self, *args, **kwds)
     self.mask = [1,0,1,0,0,1,1,0,0,0]
     self.data = numeric.arange(10)
     self.test_array = masked_array(self.data, mask=self.mask)