1
How To other
Sven Augustin edited this page 2025-06-12 15:34:08 +02:00

GrumPy

grum.py is a python library to visualize data live (beta version). Check it here: https://gitlab.psi.ch/augustin_s/grum

To run it open terminal and type /sf/eido/bin/grum run and a window as the following appears:

To get familiar with the tool you can type /sf/eido/bin/grum -e and it will open a example window.

To visualize the response of any sensor during a scan:

  1. Define a sensor in slic: Open terminal and run slic. Then:

from slic.core.sensor import PVSensor, BSSensor

s = PVSensor("SOME-INTENSITY:FOR-EXAMPLE")

  1. Do a scan. Example:

scan.scan1D(dummy, 0, 100, 1, 1000, "name", sensor = s)

  1. Define a function to be applied to the selected channel (for now in the terminal):

def function_name(x):

return np.function(x)

and then:

s = PVSensor("SOME-INTENSITY:FOR-EXAMPLE", aggregation = function_name)

  1. To combine the info from more than 2 channels, check this: https://gitlab.psi.ch/slic/slic/-/blob/master/slic/core/sensor/combined.py

Example:

In [48]: from slic.core.sensor import PVSensor
    ...: from slic.core.sensor.conbini import Conbini
    ...: 
    ...: s1 = PVSensor("MTEST:COUNTER1", name="sin")
    ...: s2 = PVSensor("MTEST:COUNTER2", name="cos")
    ...: 
    ...: def f(x, y):
    ...:     return x**2 + y**2
    ...: 
    ...: c = Conbini("C", (s1, s2), f)
    ...: 
    ...: s1.get_current_value(), s2.get_current_value(), c.get_current_value()
Out[48]: (-0.6099393315992064, -0.7924481129817355, 1.0)

  1. To define some functions to be easily called for grum.py we have a script sensors4grum.py in ~/git/maloja/sensors (some examples already defined there). Then in the terminal you load the file:

cd ~/git/maloja/sensors from sensors4grum import s1

And then you can simply apply it, e.g. : scan.scan1D(dummy, 0, 100, 1, n_pulses = 1, filename = "test2", sensor=s1)

Some useful script in https://gitlab.psi.ch/slic/slic/-/tree/master/slic/core/sensor

Notes of Linux for dummies:

  • s1.get() or s1.get_current_value() would give you the current value
  • You can define simple functions to tbe applied to simple sensors doing: s1.aggregation=np.max
  • exec(open('sensors4grum.py').read())

To start and stop a continuous acquisition

In ~git/slic/slic/core/sensor there is:

class Monitor(name, sensor, record_time, grum_client, cfg=None, silent=False)

To run a continuous monitoring of the defined channel. To run it as example:

from slic.core.sensor.monitor import Monitor
m=Monitor("name", s1, 2, scan.remote_plot, silent=True)

This will run grum.py for the sensor s1, grouping data for 2 seconds, and not printing the acquision (highly advisable)the To start it and stop it: m.start() and m.stop(). Right now Example:

In [1]: from slic.core.sensor.monitor import Monitor

In [2]: from slic.core.sensor.combined import Combined

In [3]: from slic.core.sensor import PVSensor, BSSensor

In [4]: import numpy as np

In [5]: pe = PVSensor("SATFE10-PEPG046-EVR0:CALCI", name="pe")

In [6]: trans = PVSensor("SATFE10-OGAT053:transmission", name="trans")

In [7]: rolf = PVSensor("SATFE10-OATT065:pulseenergy", name="rolf")

In [8]: def NormPulseEnergy(v1, v2):
   ...:     return np.mean(v1*v2)
   ...: 

In [9]: NormPE= Combined("NormPeE", (pe, trans), NormPulseEnergy)

In [10]: m=Monitor("EnergyScan_NoTilt_1", NormPE, 5, scan.remote_plot, silent=True)

In [12]: r=Monitor("rolf_EnergyScan_NoTilt_1", rolf, 5, scan.remote_plot, silent=True)

In [13]: r.start()

In [14]: m.start()

Open and create custom screen panels

