Skip to content

Live 2D STXM Data Streaming #375

Open

Description

@Relm-Arrowny

Part #373 Live plotting:

Connect the Web plotting interface to the live scan event stream to display STXM data in real-time. This replaces the manual Jupyter Notebook and BlueSky plotting workaround here. Making it available in p99.diamond.ac.uk webUI.

Note

These will be stream data, e.g. (data that are small and ready available to the webUI.), These will be in the format of json/dictionary.

Goals

Acceptance criteria : What journeys should the user be able to complete to consider your feature done
Be as specific as you can, check them off once they work. Add more if you find more requirements during development. Issue should only be considered done after all of them are checked

  • Live Visual Population: The user can view the 2D STXM scan data populating the central canvas in real-time during an active acquisition
  • Dynamic Plot Updating: The UI updates the scan grid continuously without requiring page refreshes or halting the client interface

Tasks

base on the goals, deduce the tasks required. check them off once they're done

Caution

Decision needed

  • Blueapi CLI callback, RabbitMQ, title or NEXS file.
  • Davidia Integration Evaluation: Assess if Davidia should be utilized as the core plotting library for streaming 2D arrays
  • Data Ingestion: Connect the UI canvas component to a data brokers.
  • Live Heatmap Rendering: Implement high-performance rendering logic to map incoming 2D spatial coordinates $(x, y)$ and intensity values onto a dynamic heatmap grid.

Related Resources

any images/gifs, mockups/wireframes that would aid the development should be listed here
MockUp : link to mockup
Coda doc: link to coda
Additional context
Add any other context or screenshots about the feature request here.

Activity

  1. changed the title [-]Implement live 2D STXM data streaming to display scanning updates in real time. (Mapping ?)[/-] [+] Live 2D STXM Data Streaming[/+] on Sep 9, 2026
  2. DanPorter commented on Sep 15, 2026

    @DanPorter
    Collaborator

    Am I right in thinking that each "pixel" on the STXM image will be the sum of a detector image?

    So then the specific question is - where does that sum (or other processing) happen?

    Tiled/ Nexus file etc will only provide the data array from the detector, but supposedly there will be another service from the data analysis platform team to perform small operations like this.

    The other option is to have a BlueSky device that reads the last detector image and returns the sum, but I don't know if that is possible.

  3. Relm-Arrowny commented on Sep 15, 2026

    @Relm-Arrowny
    CollaboratorAuthor

    Am I right in thinking that each "pixel" on the STXM image will be the sum of a detector image?

    So then the specific question is - where does that sum (or other processing) happen?

    Tiled/ Nexus file etc will only provide the data array from the detector, but supposedly there will be another service from the data analysis platform team to perform small operations like this.

    The other option is to have a BlueSky device that reads the last detector image and returns the sum, but I don't know if that is possible.

    Image statistic can be made to be emitted per point, as EPIC can provides them directly (NDPluginStats). Not 100% if we can do the same if we are hardware triggering. Epic is probably the best place to do it, as the data is already in buffer as it need to do the file writing anyway, so there should not be any I/O issue.
    I would definitely not do it in Bluesky, you are pushing the image data to bluesky which will generate a very high demand on the network and the bluesky memory/cpu.

  4. DanPorter commented on Sep 16, 2026

    @DanPorter
    Collaborator

    OK great, Getting the data directly the the image statistics from the detector device in EPICS sounds like the best way to go then.

    Whilst we are waiting on the decision of where detector data will come from, we should still be able to create this component with a mock API call and ensure we tell the core team how we are expecting the call to look.

  5. NKatti2011 commented on Sep 16, 2026

    @NKatti2011
    Collaborator

    Below contains notes from meeting with @EmsArnold and others.

    Rendering

    • Davidia may be the likely/intended solution. Evaluation of the client and server is in progress;
      it has not yet been assessed specifically for plotting scan data or for layers, so
      those should be included in the evaluation before we commit.

    Where the data comes from

    The available path depends on how the plan is set up:

    • If a Bluesky plan writes to a PV, BlueAPI can feed that back: but only scalar data.
    • A file-writing detector cannot be read back through BlueAPI.
    • RabbitMQ also carries scalar data.

    So whether something like an intensity value is available at all depends on the plan and
    on how much processing is needed before it can be displayed. Recommendation: all data
    comes through Tiled as the single point of truth
    (see #389), rather than the UI picking
    a different transport per data type.

    Maths and reshaping

    • Tiled plugins for maths and reshaping are not widely used, so the maths should not live
      there. It belongs in the standalone transformation package described in Reference Frame Coordinate Transformations #379, sitting
      alongside or just below the Davidia server, the exact placement still needs a decision.

    Tiled transport

    • Assume all data goes through Tiled, even though Tiled will not hold the file directly.
    • VISR currently polls Tiled continuously, which errors while a file is being written
      to. Websockets have recently been made available on tiled-staging, which should remove
      that problem:

    I have deployed the latest version of tiled on tiled-staging.diamond.ac.uk which
    supports subscriptions via websockets. You make a websocket connection which the tiled
    server accepts without any checks and waits for the first message from the browser
    client to send the access token in a message
    json.dumps({"type": "auth", "access_token": access_token})
    If the access token is correct you are let through. You can subscribe to new
    nodes (data) being created for a i15/cm123/1 visit, or to the root, which gives you
    updates for everything.

    — Zoheb Shaikh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Data VisDecision neededDecision is required before this is ready to be scopedcore dependencyMore needed to know before we can fully scope this work.workflows

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions