Skip to content
Snippets Groups Projects
Commit bea7bec5 authored by Emanuele Laface's avatar Emanuele Laface
Browse files

Little improvement in instruments images refresh

parent aa0cea8b
No related branches found
No related tags found
No related merge requests found
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 2
}
...@@ -2,9 +2,8 @@ import epics ...@@ -2,9 +2,8 @@ import epics
import time import time
import json import json
import os import os
import matplotlib.cm import matplotlib.pyplot as plt
from io import BytesIO from io import BytesIO
from PIL import Image
from git import Repo from git import Repo
from shutil import rmtree from shutil import rmtree
from glob import glob from glob import glob
...@@ -210,21 +209,19 @@ class epicsQuery(Thread): ...@@ -210,21 +209,19 @@ class epicsQuery(Thread):
with open('/var/www/data/getInterlocks','w') as datafile: with open('/var/www/data/getInterlocks','w') as datafile:
json.dump(interlocks_return_dict, datafile) json.dump(interlocks_return_dict, datafile)
colormap=matplotlib.cm.get_cmap('jet')
try: try:
imarray = (colormap(instruments['LEBT-010:PBI-NPM-002:VCAMOBSIMAGE-ArrayData'].value.reshape((618,824)))*255).astype('uint8') imarray = instruments['LEBT-010:PBI-NPM-002:VCAMOBSIMAGE-ArrayData'].value.reshape(618,824)
except: except:
imarray = colormap(zeros((618,824))).astype('uint8') imarray = zeros((618,824))
im = Image.fromarray(imarray) plt.imsave('/var/www/data/tmp-npm-vimage.png', imarray)
im.save('/var/www/data/npm-vimage.png', format='png') os.rename('/var/www/data/tmp-npm-vimage.png', '/var/www/data/npm-vimage.png')
colormap=matplotlib.cm.get_cmap('jet')
try: try:
imarray = (colormap(instruments['LEBT-010:PBI-NPM-001:HCAMOBSIMAGE-ArrayData'].value.reshape((618,824)))*255).astype('uint8') imarray = instruments['LEBT-010:PBI-NPM-001:HCAMOBSIMAGE-ArrayData'].value.reshape(618,824)
except: except:
imarray = colormap(zeros((618,824))).astype('uint8') imarray = zeros((618,824))
im = Image.fromarray(imarray).convert('RGBA') plt.imsave('/var/www/data/tmp-npm-himage.png', imarray)
im.save('/var/www/data/npm-himage.png', format='png') os.rename('/var/www/data/tmp-npm-himage.png', '/var/www/data/npm-himage.png')
instruments_return_dict={} instruments_return_dict={}
for pv in instruments: for pv in instruments:
...@@ -273,7 +270,7 @@ class epicsQuery(Thread): ...@@ -273,7 +270,7 @@ class epicsQuery(Thread):
with open('/var/www/data/getInstruments','w') as datafile: with open('/var/www/data/getInstruments','w') as datafile:
json.dump(instruments_return_dict, datafile) json.dump(instruments_return_dict, datafile)
time.sleep(1) time.sleep(0.5)
for pv in publicpvs: for pv in publicpvs:
publicpvs[pv].clear_auto_monitor() publicpvs[pv].clear_auto_monitor()
...@@ -304,9 +301,6 @@ class myHandler(BaseHTTPRequestHandler): ...@@ -304,9 +301,6 @@ class myHandler(BaseHTTPRequestHandler):
result=pvlist result=pvlist
for word in wordlist: for word in wordlist:
result=[row for row in result if word.lower() in row.lower()] result=[row for row in result if word.lower() in row.lower()]
# if len(result)>500:
# returnlist='List too long, please refine your research'
# else:
if len(result)==0: if len(result)==0:
returnlist='No PV found.' returnlist='No PV found.'
else: else:
......
%% Cell type:code id: tags:
``` python
```
This diff is collapsed.
This diff is collapsed.
{"ISrc-010:ISS-Intf-HMI:ComIocOK": {"units": null, "value": 1}, "ISrc-010:ISS-Intf-PSS:HVPermitR": {"units": null, "value": 0}, "ISrc-010:ISS-HVPf-Res:CloseR": {"units": null, "value": 1}, "ISrc-010:ISS-HVPf-Doors:CloseR": {"units": null, "value": 1}, "ISrc-010:ISS-Intf-Vac:VacPermit": {"units": null, "value": 1}, "LEBT-010:PBI-FC-001:WtrFlowOK": {"units": null, "value": 1}, "LEBT-010:PBI-EMU-001:VerWtrFlowOK": {"units": null, "value": 1}, "LEBT-010:PBI-EMU-001:HorWtrFlowOK": {"units": null, "value": 1}, "ISrc-010:PwrC-HVIT-01:LidOpenR": {"units": null, "value": 1}, "ISrc-010:PwrC-HVIT-01:OilTempOK": {"units": null, "value": 1}, "ISrc-010:ISS-HVPS:PwrR.SEVR": {"units": null, "value": 0}, "ISrc-010:ISS-Intf-HMI:ESTOP_MEMO": {"units": null, "value": 0}, "ISrc-010:ISS-HVPS:ITLckEnCmdR": {"units": null, "value": 0}, "ISrc-010:ISS-Intf-HMI:EVENT_B_MEMO": {"units": null, "value": 1}}
\ No newline at end of file
This diff is collapsed.
Web sites/data/npm-himage.png

