Mercurial > ift6266
diff utils/seriestables/series.py @ 224:0515a8901c6a
Corrigé un bug avec store_timestamp/cpuclock, et tests pour éviter ce cas
author | fsavard |
---|---|
date | Thu, 11 Mar 2010 11:52:43 -0500 |
parents | 02d9c1279dd8 |
children |
line wrap: on
line diff
--- a/utils/seriestables/series.py Thu Mar 11 11:08:42 2010 -0500 +++ b/utils/seriestables/series.py Thu Mar 11 11:52:43 2010 -0500 @@ -18,7 +18,7 @@ def _get_description_timestamp_cpuclock_columns(store_timestamp, store_cpuclock, pos=0): toexec = "" - + if store_timestamp: toexec += "\ttimestamp = tables.Time32Col(pos="+str(pos)+")\n" pos += 1 @@ -210,8 +210,11 @@ raise NotImplementedError def _timestamp_cpuclock(self, newrow): - newrow["timestamp"] = time.time() - newrow["cpuclock"] = time.clock() + if self.store_timestamp: + newrow["timestamp"] = time.time() + + if self.store_cpuclock: + newrow["cpuclock"] = time.clock() class DummySeries(): """ @@ -267,7 +270,9 @@ def _create_table(self): table_description = _get_description_with_n_ints_n_floats( \ - self.index_names, (self.error_name,)) + self.index_names, (self.error_name,), + store_timestamp=self.store_timestamp, + store_cpuclock=self.store_cpuclock) self._table = self.hdf5_file.createTable(self.hdf5_group, self.table_name, @@ -540,7 +545,8 @@ ''' def __init__(self, arrays_names, new_group_name, hdf5_file, - base_group='/', index_names=('epoch',), title=""): + base_group='/', index_names=('epoch',), title="", + store_timestamp=True, store_cpuclock=True): """ For other parameters, see Series.__init__ @@ -560,6 +566,12 @@ title : str Here the title is attached to the new group, not a table. + + store_timestamp : bool + Here timestamp and cpuclock are stored in *each* table + + store_cpuclock : bool + Here timestamp and cpuclock are stored in *each* table """ # most other checks done when calling BasicStatisticsSeries @@ -584,7 +596,9 @@ hdf5_file=hdf5_file, index_names=index_names, stats_functions=stats_functions, - hdf5_group=new_group._v_pathname)) + hdf5_group=new_group._v_pathname, + store_timestamp=store_timestamp, + store_cpuclock=store_cpuclock)) SeriesArrayWrapper.__init__(self, base_series_list)