Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DoNd register parameters #197

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions qdev_wrappers/dataset/doNd.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ def do1d(
enter_actions: ActionsT = (),
exit_actions: ActionsT = (),
write_period: Optional[float] = None,
register_params: Optional[_BaseParameter] = None,
do_plot: bool = True
) -> AxesTupleListWithRunId:
"""
Expand All @@ -141,15 +142,21 @@ def do1d(
called before the measurements start
exit_actions: A list of functions taking no arguments that will be
called after the measurements ends
register_params: A list of setpoint parameters to be registered in the
measurement but not scanned.
do_plot: should png and pdf versions of the images be saved after the
run.

Returns:
The run_id of the DataSet created
"""
meas = Measurement()
_register_parameters(meas, (param_set,))
_register_parameters(meas, param_meas, setpoints=(param_set,))
if register_params is None:
register_params = tuple()
setpoint_params = (param_set,) + tuple(register_params)
_register_parameters(meas, setpoint_params)
_register_parameters(meas, param_meas, setpoints=setpoint_params)
params_to_measure = param_meas + tuple(register_params)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@emartinez Could you elaborate the reasoning to add register_params as both set points and also parameters to be measured? Are there any down falls of this approach? Do we have any performance degradation?

_set_write_period(meas, write_period)
_register_actions(meas, enter_actions, exit_actions)
param_set.post_delay = delay
Expand All @@ -161,7 +168,7 @@ def do1d(
for set_point in np.linspace(start, stop, num_points):
param_set.set(set_point)
datasaver.add_result((param_set, set_point),
*_process_params_meas(param_meas))
*_process_params_meas(params_to_measure))
return _handle_plotting(datasaver, do_plot, interrupted())


Expand All @@ -178,6 +185,7 @@ def do2d(
after_inner_actions: ActionsT = (),
write_period: Optional[float] = None,
flush_columns: bool = False,
register_params: Optional[_BaseParameter] = None,
do_plot: bool=True
) -> AxesTupleListWithRunId:

Expand Down Expand Up @@ -209,6 +217,8 @@ def do2d(
called after the measurements ends
before_inner_actions: Actions executed before each run of the inner loop
after_inner_actions: Actions executed after each run of the inner loop
register_params: A list of setpoint parameters to be registered in the
measurement but not scanned.
do_plot: should png and pdf versions of the images be saved after the
run.

Expand All @@ -217,8 +227,12 @@ def do2d(
"""

meas = Measurement()
_register_parameters(meas, (param_set1, param_set2))
_register_parameters(meas, param_meas, setpoints=(param_set1, param_set2))
if register_params is None:
register_params = tuple()
setpoint_params = (param_set1, param_set2,) + tuple(register_params)
_register_parameters(meas, setpoint_params)
_register_parameters(meas, param_meas, setpoints=setpoint_params)
params_to_measure = param_meas + tuple(register_params)
_set_write_period(meas, write_period)
_register_actions(meas, enter_actions, exit_actions)

Expand All @@ -242,7 +256,7 @@ def do2d(

datasaver.add_result((param_set1, set_point1),
(param_set2, set_point2),
*_process_params_meas(param_meas))
*_process_params_meas(params_to_measure))
for action in after_inner_actions:
action()
if flush_columns:
Expand Down