Commit 7d0daabe authored by Valentin Valls's avatar Valentin Valls
Browse files

If `plots` is specified, curve and scatter plots are not inferred anymore

parent aa2c36c8
......@@ -650,8 +650,15 @@ def create_plot_model(
) -> List[plot_model.Plot]:
"""Create plot models from a scan_info.
Use the `plots` description or infer the plots from the `acquisition_chain`.
Finally update the selection using `_display_extra`.
If a `plots` key exists from the `scan_info`, scatter and curve plots will
created following this description. Else, plots will be inferred from the
acquisition chain.
Finally the selection is updated using `_display_extra` field. This should
be removed a one point.
Special kind of plots depending on devices and data kind, like Lima, MCAs
and 1D data will always be inferred.
"""
if scan is None:
scan = create_scan_model(scan_info)
......@@ -670,6 +677,11 @@ def create_plot_model(
aq_plots = infer_plot_models(scan)
for plot in aq_plots:
if isinstance(
plot, (plot_item_model.CurvePlot, plot_item_model.ScatterPlot)
):
# This kind of plots are already constrained by the `plots` key
continue
if not contains_default_plot_kind(plots, plot):
plots.append(plot)
else:
......
......@@ -237,6 +237,22 @@ def test_create_curve_plot_from_motor_scan():
assert set(expected_curves) == set(curves)
def test_create_scan__no_plots():
factory = ScanInfoFactory()
factory.add_device(root_id="axis", device_id="axis")
factory.add_device(root_id="axis", device_id="timer", triggered_by="axis")
factory.add_device(root_id="axis", device_id="diode", triggered_by="axis")
factory.add_channel(channel_id="axis:roby", dim=0)
factory.add_channel(channel_id="timer:elapsed_time", dim=0, unit="s")
factory.add_channel(channel_id="diode:diode", dim=0)
factory.add_channel(channel_id="diode:diode2", dim=0)
scan_info = factory.scan_info()
scan_info["plots"] = {}
plots = scan_info_helper.create_plot_model(scan_info)
assert len(plots) == 0
def test_amesh_scan_with_image_and_mca():
factory = ScanInfoFactory()
factory["data_dim"] = 2
......@@ -274,7 +290,6 @@ def test_amesh_scan_with_image_and_mca():
assert set(result_kinds) == set(
[
plot_item_model.ScatterPlot,
plot_item_model.CurvePlot,
plot_item_model.ImagePlot,
plot_item_model.McaPlot,
]
......
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