Skip to content

Draft: Improve counters metadata

Closes #2761

Closes #2753 (closed)

This MR improve rework counter metadata in order to clean up and published useful information.

  • Counter.get_metadata was reworked to only return it's own meta.
    • This could break stuffs on external code
  • Counter controller acq obj is responsible of storing this counter meta inside a key counters
  • Lima ROI counter tells which ROI is used
  • Lima ROI controller acq obj is responsible of storing ROI geometry in a key rois
  • Bonus: sampling counter exposes mode

Here is the result in the scan_info, but the result is the same with node.info

ct(lima_simulator, diode1)

----------------------------------

devices: {
    "00001:simulation_diode_sampling_controller": {
        "channels": ["simulation_diode_sampling_controller:diode1"],
        "counters": {
            "diode1": {
                "type": "sampling",
                "mode": "MEAN",
            }
        },
    },
    "00002:roi_counters": {
        "channels": [
            "lima_simulator:roi_counters:roi1_sum",
            "lima_simulator:roi_counters:roi1_avg",
            "lima_simulator:roi_counters:roi1_std",
            "lima_simulator:roi_counters:roi1_min",
            "lima_simulator:roi_counters:roi1_max",
            "lima_simulator:roi_counters:roi2_sum",
            "lima_simulator:roi_counters:roi2_avg",
            "lima_simulator:roi_counters:roi2_std",
            "lima_simulator:roi_counters:roi2_min",
            "lima_simulator:roi_counters:roi2_max",
        ],
        "counters": {
            "roi1_avg": {"roi_name": "roi1"},
            "roi1_max": {"roi_name": "roi1"},
            "roi1_min": {"roi_name": "roi1"},
            "roi1_std": {"roi_name": "roi1"},
            "roi1_sum": {"roi_name": "roi1"},
            "roi2_avg": {"roi_name": "roi2"},
            "roi2_max": {"roi_name": "roi2"},
            "roi2_min": {"roi_name": "roi2"},
            "roi2_std": {"roi_name": "roi2"},
            "roi2_sum": {"roi_name": "roi2"},
        },
        "rois": {
            "roi1": {
                "kind": "rect",
                "x": 416,
                "y": 115},
                "width": 289,
                "height": 173,
            "roi2": {
                "kind": "arc",
                "a1": -166.08059758339485,
                "a2": -294.64822812476297,
                "cx": 354.47248597999,
                "cy": 455.8966464294477,
                "r1": 163.00360111283288,
                "r2": 234.6587341440079,
            },
        },
    },
}

Comment

  • To me, specifying ROI names per counters is overkill ({"roi1_avg": {"roi_name": "roi1"},), but it's just an example. THis counters could returns no metadata
  • counter metadata should be stored in channel, but for now, as there is no 1to1 channel/counter i think it is not a good idea

Todo

  • Rebase on top of !3706 (merged)
  • Create a dedicated dict for counters
  • Create a dedicated dict for rois
  • Provide info for sampling counters
  • Update Flint
  • Update the HDF5 writer
  • Update scan_info documentation
  • Optionally add unittest on watcher tests
  • Update changelog
  • Add TODO message on method generating scan_info/rois (this method can be removed in 1.9)
Edited by Valentin Valls

Merge request reports

Loading