From f8a87ff1069d7fab7031804da2d66773be8695a6 Mon Sep 17 00:00:00 2001 From: Anthony LaTorre Date: Wed, 17 Aug 2011 14:40:25 -0400 Subject: documentation update and open hdf5 files in read only mode in draw.py --- README | 9 +++++++-- config.py | 10 +++++----- draw.py | 4 +++- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/README b/README index 3c59521..03ecf30 100644 --- a/README +++ b/README @@ -83,8 +83,13 @@ Turn on sequence mode! Be aware that as you turn up the number of segments the scope will take longer to process a single acquisition. The default timeout value for the socket connection in sock.py is set to 2 seconds; therefore, if an acquisition -takes longer than 2 seconds, the socket object will raise a timeout exception -when you request a waveform. +takes longer than 2 seconds, the socket object may raise a timeout exception +when you attempt to readout a waveform. + +How to Analyze the Waveforms +---------------------------- + +Example code to read the waveforms from an hdf5 file is coming soon. Documentation ------------- diff --git a/config.py b/config.py index 2af80da..c017316 100755 --- a/config.py +++ b/config.py @@ -15,8 +15,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . """ -Save/load settings from a LeCroy DSO oscilloscope. Settings are saved as a -python dictionary in two ways: pickled to a stand-alone file, or attached as +Save/load settings from a LeCroy X-stream oscilloscope. Settings are saved as +a python dictionary in two ways: pickled to a stand-alone file, or attached as attributes to a hdf5 file. Settings can be loaded from either source. Examples: @@ -76,10 +76,10 @@ if __name__ == '__main__': if len(args) < 2: sys.exit(parser.format_help()) - from scope import Scope + import setup + from sock import Socket - scope = Scope('scope01.hep.upenn.edu') - scope.connect() + scope = Socket(setup.scope_ip, timeout=20.0) scope.clear() if args[0] == 'save': diff --git a/draw.py b/draw.py index 70efda7..30a2ffd 100755 --- a/draw.py +++ b/draw.py @@ -17,7 +17,7 @@ def roundrobin(*iterables): nexts = cycle(islice(nexts, pending)) def draw(filename, nevents): - f = h5py.File(filename) + f = h5py.File(filename, 'r') fig = plt.figure() for i, dataset in enumerate((f[name] for name in f)): @@ -37,6 +37,8 @@ def draw(filename, nevents): plt.ylabel('Voltage (V)') plt.title(dataset.name) + f.close() + return fig if __name__ == '__main__': -- cgit