コード例 #1
0
 def test_milliseconds(self):
     base = DTS(2005, 3, 15, 10, 45, 10)
     start = base + 0.0028
     end = base + 0.0075
     ticks = trange(start, end, milliseconds=1)
     desired = [base + i for i in (0.003, 0.004, 0.005, 0.006, 0.007)]
     self.check_ticks(ticks, desired)
     ticks = trange(start, end, milliseconds=2)
     self.check_ticks(ticks, (base+0.004, base+0.006))
コード例 #2
0
 def test_daily(self):
     base = DTS(2005, 1, 1)
     secs_per_day = 24*3600
     ticks = trange(base, base + secs_per_day*5, days=1)
     desired = [base+i*secs_per_day for i in range(6)]
     print "ticks:   ", ticks
     print "desired: ", desired
     self.check_ticks(ticks, desired)
コード例 #3
0
 def test_hourly(self):
     # test between Feb 29,2004 10:15pm and Mar 1st 3:15am
     ticks = trange(DTS(2004, 2, 29, 22, 15),
                    DTS(2004, 3, 1, 3, 15),
                    hours=1)
     start = DTS(2004, 2, 29, 23)
     desired = [start + i * 3600 for i in range(5)]
     self.check_ticks(ticks, desired)
コード例 #4
0
 def test_null_ranges(self):
     ranges = (
         ((2005,3,15,10,23,15), (2005,3,15,10,23,45), {"minutes":1}),
         ((2005,3,15,10,23), (2005,3,15,10,47), {"hours":1}),
         ((2005,3,15,5,23), (2005,3,15,18,43), {"days":1}),
         ((2005,3,15,10,30), (2005,12,25,18,30), {"years":1})
         )
     for start, end, kw in ranges:
         self.assert_empty(trange(DTS(*start), DTS(*end), **kw))
     return
コード例 #5
0
 def test_microseconds(self):
     # Testing the microsecond scale is dicey--`base` is a 10 digit integer,
     # so an increment of, say, 3 microseconds is only about a factor of 10
     # more than machine precision.
     base = DTS(2005, 3, 15, 10, 45, 10)
     print "base: ", base
     start = base + 0.0000027
     end   = base + 0.0000177
     ticks = trange(start, end, microseconds=5)
     desired = [base+i for i in (5e-6, 10e-6, 15e-6)]
     print "ticks:   ", ticks
     print "desired: ", desired
     self.check_ticks(ticks, desired)
コード例 #6
0
 def test_multiday_increment(self):
     start = DTS(2005, 1, 1)
     ticks = trange(start, start + 9*24*3600, days=3)
     desired = [start+i*3*24*3600 for i in range(4)]
     print "ticks: ", ticks, " desired: ", desired
     self.check_ticks(ticks, desired)
コード例 #7
0
ファイル: time_scale_test_case.py プロジェクト: SDiot/chaco
 def test_hourly(self):
     # test between Feb 29,2004 10:15pm and Mar 1st 3:15am
     ticks = trange(DTS(2004,2,29,22,15), DTS(2004,3,1,3,15), hours=1)
     start = DTS(2004,2,29,23)
     desired = [start + i*3600 for i in range(5)]
     self.check_ticks(ticks, desired)
コード例 #8
0
 def test_daily_leap(self):
     start = DTS(2004, 2, 27)
     end = DTS(2004, 3, 2)
     ticks = trange(start, end, days=1)
     desired = [start + i*24*3600 for i in range(5)]
     self.check_ticks(ticks, desired)