From dac37a788080f4e24e9fa54978bb530d1b2b6614 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Tue, 11 Nov 2008 11:27:13 -0500 Subject: [PATCH] Added license header to data_logger.py --- data_logger.py | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/data_logger.py b/data_logger.py index 1b6b0a1..72acb7f 100644 --- a/data_logger.py +++ b/data_logger.py @@ -1,7 +1,28 @@ #!/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 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 @@ -10,6 +31,8 @@ import time import string import numpy +VERSION = "0.1" + class error (Exception) : "Basic module error class" pass @@ -169,7 +192,12 @@ class data_load : 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() -- 2.26.2