stitchlockin 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,59 @@
1
+ Metadata-Version: 2.4
2
+ Name: stitchlockin
3
+ Version: 0.1.0
4
+ Summary: Python API for STITCH, the FPGA lock-in amplifier for the attocube IDS3010
5
+ Home-page: https://gitlab.phys.ethz.ch/code/experiment/stitchlockin
6
+ Author: Sebastian Huber
7
+ Author-email: huberse@phys.ethz.ch
8
+ Requires-Python: >=3.8
9
+ Description-Content-Type: text/markdown
10
+ Requires-Dist: numpy>=1.18.0
11
+ Requires-Dist: pyserial>=3.5
12
+ Dynamic: author
13
+ Dynamic: author-email
14
+ Dynamic: description
15
+ Dynamic: description-content-type
16
+ Dynamic: home-page
17
+ Dynamic: requires-dist
18
+ Dynamic: requires-python
19
+ Dynamic: summary
20
+
21
+ # stitchlockin
22
+
23
+ Python client for **STITCH**, an FPGA lock-in amplifier that drives an excitation signal
24
+ (up to 500 kHz, up to 1023 programmed frequencies per shot, adiabatic ramps between them),
25
+ receives the attocube IDS3010 distance stream over LVDS-HSSL and accumulates the cos/sin
26
+ components of every frequency in real time. The gateware and this API are versioned together:
27
+ the package version is the git tag of the `stitchlockin` repository, in which the VHDL lives
28
+ under `stitch_project/stitch`.
29
+
30
+ The FPGA talks over a serial port (115200 baud, 8N1).
31
+
32
+ ```python
33
+ from stitchlockin import Stitch, frequencyHzToDphi, rampHzSqToDdphi, \
34
+ numPeriodsToNringup, numPeriodsToNmeas, DeltaDphiAndDdphiToNsweep, dataToAmpsPhase
35
+
36
+ st = Stitch("/dev/ttyUSB0") # alwaysOpen=True keeps the port open between commands
37
+
38
+ freqs = [100e3, 110e3, 120e3]
39
+ dphis = [frequencyHzToDphi(f) for f in freqs]
40
+ st.setNumFrequencies(len(freqs))
41
+ st.setFrequencies(dphis)
42
+ st.setRingupDurations([numPeriodsToNringup(200, f) for f in freqs])
43
+ st.setMeasureDurations([numPeriodsToNmeas(1000, f) for f in freqs])
44
+ ddphi = rampHzSqToDdphi(1e9)
45
+ st.setSweepFrequencyDeltas([ddphi] * len(freqs))
46
+ st.setSweepDurations([DeltaDphiAndDdphiToNsweep(abs(dphis[i + 1] - dphis[i]), ddphi)
47
+ for i in range(len(freqs) - 1)] + [1])
48
+
49
+ st.startExperiment()
50
+ n, cos, sin = st.getData() # raw 64-bit accumulators + sample counts per frequency
51
+ amps_nm, (phase, phase_unwrapped), cos_nm, sin_nm, nsamp = dataToAmpsPhase((n, cos, sin))
52
+ ```
53
+
54
+ `Stitch` exposes the register-level primitives too (`setAddress`, `setRegister`, `dphiWrite`, ...)
55
+ for anything the convenience methods don't cover; the command and destination byte constants
56
+ (`CMD_*`, `DEST_*`) are importable from the package.
57
+
58
+ Install with `pip install stitchlockin`; it is also pulled in by `cmtqoutilities`, which
59
+ re-exports it as `from utilities import stitchlockin`.