Coder Social home page Coder Social logo

Comments (4)

slactjohnson avatar slactjohnson commented on September 17, 2024 1

My plan was to remove the enum but leave in the code that checks that we've chosen LCLS1 or LCLS2, which is effectively all that enum is doing. My use-case would be resolved with simply adding a default case, so I'll leave the enum in and do that.

I had not considered happi for this but that might work. The context for what I'm working on is this issue: pcdshub/opcpa-tpr-config#21

This application was originally intended to control only Tpr channels, but now the requirements are getting more complicated and necessitate interacting with other devices/PVs.

I was thinking about a config file structure like this, where I could instantiate effectively any class and then use the configuration data in the file to set it up as required:

devices:
  ch0:
    desc: "what this is"
    base: "my:base:pv"
    class: "pcdsdevices.tpr.TprTrigger"
    kwargs:
      channel: 0
      timing_mode: LCLS2
      name: "name"
  ch1: 
    ....

But thinking more, this kind is effectively what happi does. D'oh.
These are not traditional "beamline" devices, so I hadn't considered using happi. But I kind of like having a separate db.json file. I'll try this out.

from pcdsdevices.

tangkong avatar tangkong commented on September 17, 2024 1

I'm happi to help you get that set up, if you run into a wall at any point

from pcdsdevices.

slactjohnson avatar slactjohnson commented on September 17, 2024 1

Nice. :)

I'm happi to help you get that set up

from pcdsdevices.

tangkong avatar tangkong commented on September 17, 2024

A string parameter is easier pass around but the enum is meant to restrict us fully to a known subset of options. I think I agree that LCLS2 could be the default, but I think it's worth keeping the enum (or if we do pass in a string, check that the enum has that value)

Your context seems like a job for happi. Is there something stopping you from loading these devices from happi? Or making your own happi db.json and loading from that?

from pcdsdevices.

Related Issues (20)

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.