Skip to main content

Pure-python library for Fermilab control system

Project description

pacsys

Pure-Python library for Fermilab's control system.

Tests Documentation License: GPL-3.0 Python 3.10+

About

ACNET (Accelerator Control NETwork) is the control system used at Fermilab's particle accelerators. pacsys provides a simple Python interface to read, write, and stream data from ACNET devices without needing to understand the underlying protocols.

Features

  • Read/Write device values with synchronous or async APIs
  • Stream real-time updates EPICS-style
  • Multiple backends to connect to DPM (Data Pool Manager) and other services
  • Full DRF3 parser for data request strings

Device API (recommended)

from pacsys import Device, ScalarDevice, ArrayDevice, Verify, KerberosAuth

# Create a device -- DRF is validated immediately
dev = Device("M:OUTTMP")

# Read different properties
temperature = dev.read()               # READING (scaled value)
setpoint = dev.setting()               # SETTING property
is_on = dev.status(field="on")         # STATUS field ON
alarm = dev.analog_alarm()             # ANALOG alarm

# Full reading with metadata
reading = dev.get()
print(f"{reading.value} {reading.units}")

# Write with automatic readback verification
with pacsys.dpm(auth=KerberosAuth(), role="testing") as backend:
    dev = Device("M:OUTTMP", backend=backend)
    result = dev.write(72.5, verify=Verify(tolerance=0.5))
    assert result.verified

# Control commands with shortcuts
dev.on()
dev.off()
dev.reset()

# Device database metadata (scaling, limits, units)
info = dev.info()
print(info.description)                # "Outside temperature"
print(info.reading.common_units)       # "DegF"
print(info.reading.min_val)            # 0.0

# Immutable -- modifications return new instances
periodic_dev = dev.with_event("p,1000")
sliced_dev = dev.with_range(0, 10)

Backend API

import pacsys

# Read a device value
temperature = pacsys.read("M:OUTTMP")
print(f"Temperature: {temperature}")

# Stream real-time data
with pacsys.subscribe(["M:OUTTMP@p,1000"]) as stream:
    for reading, _ in stream.readings(timeout=30):
        print(f"{reading.name}: {reading.value}")

# Write (requires authentication)
from pacsys import KerberosAuth
with pacsys.dpm(auth=KerberosAuth(), role="testing") as backend:
    backend.write("Z:ACLTST", 72.5)

SSH Utilities

Port tunneling, SFTP, and interactive processes over multi-hop SSH.

import pacsys

# Execute commands with automatic Kerberos auth
with pacsys.ssh(["jump.fnal.gov", "target.fnal.gov"]) as ssh:
    result = ssh.exec("hostname")
    print(result.stdout) # target

# ACL can be run on the fly - beam switch, DB, etc.
with pacsys.ssh("clx01.fnal.gov") as ssh:
    result = ssh.acl("read M:OUTTMP") # "M:OUTTMP       =  72.500 DegF"

Installation

pip install pacsys

Requirements

  • Python 3.10+
  • For writes: Kerberos credentials with appropriate role assigned

Documentation

See the full documentation for guides, API reference, and protocol details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pacsys-0.1.0.tar.gz (276.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pacsys-0.1.0-py3-none-any.whl (216.9 kB view details)

Uploaded Python 3

File details

Details for the file pacsys-0.1.0.tar.gz.

File metadata

  • Download URL: pacsys-0.1.0.tar.gz
  • Upload date:
  • Size: 276.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for pacsys-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2d9c507d58d299113097c79603bab866d2206358dbab68cc780e241c8b57344a
MD5 67f723e992a3037c8602dc79acc43c37
BLAKE2b-256 7f779736b41be59655e1e71c28793ae34bd2e761376987d0760e40fe2d86ee96

See more details on using hashes here.

File details

Details for the file pacsys-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pacsys-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 216.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for pacsys-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d26aa9259fb94a51a0931ecd01092db5470c109c982671790b8e67c6bba842d7
MD5 c6283c85899a1ee1dfff0c1a418714e5
BLAKE2b-256 cd8fad731ccfa020f4e31fc5a6d10c4e3790735bc0cfb15ebfb2e756659201cb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page