Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement slow control data plotting page #287

Open
wants to merge 47 commits into
base: master
Choose a base branch
from

Conversation

lucs100
Copy link

@lucs100 lucs100 commented Jul 18, 2024

Implement a new page on Minard to plot historical slow controls data.

Features

  • Plots both rack power supply voltages and crate trigger baseline voltages over arbitrary periods of time.
  • Plots implemented using MetricsGraphics, based on the run selection plot page.
  • Expected baselines are shown alongside each line on the plot (eg. 24V or -8V).
  • Multiple datastreams can be plotted simultaneously and compared. Lines can be added or removed one by one.
  • Time and voltage axes can be zoomed in or out by clicking on the plot or using the Plot Controls panel. The plot can be moused over to read specific values for each datastream at each point.
  • Data requests have been heavily optimized thanks to database restructuring on CouchDB and multithreading (using grequests)

Code changes

New files

  • slowcontrol_plots.html: The slow control plotting web page. Written using the run selection page layout/logic as a starting point.
  • slowcontrol_plots.js: Extra JS logic for the slow control plotting page (bulkier functions that don't make sense to keep in a <script> in the HTML).
  • slowcontrol_data.py: Communicates with the snoplus CouchDB server over HTTP (using grequests to multithread chunks of the request) to request data, then package it to pass back to the webpage. This file holds the bulk of the actual logic and is commented throughout.

Changed files

  • layout.html: Adds the slowcontrol plot page to the Polling dropdown in the navbar.
  • views.py: Accepts a request from the webpage and returns data once ready.
  • gitignore.txt: Adds ignore rules for some scripts on vminard for convenience. Change is not neccesary.
  • requirements.txt: Adds grequests==0.7.0. Library is required for multithreaded HTTP requests to CouchDB.

Requirements:

  • New python package grequests==0.7.0.

Screenshot:

image
An example plot for the first half of 2024. Shows Rack 6 was offline for slightly over a week in late February while Rack 3 (the orange signal) was mostly online, and that all racks went offline for a few days in March.

Concerns:

  • This page uses the environment variables COUCH_USER and COUCH_PASS (specifically on Line 12 of slowcontrol_data.py). I'm not sure if the minard configuration has these environment variables set.
  • The page loads (for several minutes in larger requests) while waiting for the CouchDB request to complete. This may be difficult to refactor due to the Flask backend but is a possible improvement moving forward.

lucs100 added 30 commits June 13, 2024 10:33
Allows for multiple lines on one plot
Code reuse between new and append; store timestamps to avoid data mismatch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant