Skip to main content

Happi Database Access for LCLS Beamline Devices

Project description

HAPPI

Heuristic Access to Positioning of Photon Instrumentation

MotivationFeaturesInstallationBasic UsageDocumentation

Motivation

LCLS endstations deal with dynamic sets of instrumentation. Information like ports, triggers and aliases are all important for operation, but hard to manage when spread across a multitude of applications. Happi solves this problem by creating a single access point for all the metadata required to interface with LCLS instrumentation. Using a flexible container based system Happi allows the enforcement of specific conventions while still permitting flexible data entry where required.

Features

  • Manage information for specific device types using containers
  • Input arbitrary metadata associated with a specific device
  • Flexible backend support for multiple types of databases; MongoDB, JSON e.t.c
  • Easily search database entries for device/s that match a set of keys

Installation

Install the most recent tagged build: conda install happi -c pcds-tag -c conda-forge

Install the most recent development build: conda install happi -c pcds-dev -c conda-forge

Basic Usage

The happi.Client is your main interface to the underlying device database. You have the choice of either creating your database backend by hand or using the environment variable $HAPPI_BACKEND to create a persistent reference to your database type. By default, the Client assumes a JSON file database:

   import happi

   client = happi.Client(path='path/to/my_db.json')

If your database has entries, you should either be able to search by key variables for individual or multiple devices.

   client.find_device(name="My Device")

   client.search(stand='DG2')

Once you have the device you want, you can edit the information just as you would any other Python object. View the device information in a convenient table using .show_info:

   dev = client.find_device(name="My Device")

   dev.z = 432.1

   dev.show_info()

Output

+--------------+----------------------+
| EntryInfo    | Value                |
+--------------+----------------------+
| active       | True                 |
| beamline     | LCLS                 |
| name         | My Device            |
| parent       | None                 |
| prefix       | MY:DEV:01            |
| stand        | None                 |
| system       | None                 |
| z            | 432.10000            |
+--------------+----------------------+

After you are satisfied with your changes, push the information back to the database using the .save method. If this is a new device, you will have to call Client.add_device. Before the entry is modified in the database, the happi.Client confirms that the new changes meet all the requirements specified by the container.

   dev.save()

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

happi-2.5.0.tar.gz (108.1 kB view details)

Uploaded Source

Built Distribution

happi-2.5.0-py3-none-any.whl (91.5 kB view details)

Uploaded Python 3

File details

Details for the file happi-2.5.0.tar.gz.

File metadata

  • Download URL: happi-2.5.0.tar.gz
  • Upload date:
  • Size: 108.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for happi-2.5.0.tar.gz
Algorithm Hash digest
SHA256 4b5684f9964952d91c1c68d2039644b0f5df3c0a54d91132f63db98e9faec82a
MD5 78dc2261e7d5415afc7c24e007593b7e
BLAKE2b-256 8a76bb2705eafaf4f1726d9219518fd652b07a22288a764623a7d17dd30ef0bc

See more details on using hashes here.

File details

Details for the file happi-2.5.0-py3-none-any.whl.

File metadata

  • Download URL: happi-2.5.0-py3-none-any.whl
  • Upload date:
  • Size: 91.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for happi-2.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b5af3d8accdd5e0555291820fba09a8e3d635a89f4f9c3e6084948f3000c9e37
MD5 3088fdd7068451b95373700ec24d0585
BLAKE2b-256 fe07700f27b68ec1c6e58140b34b7575ebc4382e31bea29def3ff22e397cc92c

See more details on using hashes here.

Supported by

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