An unofficial Python package 🐍📦 to interface with Teledyne LeCroy oscilloscopes and read binary trace files (.trc)
Project description
lecroyscope
🤔 What is this?
This is an unofficial Python package to interface with Teledyne LeCroy oscilloscopes and read binary trace
files (*.trc
).
The parsing of trc
files is based on
the lecroy-reader
project.
⚠️ Disclaimer
The features of this package are based on my needs at the time of writing. I have done very limited testing, using a single oscilloscope and a few trace files.
If you use this package, it is very possible you find a bug or some oversight. You are encouraged to make a pull request or to create an issue to report a bug, to request additional features or to suggest improvements.
⚙️ Installation
Installation via pip
is supported.
To install the latest published version, run:
pip install lecroyscope
To install the package from source, including test dependencies, clone the repository and run:
pip install .[test]
👨💻 Usage
📖 Reading binary trace files (*.trc
)
from lecroyscope import Trace
trace = Trace("path/to/trace.trc")
Trace file header information can be accessed via the header
attribute:
header = trace.header
# properties can be accessed directly
print("Instrument name: ", header.instrument_name)
# or as python dict
print("Instrument name: ", header["instrument_name"])
# header can also be converted into a python dict
header_dict = dict(header)
print("Header keys: ", list(header_dict.keys()))
The trace data can be accessed via the time
(x
) and voltage
(y
) attributes:
# time values
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
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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file lecroyscope-1.0.0.tar.gz
.
File metadata
- Download URL: lecroyscope-1.0.0.tar.gz
- Upload date:
- Size: 194.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a2d434ad6f62866b8be6b54f6fb98b9b9fafbb851595ee54e6244d92307c2ed5 |
|
MD5 | db6bd2ac4ad5841b079323989e850199 |
|
BLAKE2b-256 | 5b5032e6451222e9c65cbae016022a8633902eb616841d53813d7e6b18d4ed15 |
File details
Details for the file lecroyscope-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: lecroyscope-1.0.0-py3-none-any.whl
- Upload date:
- Size: 13.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8c7275d0990d9c52162a89ec42aae5fd084913939c8aa3aa26fd84b647cb7aa1 |
|
MD5 | 387a64d17cb314b168cdefd9481170fb |
|
BLAKE2b-256 | fa2ba0ff4ab324bddd7aeb03f19ff8c763e464ff83c4b4128b7ab4f0f370258c |