From 64b812b9dc451b4a6ce37c5911688d92a128989c Mon Sep 17 00:00:00 2001 From: Michal Goldenshtein Date: Fri, 19 Apr 2024 17:47:50 -0500 Subject: [PATCH 1/2] fixing a typo "mwInput" to "MWInput" in bakery --- qualang_tools/bakery/bakery.py | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/qualang_tools/bakery/bakery.py b/qualang_tools/bakery/bakery.py index 5682895f..e53ac8f9 100644 --- a/qualang_tools/bakery/bakery.py +++ b/qualang_tools/bakery/bakery.py @@ -130,7 +130,7 @@ def _init_dict(self): "freq": 0, "time_track": 0, # Value used for negative waits, to know where to add the samples (negative int) } - if any([key in self._local_config["elements"][qe] for key in ["mixInputs", "RF_inputs", "mwInput"]]): + if any([key in self._local_config["elements"][qe] for key in ["mixInputs", "RF_inputs", "MWInput"]]): sample_dict[qe] = {"I": [], "Q": []} elif "singleInput" in self._local_config["elements"][qe]: @@ -209,7 +209,7 @@ def __exit__(self, exc_type, exc_value, exc_traceback): self._qe_set.add(qe) qe_samples = self._samples_dict[qe] if self.sampling_rate > int(1e9): - if any([key in elements[qe] for key in ["mixInputs", "RF_inputs", "mwInput"]]): + if any([key in elements[qe] for key in ["mixInputs", "RF_inputs", "MWInput"]]): y1 = qe_samples["I"] y2 = qe_samples["Q"] dt = 1e9 / self.sampling_rate @@ -246,7 +246,7 @@ def __exit__(self, exc_type, exc_value, exc_traceback): self.wait(4 - self._qe_dict[qe]["time"] % 4, qe) end_samples = 0 - if any([key in elements[qe] for key in ["mixInputs", "RF_inputs", "mwInput"]]): + if any([key in elements[qe] for key in ["mixInputs", "RF_inputs", "MWInput"]]): end_samples = len(qe_samples["I"]) - wait_duration elif "singleInput" in elements[qe]: end_samples = len(qe_samples["single"]) - wait_duration @@ -265,7 +265,7 @@ def __exit__(self, exc_type, exc_value, exc_traceback): ) elif self._padding_method == "left": - if any([key in elements[qe] for key in ["mixInputs", "RF_inputs", "mwInput"]]): + if any([key in elements[qe] for key in ["mixInputs", "RF_inputs", "MWInput"]]): qe_samples["I"] = qe_samples["I"][end_samples:] + qe_samples["I"][0:end_samples] qe_samples["Q"] = qe_samples["Q"][end_samples:] + qe_samples["Q"][0:end_samples] elif "singleInput" in elements[qe]: @@ -274,7 +274,7 @@ def __exit__(self, exc_type, exc_value, exc_traceback): elif self._padding_method == "symmetric_l" or ( self._padding_method == "symmetric_r" and wait_duration % 2 == 0 ): - if any([key in elements[qe] for key in ["mixInputs", "RF_inputs", "mwInput"]]): + if any([key in elements[qe] for key in ["mixInputs", "RF_inputs", "MWInput"]]): qe_samples["I"] = ( qe_samples["I"][end_samples + wait_duration // 2 :] + qe_samples["I"][0 : end_samples + wait_duration // 2] @@ -292,7 +292,7 @@ def __exit__(self, exc_type, exc_value, exc_traceback): ) elif self._padding_method == "symmetric_r" and wait_duration % 2 != 0: - if any([key in elements[qe] for key in ["mixInputs", "RF_inputs", "mwInput"]]): + if any([key in elements[qe] for key in ["mixInputs", "RF_inputs", "MWInput"]]): qe_samples["I"] = ( qe_samples["I"][end_samples + wait_duration // 2 + 1 :] + qe_samples["I"][0 : end_samples + wait_duration // 2 + 1] @@ -310,7 +310,7 @@ def __exit__(self, exc_type, exc_value, exc_traceback): if self.update_config: self._update_config(qe, qe_samples) - if any([key in elements[qe] for key in ["mixInputs", "RF_inputs", "mwInput"]]): + if any([key in elements[qe] for key in ["mixInputs", "RF_inputs", "MWInput"]]): self.override_waveforms_dict["waveforms"][f"{qe}_baked_wf_I_{self._ctr}"] = qe_samples["I"] self.override_waveforms_dict["waveforms"][f"{qe}_baked_wf_Q_{self._ctr}"] = qe_samples["Q"] @@ -412,7 +412,7 @@ def get_current_length(self, qe: Optional[str] = None) -> int: max_length = length return max_length else: - if any([key in self._local_config["elements"][qe] for key in ["mixInputs", "RF_inputs", "mwInput"]]): + if any([key in self._local_config["elements"][qe] for key in ["mixInputs", "RF_inputs", "MWInput"]]): return len(self._samples_dict[qe]["I"]) elif "singleInput" in self._local_config["elements"][qe]: return len(self._samples_dict[qe]["single"]) @@ -468,7 +468,7 @@ def delete_for_el(qe_internal, t_start_internal, t_stop_internal): if any( [ key in self._local_config["elements"][qe_internal] - for key in ["mixInputs", "RF_inputs", "mwInput"] + for key in ["mixInputs", "RF_inputs", "MWInput"] ] ): input_type.append("I") @@ -531,7 +531,7 @@ def remove_op(q): if f"baked_Op_{self._ctr}" in self.config["elements"][q]["operations"]: del self.config["elements"][q]["operations"][f"baked_Op_{self._ctr}"] del self.config["pulses"][f"{q}_baked_pulse_{self._ctr}"] - if any([key in self.config["elements"][q] for key in ["mixInputs", "RF_inputs", "mwInput"]]): + if any([key in self.config["elements"][q] for key in ["mixInputs", "RF_inputs", "MWInput"]]): del self.config["waveforms"][f"{q}_baked_wf_I_{self._ctr}"] del self.config["waveforms"][f"{q}_baked_wf_Q_{self._ctr}"] elif "singleInput" in self.config["elements"][q]: @@ -581,7 +581,7 @@ def get_op_length(self, qe: Optional[str] = None) -> int: if not (qe in self._qe_set): raise KeyError(f"{qe} is not in the set of quantum elements of the baking object ") else: - if any([key in self._config["elements"][qe] for key in ["mixInputs", "RF_inputs", "mwInput"]]): + if any([key in self._config["elements"][qe] for key in ["mixInputs", "RF_inputs", "MWInput"]]): return len(self._config["waveforms"][f"{qe}_baked_wf_I_{self._ctr}"]["samples"]) else: return len(self._config["waveforms"][f"{qe}_baked_wf_{self._ctr}"]["samples"]) @@ -643,7 +643,7 @@ def add_op( index = self._get_pulse_index(qe) Op = {name: f"{qe}_baked_pulse_b{self._ctr}_{index}"} - if any([key in self._local_config["elements"][qe] for key in ["mixInputs", "RF_inputs", "mwInput"]]): + if any([key in self._local_config["elements"][qe] for key in ["mixInputs", "RF_inputs", "MWInput"]]): assert len(samples) == 2, f"{qe} is a mixInputs/RF_inputs element, two lists should be provided" assert len(samples[0]) == len( samples[1] @@ -718,7 +718,7 @@ def play(self, Op: str, qe: str, amp: Union[float, Tuple[float]] = 1.0) -> None: phi = self._qe_dict[qe]["phase"] if self._qe_dict[qe]["time_track"] == 0: - if any([key in self._local_config["elements"][qe] for key in ["mixInputs", "RF_inputs", "mwInput"]]): + if any([key in self._local_config["elements"][qe] for key in ["mixInputs", "RF_inputs", "MWInput"]]): assert isinstance( samples, list ), f"{qe} is a mixInputs/RF_inputs element, two lists should be provided" @@ -809,7 +809,7 @@ def play_at(self, Op: str, qe: str, t: int, amp: Union[float, Tuple[float]] = 1. pulse = self._local_config["elements"][qe]["operations"][Op] samples = self._get_samples(pulse) new_samples = 0 - if any([key in self._local_config["elements"][qe] for key in ["mixInputs", "RF_inputs", "mwInput"]]): + if any([key in self._local_config["elements"][qe] for key in ["mixInputs", "RF_inputs", "MWInput"]]): assert isinstance( samples, list ), f"{qe} is a mixInputs/RF_inputs element, two lists should be provided" @@ -941,7 +941,7 @@ def ramp(self, amp: float, duration: int, qe: str) -> None: ramp_sample = [amp * t for t in range(duration)] if "singleInput" in self._local_config["elements"][qe]: self._samples_dict[qe]["single"] += ramp_sample - elif any([key in self._local_config["elements"][qe] for key in ["mixInputs", "RF_inputs", "mwInput"]]): + elif any([key in self._local_config["elements"][qe] for key in ["mixInputs", "RF_inputs", "MWInput"]]): self._samples_dict[qe]["Q"] += ramp_sample self._samples_dict[qe]["I"] += [0] * duration self._update_qe_time(qe, duration) @@ -967,7 +967,7 @@ def wait(self, duration: int, *qe_set: str) -> None: if any( [ key in self._local_config["elements"][qe].keys() - for key in ["mixInputs", "RF_inputs", "mwInput"] + for key in ["mixInputs", "RF_inputs", "MWInput"] ] ): self._samples_dict[qe]["I"] += [0] * duration From ccc7aaac2698929412b3560aca8b5343cb03bf31 Mon Sep 17 00:00:00 2001 From: Dean Poulos Date: Sat, 20 Apr 2024 10:24:41 +1000 Subject: [PATCH 2/2] Update changelog.: --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b8d4825..72b5bef2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ### Fixed - Only load DataHandler XarrayDataProcessor if xarray can be imported - Fix bug with the data folder path. +- Fix typo in the `baking` tool config lookup (`mwInput` -> `MWInput`) ## [0.17.0] - 2024-04-18 ### Added