Skip to content

Commit

Permalink
Release 2.23.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Lienemann committed Jan 18, 2024
1 parent 310364d commit 8c12b24
Show file tree
Hide file tree
Showing 35 changed files with 1,919 additions and 2,426 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"from laboneq.contrib.example_helpers.feedback_helper import (\n",
" state_emulation_pulse,\n",
" create_calibration_experiment,\n",
" create_discrimination_experiment,\n",
" create_integration_verification_experiment,\n",
")\n",
"\n",
"from laboneq.contrib.example_helpers.generate_example_datastore import (\n",
Expand Down Expand Up @@ -242,7 +242,9 @@
"id": "23004293",
"metadata": {},
"source": [
"## 2.3 Verify state discrimination"
"## 2.3 Plot acquired results after readout optimization\n",
"\n",
"When using the optimized kernels calculated in the last step, the integration results for ground and excited states are rotated so that a projection onto the real axis allows for later discrimination with a real-valued threshold."
]
},
{
Expand All @@ -252,14 +254,14 @@
"metadata": {},
"outputs": [],
"source": [
"my_exp = create_discrimination_experiment(\n",
"my_exp = create_integration_verification_experiment(\n",
" measure_lines=[q0[\"measure_line\"], q1[\"measure_line\"]],\n",
" acquire_line=q0[\"acquire_line\"],\n",
" kernels=kernels,\n",
" state_emulation_pulse=state_emulation_pulse,\n",
")\n",
"\n",
"discrimination_results = my_session.run(my_exp)"
"integration_results = my_session.run(my_exp)"
]
},
{
Expand All @@ -269,8 +271,8 @@
"metadata": {},
"outputs": [],
"source": [
"s0 = discrimination_results.get_data(\"data_0\").real\n",
"s1 = discrimination_results.get_data(\"data_1\").real\n",
"s0 = integration_results.get_data(\"data_0\").real\n",
"s1 = integration_results.get_data(\"data_1\").real\n",
"\n",
"plt.plot(s0, \".b\")\n",
"plt.plot(s1, \".r\")"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@
"id": "1423f3d9",
"metadata": {},
"source": [
"<div class=\"alert alert-block alert-info\">\n",
"<b>Remark:</b> The spectroscopy experiments in this notebook rely on the real-time frequency sweep functionality of the Zurich Instruments SHF-line devices. [Another example notebook](https://github.com/zhinst/laboneq/blob/main/examples/spectroscopy_uhfqa_hdawg.ipynb) explains how to run spectroscopy experiments also with the UHFQA (resonator spectroscopy) and HDAWG (qubit spectroscopy).</div>"
"**Remark:** The spectroscopy experiments in this notebook rely on the real-time frequency sweep functionality of the Zurich Instruments SHF-line devices. [Another example notebook](https://github.com/zhinst/laboneq/blob/main/examples/spectroscopy_uhfqa_hdawg.ipynb) explains how to run spectroscopy experiments also with the UHFQA (resonator spectroscopy) and HDAWG (qubit spectroscopy)."
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,8 @@
" )\n",
" # relax time after readout - for qubit relaxation to groundstate and signal processing\n",
" with exp_rb.section(length=1e-6):\n",
" exp_rb.reserve(signal=\"measure\")"
" exp_rb.reserve(signal=\"measure\")\n",
" exp_rb.reserve(signal=\"drive\")"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion laboneq/VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.22.0
2.23.0
60 changes: 33 additions & 27 deletions laboneq/compiler/code_generator/code_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1651,39 +1651,45 @@ def _sample_pulses(
)
has_q = True

if "samples_marker1" in sampled_pulse:
if (
pulse_part.channel == 1
and not multi_iq_signal
and not device_type == DeviceType.SHFQA
):
raise LabOneQException(
f"Marker 1 not supported on channel 2 of multiplexed RF signal {signal_id}"
# RF case
if pulse_part.channel is not None:
if "samples_marker1" in sampled_pulse and pulse_part.channel == 0:
self.stencil_samples(
pulse_part.start,
sampled_pulse["samples_marker1"],
samples_marker1,
)
has_marker1 = True

self.stencil_samples(
pulse_part.start,
sampled_pulse["samples_marker1"],
samples_marker1,
)
has_marker1 = True
# map user facing marker1 to "internal" marker 2
if "samples_marker1" in sampled_pulse and pulse_part.channel == 1:
self.stencil_samples(
pulse_part.start,
sampled_pulse["samples_marker1"],
samples_marker2,
)
has_marker2 = True

if "samples_marker2" in sampled_pulse:
if (
pulse_part.channel == 0
and not multi_iq_signal
and not device_type == DeviceType.SHFQA
):
if "samples_marker2" in sampled_pulse and pulse_part.channel == 1:
raise LabOneQException(
f"Marker 2 not supported on channel 1 of multiplexed RF signal {signal_id}"
f"Marker 2 not supported on channel 1 of multiplexed RF signal {signal_id}. Please use marker 1"
)
else:
if "samples_marker1" in sampled_pulse:
self.stencil_samples(
pulse_part.start,
sampled_pulse["samples_marker1"],
samples_marker1,
)
has_marker1 = True

self.stencil_samples(
pulse_part.start,
sampled_pulse["samples_marker2"],
samples_marker2,
)
has_marker2 = True
if "samples_marker2" in sampled_pulse:
self.stencil_samples(
pulse_part.start,
sampled_pulse["samples_marker2"],
samples_marker2,
)
has_marker2 = True

pm = signature_pulse_map.get(pulse_def.uid)
if pm is None:
Expand Down
20 changes: 1 addition & 19 deletions laboneq/compiler/experiment_access/experiment_dao.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,32 +344,14 @@ def validate_experiment(self):
)
== DeviceType.HDAWG
and len(section_pulse.signal.channels) == 1
and section_pulse.signal.channels[0] % 2 == 0
and any(
"marker2" == m.marker_selector
for m in section_pulse.markers
)
):
raise LabOneQException(
f"Single channel RF Pulse {pulse_id} referenced in section {section_id}"
f" has marker 2 enabled but is to be played on channel {section_pulse.signal.channels[0]+1}. Please use marker 1"
)

if (
DeviceType.from_device_info_type(
section_pulse.signal.device.device_type
)
== DeviceType.HDAWG
and len(section_pulse.signal.channels) == 1
and section_pulse.signal.channels[0] % 2 == 1
and any(
"marker1" == m.marker_selector
for m in section_pulse.markers
)
):
raise LabOneQException(
f"Single channel RF Pulse {pulse_id} referenced in section {section_id}"
f" has marker 1 enabled but is to be played on channel {section_pulse.signal.channels[0]+1}. Please use marker 2"
f" has marker 2 enabled. Please only use marker 1 on RF channels."
)

if (
Expand Down
34 changes: 25 additions & 9 deletions laboneq/compiler/workflow/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,8 @@ def _analyze_setup(self):

_logger.debug("Using desktop setup configuration with leader %s", leader)

if has_hdawg or has_shfsg and not has_shfqa:
# TODO: Check if this is needed for standalone QC, where only SG part is used
if has_hdawg or (standalone_qc is True and has_shfsg and not has_shfqa):
has_signal_on_awg_0_of_leader = False
for signal_id in self._experiment_dao.signals():
signal_info = self._experiment_dao.signal_info(signal_id)
Expand Down Expand Up @@ -319,7 +320,7 @@ def _get_total_rounded_delay(delay, signal_id, device_type, sampling_rate):
def _calc_integration_unit_allocation(dao: ExperimentDAO):
integration_unit_allocation: dict[str, dict] = {}

integration_signals = [
integration_signals: list[SignalInfo] = [
signal_info
for signal in dao.signals()
if (signal_info := dao.signal_info(signal)).type
Expand Down Expand Up @@ -357,7 +358,6 @@ def _calc_integration_unit_allocation(dao: ExperimentDAO):
or is_spectroscopy(dao.acquisition_type)
else 1
)

integration_unit_allocation[signal_info.uid] = {
"device_id": signal_info.device.uid,
"awg_nr": awg_nr,
Expand Down Expand Up @@ -799,8 +799,7 @@ def calc_outputs(self, signal_delays: SignalDelays):
raise RuntimeError("Only marker1 supported on SHFSG")
if signal_info.type == SignalInfoType.RF:
if device_type == DeviceType.HDAWG:
marker_key = channel % 2 + 1
if f"marker{marker_key}" in markers:
if "marker1" in markers:
output["marker_mode"] = "MARKER"
if triggers is not None:
if signal_info.type == SignalInfoType.IQ:
Expand Down Expand Up @@ -842,16 +841,33 @@ def calc_outputs(self, signal_delays: SignalDelays):

def calc_inputs(self, signal_delays: SignalDelays):
all_channels = {}
ports_delays_raw_shfqa = set()
for signal_id in self._experiment_dao.signals():
signal_info = self._experiment_dao.signal_info(signal_id)
signal_info: SignalInfo = self._experiment_dao.signal_info(signal_id)
if signal_info.type != SignalInfoType.INTEGRATION:
continue

lo_frequency = self._experiment_dao.lo_frequency(signal_id)
signal_range = self._experiment_dao.signal_range(signal_id)

port_delay = self._experiment_dao.port_delay(signal_id)
# SHFQA scope delay cannot be set for individual channels
if (
self._experiment_dao.acquisition_type == AcquisitionType.RAW
and port_delay is not None
):
device_type = DeviceType.from_device_info_type(
signal_info.device.device_type
)
if device_type == device_type.SHFQA:
ports_delays_raw_shfqa.add(
port_delay.uid
if isinstance(port_delay, ParameterInfo)
else port_delay
)
if len(ports_delays_raw_shfqa) > 1:
msg = f"{signal_info.device.uid}: Multiple different `port_delay`s defined for SHFQA acquisition signals in `AcquisitionType.RAW` mode. Only 1 supported."
raise LabOneQException(msg)

lo_frequency = self._experiment_dao.lo_frequency(signal_id)
signal_range = self._experiment_dao.signal_range(signal_id)
port_mode = self._experiment_dao.port_mode(signal_id)

scheduler_port_delay: float = 0.0
Expand Down
3 changes: 3 additions & 0 deletions laboneq/contrib/example_helpers/feedback_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ def exp():
return exp()


create_integration_verification_experiment = create_discrimination_experiment


def gaussian_envelope(
centre=50e-9, sigma=20e-9, start_time=0, stop_time=100e-9, sampling_rate=2e9
):
Expand Down
Loading

0 comments on commit 8c12b24

Please sign in to comment.