To open a prepared panel open a terminal and type:

caqtdm /photonics/home/gac-maloja/caqtdm_test/panel_name.ui

Note the space after caqtdm.

There is already a prepared panel for the gige cameras:

caqtdm /photonics/home/gac-maloja/caqtdm_test/camera_generic.ui

To edit a panel you need to open caqtdm_designer:

caqtdm_designer /photonics/home/gac-maloja/caqtdm_test/panel_name.ui

To create a new panels the easiest is to start from a copy of the test file:

  1. Go the to directory cd /photonics/home/gac-maloja/caqtdm_test/

  2. Copy and name the new file cp test_0.ui new_name.ui

  3. Go back to the main directory cd and type caqtdm_designer /photonics/home/gac-maloja/caqtdm_test/new_name.ui to open it.

Other useful staff

  • To acquire data slic / daq there are things is daq.*

  • To run scans: slic / scan there are things is scan.* e.g. 1D 2D

  • conda activate mdaq ~/checks/checks.py

  • other option is to use gui -> slic / gui()

you can have a look a the variables just typing them exp_delay to add a new channel name= name("real channel name") and then you can do name.set (use tab) HOME / neat neat = slic / gui()

  • To see available channels starting with some name: bs avail name

e.g. bs avail SATES

SATES20-CVME-EVR0:CALCI

SATES20-CVME-EVR0:CALCS

SATES20-CVME-EVR0:CALCX

SATES20-CVME-EVR0:CALCY

...

  • To see where the channels are being recorded (computer) and other details: ioc records name.*

e.g. ioc records SATES.*

SATES20-XSMA165:MOT11:SET_ANG_ABSPOS calcout Reset rotational pos SATES20-CMOV-SMA5 maloja
SATES20-XSMA165:MOT11:SET_ANG_START1 calcout change value not actual pos SATES20-CMOV-SMA5 maloja
SATES20-XSMA165:MOT11:SET_LAST_SET calcout Hold the last position SATES20-CMOV-SMA5 maloja
SATES20-XSMA165:MOT11:SET_NONE_ABSPOS2 calcout Non sensor move SATES20-CMOV-SMA5 maloja

...

  • To read channel values (live): bs receive ChannelName

e.g. bs receive SATES30-LSCP10:CH0:1

Website to see the evolution of any channel as a function of time:

https://data-ui.psi.ch/

Archiver:

https://archiver.psi.ch/

Electronic Logbook of Maloja:

https://elog-gfa.psi.ch/Maloja/?rsort=When

Official PSI Labbooks for all your proposals and experiments (beta version):

https://scilog.psi.ch/login

Archive for data:

https://discovery.psi.ch/

To visualize some interesting data:

https://hpc-monitor02.psi.ch (a grafana website https://grafana.com/) then SwissFEL DAQ and then select the systems (e.g. the JF is now in sf-daq-9.psi.ch)

To see the storage space for data:

https://hpc-monitor02.psi.ch/d/EXWWu8Piz/aramis-athos-lenovo-users?orgId=1&var-fs_small=raw&var-pgroup=p20560&var-bl=bernina&var-exp=Athos&var-bl2=maloja&var-all_bl=maloja%7Cfurka

Where you are now!

https://gitlab.psi.ch/maloja/docs/-/wikis/home

To follow the load on the camera server

You can find it going to:

https://archiver.psi.ch/ Configuration→User configuration repositories → sf_imagebuffer https://git.psi.ch/archiver_config/sf_imagebuffer → operation_tools https://git.psi.ch/archiver_config/sf_imagebuffer/-/tree/master/operation-tools →Checks https://hpc-monitor02.psi.ch/d/TW0pr_bik/camera-servers?refresh=30s&orgId=1&var-host=sf-daq-14.psi.ch&var-host=sf-daq-15.psi.ch

Log it with your psi credentials and open CPU https://hpc-monitor02.psi.ch/d/TW0pr_bik/camera-servers?refresh=30s&orgId=1&var-host=sf-daq-14.psi.ch&var-host=sf-daq-15.psi.ch