Skip to main content

HAPPI

Heuristic Access to Positioning of Photon Instrumentation

Motivation • Features • Installation • Contributing • Basic Usage • Documentation

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

Contributing

Developers should check out the contributing docs.

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()

Command Line Interface

You can also view and manipulate device databases using the happi cli:

happi [OPTIONS] COMMAND [ARGS]...

You can try out happi commands on a simple test database as follows (this assumes you are running from the happi project root dir):

happi --path examples/example.cfg COMMAND [ARGS]

The simple test database is located at happi/examples/db.json, which is specified in example.cfg. Please refer to the documentation for a list of possible commands and their arguments.

Metadata

Release files for happi 3.0.1

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

Source distribution (sdist)

Source distribution for happi 3.0.1
File Size Uploaded
happi-3.0.1.tar.gz 112.4 kB Details

Built distribution (wheel)

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

Total release size: 206.5 kB

Release files / happi-3.0.1.tar.gz

Download URL happi-3.0.1.tar.gz
Size 112.4 kB
Tags Source
SHA-256 checksum
How to use checksums
972d9e8a57c3a2e5082316d909cd0dbb1663465a8deff2d27a37a214cee1c900
BLAKE2b-256 checksum
How to use checksums
a10d8a41c86d5c71084e554cd5b92df482722f4e53e7f100f4569694bc9f11e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release files / happi-3.0.1-py3-none-any.whl

Download URL happi-3.0.1-py3-none-any.whl
Size 94.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0bbf16da6935f2f892ddc78b3ebfecb7c84a6a432d1b2ed49530a6136645d7f5
BLAKE2b-256 checksum
How to use checksums
ce2783314cfd4800ada7542ba49efc772c7a8949d349c7bec177e4e7fa5257e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release history Release notifications | RSS feed

This release

3.0.1 This release

2 release files

3.0.0

2 release files

2.6.2

2 release files

2.6.1

2 release files

2.6.0

2 release files

2.5.0

2 release files

2.4.0

2 release files

2.3.0

2 release files

2.2.0

2 release files

2.1.1

2 release files

2.0.0

1 release file

1.14.0

1 release file

1.13.0

1 release file

1.12.0

1 release file

1.10.1

1 release file

1.10.0

1 release file

1.9.0

1 release file

1.8.4

2 release files

1.8.3

2 release files

1.8.2

2 release files

1.8.1

2 release files

1.8.0

2 release files

1.7.2

2 release files

1.7.1

1 release file

1.6.0

1 release file

1.3.0

1 release file

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