Skip to content

Commit

Permalink
added readout amplitude
Browse files Browse the repository at this point in the history
  • Loading branch information
nulinspiratie committed Dec 4, 2024
1 parent 303e46b commit 492a85d
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import dash_bootstrap_components as dbc

from qualang_tools.control_panel.video_mode.sweep_axis import SweepAxis
from qualang_tools.control_panel.video_mode.dash_tools import create_axis_layout
from qualang_tools.control_panel.video_mode.dash_tools import create_axis_layout, create_input_field
from qualang_tools.control_panel.video_mode.dash_tools import BaseDashComponent, ModifiedFlags


Expand Down Expand Up @@ -136,13 +136,24 @@ def get_dash_components(self, include_subcomponents: bool = True) -> List[html.D
className="g-0",
), # g-0 removes gutters between columns
]
)
),
create_input_field(
id={"type": self.component_id, "index": "num-averages"},
label="Averages",
value=self.num_averages,
min=1,
step=1,
debounce=True,
),
]

def update_parameters(self, parameters: Dict[str, Dict[str, Any]]) -> ModifiedFlags:
"""Update the data acquirer's attributes based on the input values."""
params = parameters[self.component_id]
flags = ModifiedFlags.NONE
if self.num_averages != params["num-averages"]:
self.num_averages = params["num-averages"]
flags |= ModifiedFlags.PARAMETERS_MODIFIED
if self.x_axis.span != params["x-span"]:
self.x_axis.span = params["x-span"]
flags |= ModifiedFlags.PARAMETERS_MODIFIED
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,9 @@ def update_parameters(self, parameters: Dict[str, Dict[str, Any]]) -> ModifiedFl
flags |= self.scan_mode.update_parameters(parameters)
flags |= self.qua_inner_loop_action.update_parameters(parameters)

if flags & ModifiedFlags.PARAMETERS_MODIFIED:
self.data_history.clear()

if flags & ModifiedFlags.CONFIG_MODIFIED:
self.generate_config()

Expand Down
12 changes: 12 additions & 0 deletions qualang_tools/control_panel/video_mode/inner_loop_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,12 @@ def get_dash_components(self, include_subcomponents: bool = True) -> List[html.D
value=self.readout_pulse.length,
units="ns",
),
create_input_field(
id={"type": self.component_id, "index": "readout_amplitude"},
label="Readout amplitude",
value=self.readout_pulse.amplitude,
units="V",
),
]
)
)
Expand Down Expand Up @@ -240,4 +246,10 @@ def update_parameters(self, parameters: Dict[str, Dict[str, Any]]) -> ModifiedFl
flags |= ModifiedFlags.PROGRAM_MODIFIED
flags |= ModifiedFlags.CONFIG_MODIFIED

if self.readout_pulse.amplitude != params["readout_amplitude"]:
self.readout_pulse.amplitude = params["readout_amplitude"]
flags |= ModifiedFlags.PARAMETERS_MODIFIED
flags |= ModifiedFlags.PROGRAM_MODIFIED
flags |= ModifiedFlags.CONFIG_MODIFIED

return flags
15 changes: 1 addition & 14 deletions qualang_tools/control_panel/video_mode/video_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,6 @@ def create_layout(self):
],
className="mb-4",
),
create_input_field(
"num-averages",
"Averages",
self.data_acquirer.num_averages,
min=1,
step=1,
debounce=True,
),
html.Div(self.data_acquirer.get_dash_components(include_subcomponents=True)),
dbc.Row(
[
Expand Down Expand Up @@ -152,11 +144,6 @@ def create_layout(self):
logging.debug(f"Dash layout created, update interval: {self.update_interval*1000} ms")
self.add_callbacks()

def clear_data(self):
"""Clears data history and resets averages."""
self.data_acquirer.data_history.clear()
logging.debug("Cleared all averages and data history.")

def add_callbacks(self):
@self.app.callback(
Output("pause-button", "children"),
Expand Down Expand Up @@ -204,7 +191,7 @@ def update_heatmap(n_intervals):
component_states,
blocking=True,
)
def update_params(n_update_clicks, num_averages, *component_inputs):
def update_params(n_update_clicks, *component_inputs):
if n_update_clicks <= self._last_update_clicks:
return

Expand Down

0 comments on commit 492a85d

Please sign in to comment.