Commit 8d77bfa6 authored by Valentin Valls's avatar Valentin Valls
Browse files

Add default plot for each standard scan commands

parent e09de67e
......@@ -399,6 +399,12 @@ def lookupscan(
counter_args,
top_master=VariableStepTriggerMaster(*motors_positions),
)
# Specify a default plot if it is not already the case
if not scan_info.has_default_curve_plot():
time_channel = chain.timer.channels[0]
scan_info.add_curve_plot(x=time_channel.fullname)
scan = Scan(
chain,
scan_info=scan_info,
......@@ -494,6 +500,11 @@ def anscan(
starts_list.append(start)
stops_list.append(stop)
# Specify a default plot if it is not already the case
if not scan_info.has_default_curve_plot():
mot = motor_tuple_list[0][0]
scan_info.add_curve_plot(x=f"axis:{mot.name}")
scan_info["start"] = starts_list
scan_info["stop"] = stops_list
......@@ -1061,6 +1072,13 @@ def timescan(
}
chain = DEFAULT_CHAIN.get(scan_params, counter_args)
# Specify a default plot if it is not already the case
if npoints > 1:
# No plots are created for ct
if not scan_info.has_default_curve_plot():
time_channel = chain.timer.channels[0]
scan_info.add_curve_plot(x=time_channel.fullname)
scan = Scan(
chain,
scan_info=scan_info,
......
......@@ -31,6 +31,10 @@ def test_ascan(session):
scan_data = s.get_data()
assert numpy.array_equal(scan_data["sim_ct_gauss"], simul_counter.data)
# A default plot is expected, displaying the motor as x-axis
plot = s.scan_info["plots"][0]
assert plot["items"][0]["x"] == "axis:robz2"
def test_loopscan_sleep_time(session):
simul_counter = session.env_dict["sim_ct_gauss"]
......@@ -44,6 +48,10 @@ def test_loopscan_sleep_time(session):
s.run()
assert timer_sleep.call_count == 1
# A default plot is expected, displaying the time as x-axis
plot = s.scan_info["plots"][0]
assert plot["items"][0]["x"] == "timer:elapsed_time"
def test_ascan_gauss2(session):
robz2 = session.env_dict["robz2"]
......@@ -200,6 +208,10 @@ def test_lookupscan(session):
assert numpy.array_equal(scan_data["roby"], (0, 0.1))
assert numpy.array_equal(scan_data["robz"], (0.1, 0.2))
# A default plot is expected, displaying the time as x-axis
plot = s.scan_info["plots"][0]
assert plot["items"][0]["x"] == "timer:elapsed_time"
def test_anscan(session):
roby = session.env_dict["roby"]
......
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