From: W. Trevor King Date: Tue, 11 Nov 2008 16:27:13 +0000 (-0500) Subject: Added license header to data_logger.py X-Git-Tag: 0.1^0 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=dac37a788080f4e24e9fa54978bb530d1b2b6614;p=data_logger.git Added license header to data_logger.py --- 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()