Commit 59e1388c authored by Cyril Guilloud's avatar Cyril Guilloud
Browse files

Added counters list to lima_bpm in order to know what user can count on.

+ doc
parent 14ed0b1b
Pipeline #20329 failed with stages
in 33 minutes and 24 seconds
......@@ -8,6 +8,8 @@
import importlib
import os
import enum
import numpy as np
from tabulate import tabulate
from bliss import global_map
from bliss.common.utils import common_prefix, autocomplete_property
......@@ -581,14 +583,72 @@ class Lima(CounterController):
self.name, self._proxy.dev_name()
)
return (
info_str = (
f"{data['user_detector_name']} - "
f"{data['camera_model']} ({data['camera_type']}) - Lima {data['lima_type']}\n\n"
f"Image:\n{self.image.__info__()}\n\n"
f"Acquisition:\n{self.acquisition.__info__()}\n\n"
f"ROI Counters:\n{self.roi_counters.__info__()}"
f"ROI Counters:\n{self.roi_counters.__info__()}\n"
)
info_str += "\nBPM COUNTERS:\n"
info_str += self.counters_info()
return info_str
def counters_info(self):
"""
Return a string of info about BPM counters (name, shape, type).
"""
# HEADER
table_header = ("name", "shape", "type")
table = list()
for cnt in self.counters:
try:
type_str = self.dtype_to_str(cnt.type)
except:
try:
type_str = self.dtype_to_str(cnt.dtype)
except:
type_str = "Unknown"
table.append((cnt.name, self.shape_to_str(cnt.shape), type_str))
info_str = tabulate(
tuple(table), numalign="right", headers=table_header
) # , tablefmt="plain")
info_str_shifted = ""
for line in info_str.split("\n"):
info_str_shifted += " " + line + "\n"
return info_str_shifted
def shape_to_str(self, data_shape):
"""
Return numpy-like data shape as a human readable string.
"""
if data_shape == (0, 0):
return "2d"
elif data_shape == (0):
return "1d"
elif data_shape == ():
return "0d"
else:
return "unknown shape"
def dtype_to_str(self, data_type):
"""
Return data type as a human readable string.
"""
if data_type == np.float:
return "float"
elif data_type == np.float64:
return "float64"
elif data_type == np.int:
return "int"
else:
return f"{data_type}"
def __repr__(self):
attr_list = ("user_detector_name", "lima_type")
try:
......
......@@ -113,14 +113,9 @@ name: lima_bv1
plugin: bliss
class: Lima
tango_url: id42/limaccds/bv1
bpmnames:
- x: bv1_x
- y: bv1_y
- fwhm_x: bv1_fx
- fwhm_y: bv1_fy
- intensity: bv1_i
```
!!! note
In case counter names are not appropriate, they can be changed using aliases.
The BPM counters are now available:
......@@ -140,4 +135,45 @@ SESSION_SXM [3]: ct(0.1, lima_bv1.counters)
path=/data/id42/inhouse/session_sxm/data3.null)
```
Inline info of lima bpm prints info about:
* the associated camera
* BPM counters available
```python
DEMO [1]: lima_bv1
Out [1]: Basler - acA1300-30gm (Basler) - Lima Basler
Image:
bin = [1 1]
flip = [False False]
height = 966
roi = <0,0> <1296 x 966>
rotation = rotation_enum.NONE
sizes = [ 0 2 1296 966]
type = Bpp12
width = 1296
Acquisition:
expo_time = 0.1
mode = mode_enum.SINGLE
nb_frames = 1
status = Ready
status_fault_error = No error
trigger_mode = trigger_mode_enum.INTERNAL_TRIGGER_MULTI
ROI Counters:
[default]
*** no ROIs defined ***
COUNTERS:
name shape type
--------- ------- ------------
image 2d unknown type
acq_time 0d float
intensity 0d float
x 0d float
y 0d float
fwhm_x 0d float
fwhm_y 0d float
```
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment