Exemple #1
0
 def add(self, data):
     from dynts import tsname
     if isinstance(data,xyserie):
         self._series.append(data)
     elif isinstance(data,self.__class__):
         for serie in data.series():
             self.name = tsname(self.name,serie.name)
             self._series.append(serie)
Exemple #2
0
 def add(self, data):
     from dynts import tsname
     if isinstance(data, xyserie):
         self._series.append(data)
     elif isinstance(data, self.__class__):
         for serie in data.series():
             self.name = tsname(self.name, serie.name)
             self._series.append(serie)
Exemple #3
0
 def load_data(self, result):
     loads = self.pickler.loads
     vloads = self.value_pickler.loads
     dt, va = result
     if result[0] and va:
         dates = ny.array([loads(t) for t in dt])
         fields = []
         vals = []
         if not isinstance(va, Mapping):
             va = dict(va)
         for f in sorted(va):
             fields.append(f)
             data = va[f]
             vals.append((vloads(v) for v in data))
         values = ny.array(list(zip(*vals)))
         name = tsname(*fields)
     else:
         name = None
         dates = None
         values = None
     return timeseries(name=name, date=dates, data=values)
Exemple #4
0
 def load_data(self, result):
     loads = self.pickler.loads
     vloads = self.value_pickler.loads
     dt, va = result
     if result[0] and va:
         dates = ny.array([loads(t) for t in dt])
         fields = []
         vals = []
         if not isinstance(va, Mapping):
             va = dict(va)
         for f in sorted(va):
             fields.append(f)
             data = va[f]
             vals.append((vloads(v) for v in data))
         values = ny.array(list(zip(*vals)))
         name = tsname(*fields)
     else:
         name = None
         dates = None
         values = None
     return timeseries(name=name, date=dates, data=values)
Exemple #5
0
 def testDataNameFull(self):
     names = dynts.tsname("test", "ciao", "ping")
     ts = randomts(100, 3, name=names)
     self.assertEqual(ts.name, names)
     self.assertEqual(ts.names(), ["test", "ciao", "ping"])
Exemple #6
0
 def testSquare(self):
     ts = self.getts(2, name=tsname('a', 'b'))
     rs = ts.square()
     self.assertEqual(rs.names(), ['square(a)', 'square(b)'])
     self._testscalar(np.square, rs, ts)
Exemple #7
0
 def testLog(self):
     ts = self.getts(2, name=tsname('a', 'b'))
     rs = ts.log()
     self.assertEqual(rs.names(), ['log(a)', 'log(b)'])
     self._testscalar(np.log, rs, ts)
Exemple #8
0
 def testgetFieldInOrder(self):
     ts1 = self.create()
     ts = ts1.irange(fields = ('a','b','c'))
     self.assertEqual(ts.count(), 3)
     self.assertEqual(ts.name, tsname('a','b','c'))
Exemple #9
0
 def testtsname(self):
     name = dynts.tsname('test')
     self.assertEqual(name, 'test')
     name = dynts.tsname('test', 'ping', 'pong')
     self.assertEqual(name, 'test__ping__pong')
Exemple #10
0
 def testDataNameFull(self):
     names = dynts.tsname('test', 'ciao', 'ping')
     ts = randomts(100, 3, name=names)
     self.assertEqual(ts.name, names)
     self.assertEqual(ts.names(), ['test', 'ciao', 'ping'])
Exemple #11
0
 def testDataName(self):
     ts = randomts(100, 3, name='test')
     self.assertEqual(ts.name, 'test')
     self.assertEqual(ts.names(), ['test', 'unnamed1', 'unnamed2'])
     ts.name = dynts.tsname('test', 'ping')
     self.assertEqual(ts.names(), ['test', 'ping', 'unnamed1'])
Exemple #12
0
 def testtsname(self):
     name = dynts.tsname("test")
     self.assertEqual(name, "test")
     name = dynts.tsname("test", "ping", "pong")
     self.assertEqual(name, "test__ping__pong")
Exemple #13
0
 def testDataName(self):
     ts = randomts(100, 3, name='test')
     self.assertEqual(ts.name, 'test')
     self.assertEqual(ts.names(), ['test', 'unnamed1', 'unnamed2'])
     ts.name = dynts.tsname('test', 'ping')
     self.assertEqual(ts.names(), ['test', 'ping', 'unnamed1'])
Exemple #14
0
 def testDataName(self):
     ts = randomts(100, 3, name="test")
     self.assertEqual(ts.name, "test")
     self.assertEqual(ts.names(), ["test", "unnamed1", "unnamed2"])
     ts.name = dynts.tsname("test", "ping")
     self.assertEqual(ts.names(), ["test", "ping", "unnamed1"])
Exemple #15
0
 def testSquare(self):
     ts = self.getts(2, name=tsname('a', 'b'))
     rs = ts.square()
     self.assertEqual(rs.names(), ['square(a)', 'square(b)'])
     self._testscalar(np.square, rs, ts)
Exemple #16
0
 def testLog(self):
     ts = self.getts(2, name = tsname('a', 'b'))
     rs = ts.log()
     self.assertEqual(rs.names(), ['log(a)', 'log(b)'])
     self._testscalar(np.log, rs, ts)
Exemple #17
0
 def testtsname(self):
     name = dynts.tsname('test')
     self.assertEqual(name, 'test')
     name = dynts.tsname('test', 'ping', 'pong')
     self.assertEqual(name, 'test__ping__pong')
Exemple #18
0
 def testDataNameFull(self):
     names = dynts.tsname('test', 'ciao', 'ping')
     ts = randomts(100, 3, name=names)
     self.assertEqual(ts.name, names)
     self.assertEqual(ts.names(), ['test', 'ciao', 'ping'])