617 KiB

Web sites/data/npm-vimage.png

618 KiB

{
"version": 1,
"header_image": "",
"allow_edit": false,
"plugins": [],
"panes": [
{
"width": 1,
"row": {
"1": 1,
"2": 1,
"3": 1,
"4": 1
},
"col": {
"1": 1,
"2": 1,
"3": 1,
"4": 1
},
"col_width": 4,
"widgets": [
{
"type": "html",
"settings": {
"html": "return \"<div style=\\\"position: static; margin-top: -15px;\\\"><img src=\\\"../img/ess-logo.svg\\\" \\\"><div class=\\\"tw-value\\\" style=\\\"font-size: 56px; color:#ffffff !important;position: relative; bottom: 35px; left: 200px;\\\">Beam Instruments</div></img></div>\"",
"height": 2
}
}
]
},
{
"title": "Horizontal NPM",
"width": 1,
"row": {
"1": 17,
"2": 17,
"3": 17,
"4": 17,
"5": 17
},
"col": {
"1": 1,
"2": 1,
"3": 1,
"4": 1,
"5": 1
},
"col_width": 2,
"widgets": [
{
"type": "picture",
"settings": {
"src": "http://data.pos.esss.lu.se/npm-himage.png",
"refresh": 5
}
},
{
"type": "flot_extended_plugin",
"settings": {
"plot_type": "line",
"legend": true,
"height": 4,
"value": "[{label: 'Horizontal Profile', data:datasources[\"Instruments\"][\"LEBT-010:PBI-NPM-001:HCAMFITS-Y_RBV\"][\"value\"]}]",
"yticks": "[]",
"zoom": "xy"
}
}
]
},
{
"title": "Vertical NPM",
"width": 1,
"row": {
"1": 35,
"2": 35,
"3": 35,
"4": 17,
"7": 17
},
"col": {
"1": 1,
"2": 1,
"3": 1,
"4": 3,
"7": 3
},
"col_width": 2,
"widgets": [
{
"type": "picture",
"settings": {
"src": "http://data.pos.esss.lu.se/npm-vimage.png",
"refresh": 5
}
},
{
"type": "flot_extended_plugin",
"settings": {
"plot_type": "line",
"legend": true,
"height": 4,
"value": "[{label: 'Vertical Profile', data:datasources[\"Instruments\"][\"LEBT-010:PBI-NPM-002:VCAMFITS-Y_RBV\"][\"value\"]}]",
"yticks": "[]",
"zoom": "xy"
}
}
]
},
{
"title": "Beam Current",
"width": 1,
"row": {
"1": 7,
"2": 7,
"3": 7,
"4": 7,
"5": 1,
"6": 1,
"7": 1,
"8": 1
},
"col": {
"1": 1,
"2": 1,
"3": 1,
"4": 1,
"5": 3,
"6": 3,
"7": 3,
"8": 3
},
"col_width": 4,
"widgets": [
{
"type": "flot_extended_plugin",
"settings": {
"plot_type": "line",
"legend": true,
"height": 4,
"value": "[{label: 'Ion Source', data:datasources[\"Instruments\"][\"ISrc-010:PBI-BCM-001:AI4-Compressed\"][\"value\"]}, {label: 'Faraday Cup', data:datasources[\"Instruments\"][\"LEBT-020:PBI-FC-001:AMC31-AOI11-ArrayData\"][\"value\"]}, {label: 'LEBT', data:datasources[\"Instruments\"][\"LEBT-010:PBI-BCM-001:AI5-Compressed\"][\"value\"]}]",
"xticks": "",
"yticks": "",
"points": false,
"tooltip": false,
"zoom": "xy"
}
}
]
}
],
"datasources": [
{
"name": "Instruments",
"type": "JSON",
"settings": {
"url": "http://data.pos.esss.lu.se/getInstruments",
"use_thingproxy": false,
"refresh": 5,
"method": "GET"
}
}
],
"columns": 4
}
{ {
"version": 1, "version": 1,
"header_image": "", "header_image": "",
"allow_edit": false, "allow_edit": false,
"plugins": [], "plugins": [],
"panes": [ "panes": [
{ {
"title": "High Voltage Interlocks", "title": "High Voltage Interlocks",
"width": 1, "width": 1,
"row": { "row": {
"3": 1 "1": 7,
}, "2": 7,
"col": { "3": 7
"3": 2 },
}, "col": {
"col_width": 1, "1": 1,
"widgets": [ "2": 1,
{ "3": 2
"type": "indicator", },
"settings": { "col_width": 1,
"title": "Ground to HMI connection", "widgets": [
"value": "datasources[\"Public Data\"][\"ISrc-010:ISS-Intf-HMI:ComIocOK\"][\"value\"]" {
} "type": "indicator",
}, "settings": {
{ "title": "Ground to HMI connection",
"type": "indicator", "value": "datasources[\"Public Data\"][\"ISrc-010:ISS-Intf-HMI:ComIocOK\"][\"value\"]"
"settings": { }
"title": "HV Permit from PSS", },
"value": "datasources[\"Public Data\"][\"ISrc-010:ISS-Intf-PSS:HVPermitR\"][\"value\"]" {
} "type": "indicator",
}, "settings": {
{ "title": "HV Permit from PSS",
"type": "indicator", "value": "datasources[\"Public Data\"][\"ISrc-010:ISS-Intf-PSS:HVPermitR\"][\"value\"]"
"settings": { }
"title": "HV Platform Maintenance Switch", },
"value": "datasources[\"Public Data\"][\"ISrc-010:ISS-HVPf-Res:CloseR\"][\"value\"]" {
} "type": "indicator",
}, "settings": {
{ "title": "HV Platform Maintenance Switch",
"type": "indicator", "value": "datasources[\"Public Data\"][\"ISrc-010:ISS-HVPf-Res:CloseR\"][\"value\"]"
"settings": { }
"title": "HV Platform Door Status", },
"value": "datasources[\"Public Data\"][\"ISrc-010:ISS-HVPf-Doors:CloseR\"][\"value\"]" {
} "type": "indicator",
}, "settings": {
{ "title": "HV Platform Door Status",
"type": "indicator", "value": "datasources[\"Public Data\"][\"ISrc-010:ISS-HVPf-Doors:CloseR\"][\"value\"]"
"settings": { }
"title": "Vacuum Permit", },
"value": "datasources[\"Public Data\"][\"ISrc-010:ISS-Intf-Vac:VacPermit\"][\"value\"]" {
} "type": "indicator",
}, "settings": {
{ "title": "Vacuum Permit",
"type": "indicator", "value": "datasources[\"Public Data\"][\"ISrc-010:ISS-Intf-Vac:VacPermit\"][\"value\"]"
"settings": { }
"title": "FaradayCup Water Flow Status", },
"value": "datasources[\"Public Data\"][\"LEBT-010:PBI-FC-001:WtrFlowOK\"][\"value\"]" {
} "type": "indicator",
}, "settings": {
{ "title": "FaradayCup Water Flow Status",
"type": "indicator", "value": "datasources[\"Public Data\"][\"LEBT-010:PBI-FC-001:WtrFlowOK\"][\"value\"]"
"settings": { }
"title": "EMU Vertical Water Flow Status", },
"value": "datasources[\"Public Data\"][\"LEBT-010:PBI-EMU-001:VerWtrFlowOK\"][\"value\"]" {
} "type": "indicator",
}, "settings": {
{ "title": "EMU Vertical Water Flow Status",
"type": "indicator", "value": "datasources[\"Public Data\"][\"LEBT-010:PBI-EMU-001:VerWtrFlowOK\"][\"value\"]"
"settings": { }
"title": "EMU Horizontal Water Flow Status", },
"value": "datasources[\"Public Data\"][\"LEBT-010:PBI-EMU-001:HorWtrFlowOK\"][\"value\"]" {
} "type": "indicator",
}, "settings": {
{ "title": "EMU Horizontal Water Flow Status",
"type": "indicator", "value": "datasources[\"Public Data\"][\"LEBT-010:PBI-EMU-001:HorWtrFlowOK\"][\"value\"]"
"settings": { }
"title": "HV Isolation Transformer Lid Status", },
"value": "datasources[\"Public Data\"][\"ISrc-010:PwrC-HVIT-01:LidOpenR\"][\"value\"]" {
} "type": "indicator",
}, "settings": {
{ "title": "HV Isolation Transformer Lid Status",
"type": "indicator", "value": "datasources[\"Public Data\"][\"ISrc-010:PwrC-HVIT-01:LidOpenR\"][\"value\"]"
"settings": { }
"title": "HV Isolation Transformer Oil Temp", },
"value": "datasources[\"Public Data\"][\"ISrc-010:PwrC-HVIT-01:OilTempOK\"][\"value\"]" {
} "type": "indicator",
}, "settings": {
{ "title": "HV Isolation Transformer Oil Temp",
"type": "indicator", "value": "datasources[\"Public Data\"][\"ISrc-010:PwrC-HVIT-01:OilTempOK\"][\"value\"]"
"settings": { }
"title": "HVPS <-> EPICS Communication", },
"value": "!datasources[\"Public Data\"][\"ISrc-010:ISS-HVPS:PwrR.SEVR\"][\"value\"]" {
} "type": "indicator",
}, "settings": {
{ "title": "HVPS <-> EPICS Communication",
"type": "indicator", "value": "!datasources[\"Public Data\"][\"ISrc-010:ISS-HVPS:PwrR.SEVR\"][\"value\"]"
"settings": { }
"title": "HV Emergency Stop", },
"value": "!datasources[\"Public Data\"][\"ISrc-010:ISS-Intf-HMI:ESTOP_MEMO\"][\"value\"]" {
} "type": "indicator",
}, "settings": {
{ "title": "HV Emergency Stop",
"type": "indicator", "value": "!datasources[\"Public Data\"][\"ISrc-010:ISS-Intf-HMI:ESTOP_MEMO\"][\"value\"]"
"settings": { }
"title": "HV PS Interlock Cmd", },
"value": "datasources[\"Public Data\"][\"ISrc-010:ISS-HVPS:ITLckEnCmdR\"][\"value\"]" {
} "type": "indicator",
}, "settings": {
{ "title": "HV PS Interlock Cmd",
"type": "indicator", "value": "datasources[\"Public Data\"][\"ISrc-010:ISS-HVPS:ITLckEnCmdR\"][\"value\"]"
"settings": { }
"title": "High Voltage", },
"value": "!datasources[\"Public Data\"][\"ISrc-010:ISS-Intf-HMI:EVENT_B_MEMO\"][\"value\"]" {
} "type": "indicator",
} "settings": {
] "title": "High Voltage",
} "value": "!datasources[\"Public Data\"][\"ISrc-010:ISS-Intf-HMI:EVENT_B_MEMO\"][\"value\"]"
], }
"datasources": [ }
{ ]
"name": "Public Data", },
"type": "JSON", {
"settings": { "width": 1,
"url": "http://data.pos.esss.lu.se/getInterlocks", "row": {
"use_thingproxy": false, "1": 1,
"refresh": 1, "2": 1,
"method": "GET" "3": 1
} },
} "col": {
], "1": 1,
"columns": 3 "2": 1,
"3": 2
},
"col_width": 1,
"widgets": [
{
"type": "html",
"settings": {
"html": "<div style=\"position: static; margin-top: -15px;\">\n <img src=\"../img/ess-logo.svg\">\n </img>\n</div>",
"height": 2
}
}
]
}
],
"datasources": [
{
"name": "Public Data",
"type": "JSON",
"settings": {
"url": "http://data.pos.esss.lu.se/getInterlocks",
"use_thingproxy": false,
"refresh": 1,
"method": "GET"
}
}
],
"columns": 3
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment