Skip to content

Commit

Permalink
modified qprogram
Browse files Browse the repository at this point in the history
  • Loading branch information
jordivallsq committed Nov 13, 2024
1 parent 29bd350 commit fed432c
Showing 1 changed file with 48 additions and 9 deletions.
57 changes: 48 additions & 9 deletions src/qililab/qprogram/qprogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ def traverse(block: Block):
bus=element.bus,
waveform=waveform,
weights=element.weights,
warmup_pulse=element.warmup_pulse,
demodulation=element.demodulation,
save_adc=element.save_adc,
)
Expand All @@ -260,6 +261,7 @@ def traverse(block: Block):
bus=element.bus,
waveform=element.waveform,
weights=weights,
warmup_pulse=element.warmup_pulse,
demodulation=element.demodulation,
save_adc=element.save_adc,
)
Expand All @@ -275,6 +277,7 @@ def traverse(block: Block):
bus=element.bus,
waveform=waveform,
weights=weights,
warmup_pulse=element.warmup_pulse,
demodulation=element.demodulation,
save_adc=element.save_adc,
)
Expand Down Expand Up @@ -333,7 +336,9 @@ def wait(self, bus: str, duration: int):
self._buses.add(bus)

@overload
def measure(self, bus: str, waveform: IQPair, weights: IQPair, save_adc: bool = False):
def measure(
self, bus: str, waveform: IQPair, weights: IQPair, warmup_pulse: IQPair | None = None, save_adc: bool = False
):
"""Play a pulse and acquire results.
Args:
Expand All @@ -344,7 +349,9 @@ def measure(self, bus: str, waveform: IQPair, weights: IQPair, save_adc: bool =
"""

@overload
def measure(self, bus: str, waveform: str, weights: IQPair, save_adc: bool = False):
def measure(
self, bus: str, waveform: str, weights: IQPair, warmup_pulse: IQPair | None = None, save_adc: bool = False
):
"""Play a named pulse and acquire results.
Args:
Expand All @@ -355,7 +362,9 @@ def measure(self, bus: str, waveform: str, weights: IQPair, save_adc: bool = Fal
"""

@overload
def measure(self, bus: str, waveform: IQPair, weights: str, save_adc: bool = False):
def measure(
self, bus: str, waveform: IQPair, weights: str, warmup_pulse: IQPair | None = None, save_adc: bool = False
):
"""Play a named pulse and acquire results.
Args:
Expand All @@ -366,7 +375,9 @@ def measure(self, bus: str, waveform: IQPair, weights: str, save_adc: bool = Fal
"""

@overload
def measure(self, bus: str, waveform: str, weights: str, save_adc: bool = False):
def measure(
self, bus: str, waveform: str, weights: str, warmup_pulse: IQPair | None = None, save_adc: bool = False
):
"""Play a named pulse and acquire results.
Args:
Expand All @@ -376,13 +387,21 @@ def measure(self, bus: str, waveform: str, weights: str, save_adc: bool = False)
save_adc (bool, optional): If ADC data should be saved. Defaults to False.
"""

def measure(self, bus: str, waveform: IQPair | str, weights: IQPair | str, save_adc: bool = False):
def measure(
self,
bus: str,
waveform: IQPair | str,
weights: IQPair | str,
warmup_pulse: IQPair | None = None,
save_adc: bool = False,
):
"""Play a pulse and acquire results.
Args:
bus (str): Unique identifier of the bus.
waveform (IQPair): Waveform played during measurement.
weights (IQPair): Weights used during demodulation/integration.
warmup_pulse (IQPair, optional): Warmup pulse played before measurement. Defaults to None.
save_adc (bool, optional): If ADC data should be saved. Defaults to False.
"""
operation: (
Expand All @@ -392,14 +411,20 @@ def measure(self, bus: str, waveform: IQPair | str, weights: IQPair | str, save_
| MeasureWithCalibratedWaveformWeights
)
if isinstance(waveform, IQPair) and isinstance(weights, IQPair):
operation = Measure(bus=bus, waveform=waveform, weights=weights, save_adc=save_adc)
operation = Measure(
bus=bus, waveform=waveform, weights=weights, warmup_pulse=warmup_pulse, save_adc=save_adc
)
elif isinstance(waveform, str) and isinstance(weights, IQPair):
operation = MeasureWithCalibratedWaveform(bus=bus, waveform=waveform, weights=weights, save_adc=save_adc)
operation = MeasureWithCalibratedWaveform(
bus=bus, waveform=waveform, weights=weights, warmup_pulse=warmup_pulse, save_adc=save_adc
)
elif isinstance(waveform, IQPair) and isinstance(weights, str):
operation = MeasureWithCalibratedWeights(bus=bus, waveform=waveform, weights=weights, save_adc=save_adc)
operation = MeasureWithCalibratedWeights(
bus=bus, waveform=waveform, weights=weights, warmup_pulse=warmup_pulse, save_adc=save_adc
)
elif isinstance(waveform, str) and isinstance(weights, str):
operation = MeasureWithCalibratedWaveformWeights(
bus=bus, waveform=waveform, weights=weights, save_adc=save_adc
bus=bus, waveform=waveform, weights=weights, warmup_pulse=warmup_pulse, save_adc=save_adc
)
self._active_block.append(operation)
self._buses.add(bus)
Expand Down Expand Up @@ -575,6 +600,7 @@ def measure(
bus: str,
waveform: IQPair,
weights: IQPair,
warmup_pulse: IQPair | None = None,
save_adc: bool = False,
rotation: float = 0.0,
demodulation: bool = True,
Expand All @@ -585,6 +611,7 @@ def measure(
bus (str): Unique identifier of the bus.
waveform (IQPair): Waveform played during measurement.
weights (IQPair): Weights used during demodulation/integration.
warmup_pulse (IQPair, optional): Warmup pulse played before measurement. Defaults to None.
save_adc (bool, optional): If ADC data should be saved. Defaults to False.
rotation (float, optional): Angle in radians to rotate the IQ plane during demodulation/integration. Defaults to 0.0
demodulation (bool, optional): If demodulation is enabled. Defaults to True.
Expand All @@ -596,6 +623,7 @@ def measure(
bus: str,
waveform: str,
weights: IQPair,
warmup_pulse: IQPair | None = None,
save_adc: bool = False,
rotation: float = 0.0,
demodulation: bool = True,
Expand All @@ -606,6 +634,7 @@ def measure(
bus (str): Unique identifier of the bus.
waveform (str): Waveform played during measurement.
weights (IQPair): Weights used during demodulation/integration.
warmup_pulse (IQPair, optional): Warmup pulse played before measurement. Defaults to None.
save_adc (bool, optional): If ADC data should be saved. Defaults to False.
rotation (float, optional): Angle in radians to rotate the IQ plane during demodulation/integration. Defaults to 0.0
demodulation (bool, optional): If demodulation is enabled. Defaults to True.
Expand All @@ -617,6 +646,7 @@ def measure(
bus: str,
waveform: IQPair,
weights: str,
warmup_pulse: IQPair | None = None,
save_adc: bool = False,
rotation: float = 0.0,
demodulation: bool = True,
Expand All @@ -627,6 +657,7 @@ def measure(
bus (str): Unique identifier of the bus.
waveform (IQPair): Waveform played during measurement.
weights (str): Weights used during demodulation/integration.
warmup_pulse (IQPair, optional): Warmup pulse played before measurement. Defaults to None.
save_adc (bool, optional): If ADC data should be saved. Defaults to False.
rotation (float, optional): Angle in radians to rotate the IQ plane during demodulation/integration. Defaults to 0.0
demodulation (bool, optional): If demodulation is enabled. Defaults to True.
Expand All @@ -638,6 +669,7 @@ def measure(
bus: str,
waveform: str,
weights: str,
warmup_pulse: IQPair | None = None,
save_adc: bool = False,
rotation: float = 0.0,
demodulation: bool = True,
Expand All @@ -648,6 +680,7 @@ def measure(
bus (str): Unique identifier of the bus.
waveform (str): Waveform played during measurement.
weights (str): Weights used during demodulation/integration.
warmup_pulse (IQPair, optional): Warmup pulse played before measurement. Defaults to None.
save_adc (bool, optional): If ADC data should be saved. Defaults to False.
rotation (float, optional): Angle in radians to rotate the IQ plane during demodulation/integration. Defaults to 0.0
demodulation (bool, optional): If demodulation is enabled. Defaults to True.
Expand All @@ -658,6 +691,7 @@ def measure(
bus: str,
waveform: IQPair | str,
weights: IQPair | str,
warmup_pulse: IQPair | None = None,
save_adc: bool = False,
rotation: float = 0.0,
demodulation: bool = True,
Expand All @@ -668,6 +702,7 @@ def measure(
bus (str): Unique identifier of the bus.
waveform (IQPair): Waveform played during measurement.
weights (IQPair): Weights used during demodulation/integration.
warmup_pulse (IQPair, optional): Warmup pulse played before measurement. Defaults to None.
save_adc (bool, optional): If raw ADC data should be saved. Defaults to False.
rotation (float, optional): Angle in radians to rotate the IQ plane during demodulation/integration. Defaults to 0.0
demodulation (bool, optional): If demodulation is enabled. Defaults to True.
Expand All @@ -683,6 +718,7 @@ def measure(
bus=bus,
waveform=waveform,
weights=weights,
warmup_pulse=warmup_pulse,
save_adc=save_adc,
rotation=rotation,
demodulation=demodulation,
Expand All @@ -692,6 +728,7 @@ def measure(
bus=bus,
waveform=waveform,
weights=weights,
warmup_pulse=warmup_pulse,
save_adc=save_adc,
rotation=rotation,
demodulation=demodulation,
Expand All @@ -701,6 +738,7 @@ def measure(
bus=bus,
waveform=waveform,
weights=weights,
warmup_pulse=warmup_pulse,
save_adc=save_adc,
rotation=rotation,
demodulation=demodulation,
Expand All @@ -710,6 +748,7 @@ def measure(
bus=bus,
waveform=waveform,
weights=weights,
warmup_pulse=warmup_pulse,
save_adc=save_adc,
rotation=rotation,
demodulation=demodulation,
Expand Down

0 comments on commit fed432c

Please sign in to comment.