Skip to content

Draft: Actor button

Stuart Fisher requested to merge feature/actor-button into master

A simple component to launch an actor on click from SampleScans. Supports a simple inline form to set params (or none at all) from the actor Schema. For the future need to also add a way to retrieve params from the store. Also probably some room to improve the styling of the inline form

Screenshot_2021-08-17_at_15.33.45

Layout yaml would look something like:

component: actorbutton
options:
  actor: ct
  title: 'CT Update'
  params:
    exposure: 1

And the basic actor in samplescans:

from marshmallow import fields

from daiquiri.core.components import (
    ComponentActor,
    ComponentActorSchema,
)
from daiquiri.core.hardware.bliss.session import *


class CtSchema(ComponentActorSchema):
    enqueue = fields.Bool(default=False)
    sampleid = fields.Int()
    exposure = fields.Float(required=True, metadata={"title": "Exposure Time"})

    class Meta:
        uischema = {
            "sampleid": {"classNames": "hidden-row", "ui:widget": "hidden"},
            "enqueue": {"classNames": "hidden-row", "ui:widget": "hidden"},
            # "exposure": {"classNames": "hidden-row", "ui:widget": "hidden"},
        }


class CtActor(ComponentActor):
    # this is important to stop daiquiri saving metadata associated with this scan
    # default is 'experiment'
    metatype = None
    schema = CtSchema
    name = "ct"

    def method(self, **kwargs):
        lima = config.get("lima_simulator")

        ct(kwargs["exposure"], lima)

and actor activate in samplescans.yml with

component: samplescan
scans:
  - actor: exafs
  - actor: exafsramp
  - actor: scandisplay
  - actor: ct
Edited by Stuart Fisher

Merge request reports