Giter VIP home page Giter VIP logo

happi's Introduction

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

happi's People

Contributors

cristinasewell avatar hhslepicka avatar jjl772 avatar klauer avatar laura-king avatar prjemian avatar tacaswell avatar tangkong avatar untzag avatar zllentz avatar zrylettc avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.