diff --git a/README.md b/README.md index f616aef..01e8823 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,7 @@ This is an unofficial Python package to interface with Teledyne LeCroy oscilloscopes and read binary trace files (`*.trc`). -Currently only reading trace files is supported. - -This package is based on +The parsing of `trc` files is based on the [lecroy-reader](https://github.com/neago/lecroy-reader/blob/49c42a85c449013c1c48d154ae70192f172e32ba) project. @@ -42,7 +40,7 @@ pip install .[test] ## 👨‍💻 Usage -### Reading binary trace files (`*.trc`) +### 📖 Reading binary trace files (`*.trc`) ```python from lecroyscope import Trace @@ -75,3 +73,33 @@ time = trace.time # trace.x is an alias for trace.time # channel voltage values voltage = trace.voltage # trace.y is an alias for trace.voltage ``` + +### 📟 Acquisition with LeCroy oscilloscope + +```python +import lecroyscope + +scope = lecroyscope.Scope("192.168.1.10") # IP address of the scope + +# print some info +print(f"Scope ID: {scope.id}") + +# change to "Sequence" mode with 200 segments +scope.sample_mode = "Sequence" +scope.num_segments = 200 +print(f"Sample mode: '{scope.sample_mode}' with {scope.num_segments} segments") + +# acquire data with a single trigger, timout (fail) after 60 seconds +scope.acquire(timeout=60) + +# Read channel 2 and 3 traces +# The data in the scope won't change until next acquisition +trace_channel2: lecroyscope.Trace = scope.read(2) +trace_channel3: lecroyscope.Trace = scope.read(3) + +# Alternatively, it is recommended to use the TraceGroup class for reading multiple channels from the same trigger +trace_group: lecroyscope.TraceGroup = scope.read(2, 3) +trace_channel2 = trace_group[2] +trace_channel3 = trace_group[3] +time = trace_group.time # time values are the same for all traces +```