Commit b32b0eaa authored by Valentin Valls's avatar Valentin Valls
Browse files

Create a pplot standard command to print curve/lima plot into the logbook

parent 0ff73c6c
...@@ -49,6 +49,7 @@ from bliss.common.standard import ( # noqa ...@@ -49,6 +49,7 @@ from bliss.common.standard import ( # noqa
) )
from bliss.common.standard import wid as std_wid from bliss.common.standard import wid as std_wid
from bliss.common.event import connect from bliss.common.event import connect
from bliss.controllers.mca.base import BaseMCA
from bliss.controllers.lima.limatools import * from bliss.controllers.lima.limatools import *
from bliss.controllers.lima import limatools from bliss.controllers.lima import limatools
from bliss.controllers.lima import roi as lima_roi from bliss.controllers.lima import roi as lima_roi
...@@ -198,7 +199,7 @@ __all__ = ( ...@@ -198,7 +199,7 @@ __all__ = (
"tw", "tw",
] ]
+ scans.__all__ + scans.__all__
+ ["lprint", "ladd", "elog_print", "elog_add"] + ["lprint", "ladd", "elog_print", "elog_add", "elog_plot"]
+ [ + [
"cleanup", "cleanup",
"error_cleanup", "error_cleanup",
...@@ -1534,6 +1535,35 @@ def elog_add(index=-1): ...@@ -1534,6 +1535,35 @@ def elog_add(index=-1):
logtools.elogbook.comment(comment) logtools.elogbook.comment(comment)
@typeguard.typechecked
def elog_plot(controller=None):
"""Export the actual curve plot to the logbook
Arguments:
controller: If specified, a Lima or MCA controller can be specified
to export the relative specific plot
"""
flint = plot_module.get_flint(creation_allowed=False, mandatory=False)
if flint is None:
print("Flint is not available or not reachable")
return
flint.wait_end_of_scans()
if controller is None:
p = flint.get_live_plot(kind="curve")
elif isinstance(controller, Lima):
p = flint.get_live_plot(image_detector=controller.name)
elif isinstance(controller, BaseMCA):
p = flint.get_live_plot(mca_detector=controller.name)
else:
raise RuntimeError(
"Reaching plot from controller type {type(controller)} is not supported"
)
try:
p.export_to_logbook()
except RuntimeError as e:
print(e.args[0])
@logtools.elogbook.disable_command_logging @logtools.elogbook.disable_command_logging
def lprint(*args, **kw): def lprint(*args, **kw):
elog_print(*args, **kw) elog_print(*args, **kw)
......
Markdown is supported
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