Beispiel #1
0
 def testSeaCIFunc(self):
     '''Use Sea object to test mean and function passing'''
     time = list(range(200))
     window = dt.timedelta(minutes=3)
     delta = dt.timedelta(minutes=1)
     with warnings.catch_warnings(record=True) as w:
         warnings.filterwarnings('always', 'Window size changed .*',
                                 UserWarning, '^spacepy\\.seapy$')
         compobj1 = seapy.Sea(self.unidata, time, self.epochs, \
                             window=window, delta=delta,verbose=False)
         compobj1.sea(ci=95, ci_quan=np.mean)
         compobj2 = seapy.Sea(self.unidata, time, self.epochs, \
                             window=window, delta=delta,verbose=False)
         compobj2.sea(ci=95, ci_quan='mean')
     ntest.assert_allclose(compobj1.bound_low, compobj2.bound_low)
Beispiel #2
0
 def testRestoreEpochs(self):
     """Check that restoreepochs fails with no bad epochs"""
     with warnings.catch_warnings(record=True) as w:
         warnings.filterwarnings('always', 'Window size changed .*',
                                 UserWarning, '^spacepy\\.seapy$')
         self.obj = seapy.Sea(self.unidata, self.time, \
                    self.epochs, verbose=False)
     re_fun = self.obj.restoreepochs
     self.assertRaises(AttributeError, re_fun)
Beispiel #3
0
    def setUp(self):
        """Setup block executed for each test in this class"""
        super(SEATestsUniform, self).setUp()

        self.testval = 5
        self.unidata = [self.testval]*200
        time = list(range(200))
        self.epochs = [20,40,60,80,100,120,140,160,180]
        with warnings.catch_warnings():
            warnings.filterwarnings('always', 'Window size changed .*',
                                    UserWarning, '^spacepy\\.seapy$')
            self.obj = seapy.Sea(self.unidata, time, self.epochs, verbose=False)
            self.obj.sea()
Beispiel #4
0
    def setUp(self):
        """Setup block executed for each test in this class"""
        super(SEATestsUniWithBad, self).setUp()

        self.testval = 5
        self.unidata = [self.testval]*200
        #insert badvals
        for ind in range(30,180,16):
            self.unidata[ind] = -99
        time = list(range(200))
        self.epochs = [20,40,60,80,100,120,140,160,180]
        self.obj = seapy.Sea(self.unidata, time, self.epochs, verbose=False)
        self.obj.sea(badval=-99)
Beispiel #5
0
 def testRandomBeforeSea(self):
     n_req = 27
     sttime = dt.datetime(2010, 1, 1)
     time = [sttime + dt.timedelta(minutes=x) for x in range(200)]
     epochs = [sttime + dt.timedelta(minutes=x) for x in self.epochs]
     window = dt.timedelta(minutes=3)
     delta = dt.timedelta(minutes=1)
     with warnings.catch_warnings(record=True) as w:
         warnings.filterwarnings('always', 'Window size changed .*',
                                 UserWarning, '^spacepy\\.seapy$')
         compobj = seapy.Sea(self.unidata, time, epochs, \
                             window=window, delta=delta,verbose=False)
         newsea = compobj.random(n_req)
     self.assertEqual(len(newsea), n_req)
Beispiel #6
0
 def testDatetimeEquiv(self):
     """Test of equivalence of serial and datetime handling"""
     sttime = dt.datetime(2010, 1, 1)
     time = [sttime + dt.timedelta(minutes=x) for x in range(200)]
     epochs = [sttime + dt.timedelta(minutes=x) for x in self.epochs]
     window = dt.timedelta(minutes=3)
     delta = dt.timedelta(minutes=1)
     with warnings.catch_warnings(record=True) as w:
         warnings.filterwarnings('always', 'Window size changed .*',
                                 UserWarning, '^spacepy\\.seapy$')
         compobj = seapy.Sea(self.unidata, time, epochs, \
                             window=window, delta=delta,verbose=False)
         compobj.sea()
     ntest.assert_array_equal(self.obj.semedian, compobj.semedian)
     ntest.assert_array_equal(self.obj.semean, compobj.semean)