Skip to main content

stitchlockin

Python client for STITCH, an FPGA lock-in amplifier that drives an excitation signal (up to 500 kHz, up to 1023 programmed frequencies per shot, adiabatic ramps between them), receives the attocube IDS3010 distance stream over LVDS-HSSL and accumulates the cos/sin components of every frequency in real time. The gateware and this API are versioned together: the package version is the git tag of the stitchlockin repository, in which the VHDL lives under stitch_project/stitch.

The FPGA talks over a serial port (115200 baud, 8N1).

from stitchlockin import Stitch, frequencyHzToDphi, rampHzSqToDdphi, \
    numPeriodsToNringup, numPeriodsToNmeas, DeltaDphiAndDdphiToNsweep, dataToAmpsPhase

st = Stitch("/dev/ttyUSB0")            # alwaysOpen=True keeps the port open between commands

freqs = [100e3, 110e3, 120e3]
dphis = [frequencyHzToDphi(f) for f in freqs]
st.setNumFrequencies(len(freqs))
st.setFrequencies(dphis)
st.setRingupDurations([numPeriodsToNringup(200, f) for f in freqs])
st.setMeasureDurations([numPeriodsToNmeas(1000, f) for f in freqs])
ddphi = rampHzSqToDdphi(1e9)
st.setSweepFrequencyDeltas([ddphi] * len(freqs))
st.setSweepDurations([DeltaDphiAndDdphiToNsweep(abs(dphis[i + 1] - dphis[i]), ddphi)
                      for i in range(len(freqs) - 1)] + [1])

st.startExperiment()
n, cos, sin = st.getData()             # raw 64-bit accumulators + sample counts per frequency
amps_nm, (phase, phase_unwrapped), cos_nm, sin_nm, nsamp = dataToAmpsPhase((n, cos, sin))

Stitch exposes the register-level primitives too (setAddress, setRegister, dphiWrite, ...) for anything the convenience methods don't cover; the command and destination byte constants (CMD_*, DEST_*) are importable from the package.

Install with pip install stitchlockin; it is also pulled in by cmtqoutilities, which re-exports it as from utilities import stitchlockin.

Metadata

Release files for stitchlockin 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for stitchlockin 0.1.0
File Size Uploaded Provenance Actions
stitchlockin-0.1.0.tar.gz 903.1 kB Without provenance Details for stitchlockin-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for stitchlockin 0.1.0
File Interpreter ABI Platform Actions
stitchlockin-0.1.0-py3-none-any.whl Python 3 none any Details for stitchlockin-0.1.0-py3-none-any.whl

Total release size: 908.5 kB

Release files / stitchlockin-0.1.0.tar.gz

Download URL stitchlockin-0.1.0.tar.gz
Size 903.1 kB
Tags Source
SHA-256 checksum
How to use checksums
3183b3955dadfa35c4db8eb98b8dfc0ae6418973ef9bac16ffdf42951bdaea26
BLAKE2b-256 checksum
How to use checksums
09eac7dbb8c448b6d7a14bafdd928b1988e4fefd1fd8a521f78d2bcc627dd681
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.12

Release files / stitchlockin-0.1.0-py3-none-any.whl

Download URL stitchlockin-0.1.0-py3-none-any.whl
Size 5.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
02dcb571b091bfce6691b639b979d84cea8d7ce66847d36fb4a3eab863295a41
BLAKE2b-256 checksum
How to use checksums
d3a2799f41aee29b051057c215a769d55c4520ccda30564aefb4f7bf94e230f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.12

Security for stitchlockin 0.1.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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page