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
Metadata
Release files for lecroyscope 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| lecroyscope-1.0.0.tar.gz | 194.4 kB | Without provenance | Details for lecroyscope-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| lecroyscope-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for lecroyscope-1.0.0-py3-none-any.whl |
Total release size: 207.6 kB
Release files / lecroyscope-1.0.0.tar.gz
| Download URL | lecroyscope-1.0.0.tar.gz |
|---|---|
| Size | 194.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a2d434ad6f62866b8be6b54f6fb98b9b9fafbb851595ee54e6244d92307c2ed5
|
|
BLAKE2b-256 checksum How to use checksums |
5b5032e6451222e9c65cbae016022a8633902eb616841d53813d7e6b18d4ed15
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.3
|
Release files / lecroyscope-1.0.0-py3-none-any.whl
| Download URL | lecroyscope-1.0.0-py3-none-any.whl |
|---|---|
| Size | 13.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8c7275d0990d9c52162a89ec42aae5fd084913939c8aa3aa26fd84b647cb7aa1
|
|
BLAKE2b-256 checksum How to use checksums |
fa2ba0ff4ab324bddd7aeb03f19ff8c763e464ff83c4b4128b7ab4f0f370258c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.3
|
Security for lecroyscope 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.