keithley2460-ophyd
An ophyd Flyer for the Keithley 2460 SourceMeter that runs finite source/measure sequences on the instrument. The host compiles a validated sequence of constant-current, constant-voltage and rest steps into a trigger model of at most 63 blocks, uploads it to a packaged, reviewed TSP runtime, and reads the stored readings back in bounded chunks. The 2460 itself times every sample, checks the voltage limits after every reading, drives the digital marker, READY and BUSY lines and switches the output OFF at the end. The host never paces samples and never sends user-written TSP.
Sequence + SafetyLimits ──► SequenceRequest
│
SequenceFlyer (classic ophyd Flyer: stage, prepare, kickoff, complete, collect, stop)
│ SequenceBackend protocol
Keithley2460SequenceBackend ─► compile_program / Replayer (pure)
│ PyVISA, one owner
packaged TSP runtime on the 2460 (trigger model: timing, cutoffs, markers, output OFF)
This package covers the instrument only. Experiment protocols, Excel run sheets, a QueueServer deployment, HDF5 run files and a synthetic-cell simulator built on it are in electrochemistry-bluesky.
Status: alpha. Supports the Keithley 2460 (firmware 1.7.16a tested) over LAN with TSP. Not yet released on PyPI.
Install
pip install "keithley2460-ophyd[visa]" # once released; from a checkout: uv sync --extra visa
Python 3.11 or later; development and testing use 3.14.
Use
A sequence is a tuple of Steps with an optional repeat block, validated
against explicit SafetyLimits before anything reaches the instrument:
from bluesky import RunEngine
from bluesky import plan_stubs as bps
from keithley2460_ophyd import (
SafetyLimits,
Sampling,
Sequence,
SequenceFlyer,
SequenceRequest,
cc_step,
k2460_sequence_backend,
rest_step,
)
limits = SafetyLimits(
v_min_abs=0.0, v_max_abs=2.0, i_max_abs=0.01, max_duration_s=600, max_records=100_000
)
sequence = Sequence(
(
rest_step(10, Sampling(0.1)),
cc_step(0.001, target_v=1.5, max_duration_s=60, sampling=Sampling(0.1)),
rest_step(10, Sampling(0.1)),
)
)
request = SequenceRequest("demo-001", sequence, limits)
backend = k2460_sequence_backend(
"TCPIP0::<instrument-ip>::5025::SOCKET",
terminals="front",
expected_serial_number="<serial>", # connect refuses any other instrument
)
flyer = SequenceFlyer(backend, name="k2460")
def plan():
yield from bps.stage(flyer)
yield from bps.prepare(flyer, request, wait=True)
yield from bps.open_run()
yield from bps.kickoff(flyer, wait=True)
yield from bps.collect_while_completing([flyer], [flyer], flush_period=1.0)
yield from bps.close_run()
yield from bps.unstage(flyer)
RunEngine()(plan())
Nothing is sent to the instrument on import or construction; stage connects.
A production plan should also stop and drain the Flyer on interruption (see
run_sequence in electrochemistry-bluesky).
k2460-diagnose --resource '<VISA resource>' --backend '@py' checks the
connection read-only: identity, command language and output state.
Safety model
- Every request is finite and validated against
SafetyLimitsbefore arming; the runtime checks every uploaded value again. - In current and rest steps the absolute voltage window is a STOP branch after every reading, evaluated by the 2460; compliance sits 0.1 V outside it.
- Output-off mode is HIGH-Z for both source functions, set and read back at every prepare, so an idle output does not drive a connected cell.
- Output OFF is confirmed by read-back at every terminal state. An aborted run is never reported as completed. Uncertain commands are never retried.
preparerefuses while unread records of an earlier run remain on the instrument;archive_retainedsaves them first.- Only the exact packaged runtime (
tsp/sequencer.tsp, ABIoe-k2460-seq-v1) can be uploaded; its build and SHA-256 are checked after installation.
The instrument does not watch the voltage between readings, and it cannot
protect a cell before a session has set HIGH-Z: after power-on the 2460's
output-off mode is NORMAL. Call backend.secure_off_mode(limits) (connect,
set HIGH-Z with read-back, disconnect) before connecting a cell, and disconnect
the cell before switching the 2460 off. Do not claim timing beyond what the reading timestamps show.
Documentation
- Sequencer runtime design: block layout, timing, cutoffs, time base, runtime API and the measured instrument facts it rests on.
keithley2460_ophyd.testing: the packaged runtime in a Lua mock of the 2460 (needs thetestingextra), for offline tests of code that uses the backend.
Development
uv sync --locked --group dev --extra visa
uv run --locked pytest # no test touches an instrument
uv run --locked ruff check . && uv run --locked ruff format --check .
uv run --locked mypy src
CI (.github/workflows/ci.yml) runs the same on every push and pull request:
lint and types, the tests on Python 3.11–3.14 (Linux) and 3.14 (macOS), and a
build whose wheel must hold the packaged runtime and import on its own.
Any change to tsp/sequencer.tsp bumps SEQUENCER_BUILD (a test pins the
build to the source digest) and needs a review and a dummy-load check on the
instrument before it is used with a cell.
Acknowledgments
Parts of the code were implemented with the assistance of OpenAI Codex and Anthropic Claude, and were reviewed and tested by the authors. We are aware that tools of this kind are built on knowledge and code contributed by people who were never asked, and who cannot be credited individually here. We thank them nonetheless.
License
BSD 3-Clause. No Keithley manuals or example code are redistributed.
Metadata
Release files for keithley2460-ophyd 0.1.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 |
|---|---|---|---|---|
| keithley2460_ophyd-0.1.0.tar.gz | 78.9 kB | With provenance | Details for keithley2460_ophyd-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| keithley2460_ophyd-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for keithley2460_ophyd-0.1.0-py3-none-any.whl |
Total release size: 133.7 kB
Release files / keithley2460_ophyd-0.1.0.tar.gz
| Download URL | keithley2460_ophyd-0.1.0.tar.gz |
|---|---|
| Size | 78.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
74d1688de1107b91b9063c772d82f3abfd75bd3561f90f0e3959a9b0e2831294
|
|
BLAKE2b-256 checksum How to use checksums |
19d9d5e13027a5dbf4230ca2f721ffbe4c90d91a9b1983107dfbf3eacfe2f025
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.
Transparency logRelease files / keithley2460_ophyd-0.1.0-py3-none-any.whl
| Download URL | keithley2460_ophyd-0.1.0-py3-none-any.whl |
|---|---|
| Size | 54.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
90c0cab7a561f8059f95628c22eef1bc8ac793d35fcd623b3c8825f3e8bcb0cd
|
|
BLAKE2b-256 checksum How to use checksums |
22e5c8ba45831e2d86683059d0c50895fa420973a0414a67b83d4c31e0920d7c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.
Transparency logSecurity for keithley2460-ophyd 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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for keithley2460_ophyd-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.
Transparency logA 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.