Commit 585b941a authored by Perceval Guillou's avatar Perceval Guillou
Browse files

add doc

parent 77de1796
Pipeline #24001 passed with stages
in 47 minutes and 13 seconds
......@@ -1205,7 +1205,8 @@ def get_plot(
print("Argument plot_type uses an invalid value: '%s'." % plot_type)
#==== TOOLS FOR LIVE PLOTS ===============================================================
# ==== TOOLS FOR LIVE PLOTS ===============================================================
class LiveImagePlot:
""" Use Flint to display Images (Live and snapshot) """
......
......@@ -377,26 +377,6 @@ class BpmController(SamplingCounterController):
# def acq_time(self):
# return self._counters["acq_time"]
@property
def x(self):
return self._counters["x"]
@property
def y(self):
return self._counters["y"]
@property
def intensity(self):
return self._counters["intensity"]
@property
def fwhm_x(self):
return self._counters["fwhm_x"]
@property
def fwhm_y(self):
return self._counters["fwhm_y"]
# --------- EBV CONTROLLER ----------------------------
class EBV:
......@@ -419,6 +399,16 @@ class EBV:
EBVDiodeRange([False, False, False, False], "10nA", 1E5),
]
_MISSING_BPM_MSG = (
"\n================= No bpm attached ! ========================\n"
)
_MISSING_BPM_MSG += (
"Add the 'camera_tango_url' key in the EBV configuration file \n"
)
_MISSING_BPM_MSG += (
"Example in 'ebv.yml': 'camera_tango_url: id00/limaccds/simulator1' \n"
)
def __init__(self, name, config_node):
self.name = name
# --- config parsing
......@@ -475,6 +465,7 @@ class EBV:
)
# --- bpm counters controller
if self._cam_tango_url:
self._bpm = BpmController(
self.name, self._cam_tango_url, register_counters=False
......@@ -617,15 +608,9 @@ class EBV:
@autocomplete_property
def bpm(self):
if self._cam_tango_url:
return self._bpm
else:
msg = "================= No bpm attached ! ========================\n"
msg += "Add the 'camera_tango_url' key in the EBV configuration file \n"
msg += (
"Example in 'ebv.yml': 'camera_tango_url: id00/limaccds/simulator1' \n"
)
return msg
if not self._cam_tango_url:
raise AttributeError(self._MISSING_BPM_MSG)
return self._bpm
@property
def show_beam(self):
......@@ -640,6 +625,36 @@ class EBV:
def diode(self):
return self._diode_counter
@property
def x(self):
if not self._cam_tango_url:
raise AttributeError(self._MISSING_BPM_MSG)
return self._bpm._counters["x"]
@property
def y(self):
if not self._cam_tango_url:
raise AttributeError(self._MISSING_BPM_MSG)
return self._bpm._counters["y"]
@property
def intensity(self):
if not self._cam_tango_url:
raise AttributeError(self._MISSING_BPM_MSG)
return self._bpm._counters["intensity"]
@property
def fwhm_x(self):
if not self._cam_tango_url:
raise AttributeError(self._MISSING_BPM_MSG)
return self._bpm._counters["fwhm_x"]
@property
def fwhm_y(self):
if not self._cam_tango_url:
raise AttributeError(self._MISSING_BPM_MSG)
return self._bpm._counters["fwhm_y"]
@property
def screen_status(self):
self.__update_state()
......
......@@ -31,11 +31,7 @@ Usage of an EBV is described here: [Beamviewer Usage](using_beamviewer.md).
## Control
Control is implemented using 2 bliss objects:
* **EBV** bliss object controls the wago box (screen, led, foil, diode)
* **LIMA** bliss object controls the basler camera and the associated BPM
counters computed on images
The **EBV** bliss object controls the wago box (screen, led, foil, diode), the basler camera and the associated BPM counters computed on images.
## Wagobox modules
......@@ -64,19 +60,25 @@ are added:
#### Configuration example
```
plugin: bliss (mandatory)
name: mywbv (mandatory)
name: myebv (mandatory)
class: EBV (mandatory)
modbustcp: (mandatory)
url: wcidxxa (mandatory)
single_model: False
has_foil: False
channel: 0
counter_name: mydiode
counter_name: mydiode
tango_url: idxx/limaccds/bv1
```
`modbustcp / url` defines the wago control box host as in standard wago
controller.
`tango_url` defines the `limaccds` Tango device server of associated Basler camera.
#### Configuration optionnal parameters
* `single_model`
......@@ -98,82 +100,51 @@ controller.
- default value : `diode`
- counter name of diode current reading when EBV is used in counts/scans
* `tango_url`
- default value : `None`
- if provided, the EBV will be extended with the BPM powers (Bpm measurements and BeamViewer Live display)
## EBV and BPM counters
## Lima BPM counters
The BPM counter controller is accessible via the EBV object in Bliss.
Recent Lima (⩾ 1.9.2) has a built-in BPM device server (no need for an extra
Tango server).
```python
BLISS [51]: myebv.bpm
Out [51]: Bpm [id00/limaccds/simulator2]
The BPM counter controller is integrated in BLISS as a Lima object.
exposure : 1.0 s
size : [1024, 1024]
binning : [1, 1]
roi : [0, 0, 1024, 1024]
flip : [False, False]
rotation : NONE
```
Example of configuration:
```yaml
name: lima_bv1
plugin: bliss
class: Lima
tango_url: id42/limaccds/bv1
The EBV owns all BPM counters and the diode counter.
```
!!! note
In case counter names are not appropriate, they can be changed using aliases.
BLISS [51]: ct(1, myebv)
Tue Mar 31 16:43:52 2020
acq_time = 1.038032054901123 ( 1.038032054901123/s)
fwhm_x = 99.04761904761904 ( 99.04761904761904/s)
fwhm_y = 99.04761904761904 ( 99.04761904761904/s)
intensity = 99.2 ( 99.2/s)
x = 512.0 ( 512.0/s)
y = 512.0 ( 512.0/s)
ebv_diode = -0.15674306466872268 (-0.15674306466872268/s)
The BPM counters are now available:
```python
SESSION_SXM [3]: ct(0.1, lima_bv1.counters)
Activated counters not shown: image
Wed Dec 04 17:04:18 2019
acq_time = 0.13225 ( 1.3225/s)
fwhm_x = 0.0
fwhm_y = 31.8288 ( 318.2882/s)
intensity = 26.8 ( 268.0/s)
x = -1.0 ( -10.0/s)
y = 920.2379 ( 9202.3790/s)
Out [3]: Scan(number=67, name=ct,
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
At the BPM level some camera parameters can be modified:
* `myebv.bpm.exposure`
* `myebv.bpm.bin`
* `myebv.bpm.roi`
* `myebv.bpm.flip`
* `myebv.bpm.rotation`
more here: [Beamviewer Usage](using_beamviewer.md)
\ No newline at end of file
......@@ -7,14 +7,24 @@ here: [ESRF BeamViewer Configuration](config_beamviewer.md).
### Global status
```
BLISS [16]: ebv
Out [16]: EBV [myebv] (wago: wcid15ab)
screen : OUT
led : OFF
BLISS [16]: myebv
Out [16]: EBV [myebv] Wago(wcid21bv1)
screen : IN
led : ON
foil : NONE
diode range : 10uA
diode current : 0 mA
diode range : 1mA
diode current : -0.351451 mA
Bpm [id21/limaccds/bv1]
exposure : 1.0 s
size : [1024, 1024]
binning : [1, 1]
roi : [0, 0, 1024, 1024]
flip : [False, False]
rotation : NONE
```
### SCREEN control
```
BLISS [12]: myebv.screen_in()
......@@ -110,18 +120,72 @@ BLISS [50]: myebv.diode_gain
Out [50]: 1000.0
```
## Diode as a counter
### Bpm measurements reading
Measure and return data (timestamp, intensity, center_x, center_y, fwhm_x, fwhm_y)
```python
BLISS [53]: myebv.bpm.raw_read()
Out [53]: [array([1.0819428]), array([99.2]), array([512.]), array([512.]), array([99.04761905]), array([99.04761905])]
```
## EBV counters
The EBV has 6 sampling counters (1 for the diode and 5 for the Bpm measurements):
- myebv.diode
- myebv.x
- myebv.y
- myebv.fwhm_x
- myebv.fwhm_y
- myebv.intensity
`myebv` holds all 6 counters wheras `myebv.diode` returns only the diode counter.
The Bpm measurements will be performed using the current CCD exposure and image parameters (bin, roi, flip, rotation).
The camera trigger mode is forced to `INTERNAL_TRIGGER` and camera mode to `SINGLE`.
If the scan count_time is longer than the ccd exposure the Bpm measurements are sampled as many time as possible.
Note: the default counter name for the diode is *diode* but it can be changed in the configuration file.
The diode reading can be used as a sampling counter.
```
BLISS [51]: ct(.1, myebv)
Tue Oct 22 18:17:36 2019
BLISS [51]: ct(1, myebv)
Tue Mar 31 16:43:52 2020
acq_time = 1.038032054901123 ( 1.038032054901123/s)
fwhm_x = 99.04761904761904 ( 99.04761904761904/s)
fwhm_y = 99.04761904761904 ( 99.04761904761904/s)
intensity = 99.2 ( 99.2/s)
x = 512.0 ( 512.0/s)
y = 512.0 ( 512.0/s)
ebv_diode = -0.15674306466872268 (-0.15674306466872268/s)
BLISS [52]: ct(1, myebv.diode)
Tue Mar 31 16:54:15 2020
diode = -2.44140625e-07 (-2.44140625e-06/s)
ebv_diode = -0.1567430646687215 (-0.1567430646687215/s)
```
Default counter name is *diode* but can be changed in configuration.
Counter object is accessible though `myebv.diode`.
So either `myebv` or `myebv.diode` can be added to measurement group (ebv hold only one sampling counter).
## EBV Beamviewer
The command `myebv.show_beam` will start/raise Flint and display a live preview from the EBV camera.
To stop the live, just close the tab in Flint.
If a scan is started, the live is automatically stopped first.
A single snapshot can be performed with the command `myebv.bpm.snap()`
Some parameters of the underlying camera can be read or write:
* `myebv.bpm.exposure` or `myebv.bpm.exposure = 0.01` (sec)
* `myebv.bpm.bin` or `myebv.bpm.bin = [2,2]` (xbin, ybin)
* `myebv.bpm.roi` or `myebv.bpm.roi = [100,200,300,300]` (xpos, ypos, width, height)
* `myebv.bpm.flip` or `myebv.bpm.flip = [True, False]` (LR, TB)
* `myebv.bpm.rotation` or `myebv.bpm.rotation = 'NONE'` in ['None', '90', '180', '270']
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