Giter VIP home page Giter VIP logo

lecroy-scope's Introduction

lecroyscope

PyPI version Build and Test PyPI - Python Version

๐Ÿค” 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

lecroy-scope's People

Contributors

lobis avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

fiorotto8

lecroy-scope's Issues

only half of values is read from the file recorded with WavePro HD

Hello.
I've noticed that lecroyscope.Trace() reads only half of the data recorded with the WavePro HD scope. Reason is that the array length of the data is taken from header["wave_array_count"] instead of header["wave_array1"]. If I replace that in the reading/file.py (line 116) then everything works correctly at least for singe traces and sequences. I don't know if this is scope model specific or a general solution and weather it works for all types of data though.

kind regards, Ekaterina

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.