#!/user/bin/python
#
-# Define some simple data logging classes for consistency
-# see the test functions for some usage examples
+# data_logger - classes for consistently logging data in an organized
+# fasion. See the test functions for some usage examples
+#
+# Copyright (C) 2008, William Trevor King
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+#
+# The author may be contacted at <wking@drexel.edu> on the Internet, or
+# write to Trevor King, Drexel University, Physics Dept., 3141 Chestnut St.,
+# Philadelphia PA 19104, USA.
import os, os.path
import stat
import string
import numpy
+VERSION = "0.1"
+
class error (Exception) :
"Basic module error class"
pass
Load an object saved with data_log.write_binary()
The file-name must not have been altered.
"""
- raise Exception, "not implemented"
+ type = file.split("_")[-1]
+ if type == "float" :
+ t = numpy.float
+ else :
+ raise Exception, "read_binary() not implemented for type %s" % (type)
+ return numpy.fromfile(file, dtype=t)
def read_dict_of_arrays(self, basefile) :
"""
Load an object saved with data_log.write_binary()