synthesizer package

synthesizer.synthesizer_server module

Provides low-level control of the 4-channel RF synthesizer developed by the JILA shop.

To do:
  • Finish implementing communications using sockets

class synthesizer.synthesizer_server.SynthesizerServer

Bases: LabradServer

Provides low-level control of the 4-channel RF synthesizer developed by the JILA shop.

__init__()
static a_to_atw(a)

Converts an amplitude to the format required for programming the synthesizer

Parameters:

a (float) – The amplitude, relative to full scale

Raises:

ValueError – Raises an error if the amplitude is less than zero or greater than one

Returns:

The 16-bit unsigned integer corresponding to a

Return type:

int

static compile_timestamp(self, channel, address, timestamp, phase_update, ptw, atw, ftw)

Compiles a timestamp into a binary command which can be written to the synthesizer

Parameters:
  • channel (int) – The channel to set. Must be between 0 and 3.

  • address (int) – The address of the timestep

  • timestamp (int) – The time of the timestamp (in s).

  • phase_update (int) – Whether to update the phase. 0 to not change phase, 1 to set absolute phase, 2 to increment phase.

  • phase (int) – The phase (in radians) to set

  • amplitude (int) – The amplitude (relative to full scale) to set

  • frequency (int) – The frequency (in Hz) to set

  • wait_for_trigger (bool) – Whether to wait for a trigger. Defaults to False.

  • digital_out ([bool]) – A list of 7 booleans, corresponding to whether each channel should be turned on. Defaults to [False]*7, in which case the digital outputs are off.

Returns:

The messages to send to the synthesizer that represent the timestamp.

Return type:

List[ByteArray]

static f_to_ftw(f)

Converts a frequency in Hertz to the format required for programming the synthesizer

Parameters:

f (float) – The frequency in Hertz

Raises:

ValueError – Raises an error if the frequency is less than zero or greater than the maximum frequency

Returns:

The 32-bit unsigned integer corresponding to f

Return type:

int

initServer(self)

Called by LabRAD when server is started. Connects to the synthesizer using the socket library.

name = '%LABRADNODE%_synthesizer'
static phase_to_ptw(phi)

Converts a phase to the format required for programming the synthesizer

Parameters:

phi (float) – The phase in radians.

Returns:

The 12-bit unsigned integer corresponting to phi

Return type:

int

reset(self)

Resets the synthesizer

Parameters:
  • c – The LabRAD context.

  • reset_outputs – Whether to zero the outputs or just the sequencer

static t_to_timestamp(t)

Converts a time to the format required for programming the synthesizer

Parameters:

t (float) – The time, in seconds

Raises:

ValueError – Raises an error if the time is less than zero or greater than 27.962 seconds

Returns:

The 48-bit unsigned integer corresponting to t

Return type:

int

trigger(self)

Triggers the synthesizer

Parameters:

c – The LabRAD context.

write_timestamps(self, c, timestamps, compile=False, verbose=False)

Writes timestamps from a JSON-formatted string. See write_timestamps() for specification.

Parameters:
  • c – The LabRAD context. Not used.

  • timestamps (str) – A JSON-formatted string containing a dictionary (keys: channels, values: sequences) of lists of dictionaries, each of which is a timestamp.

synthesizer.synthesizer_sequences module

Classes and functions for generating sequences for the RF synthesizer

To do:
  • Design functions for maintaining phase on frequency switching

  • Finish implementing SyncPoints

class synthesizer.synthesizer_sequences.AdjustNextDuration(duration: float)

Bases: RFBlock

Adjusts the duration of the next Timestamp. Throws an error on compilation if the next RFBlock is not a Timestamp or the adjustment would result in negative duration.

__init__(duration: float) None
Parameters:

duration (float) – The duration in seconds by which to increment the duration of the next timestamp.

atomic = True
compile(self)

Compiles the block into a list of basic RFBlock that can be sent to the synthesizer.

Parameters:

state (SequenceState, optional) – The state of the channel when the block is to be called. Defaults to None, which can be used for testing compile functions of RFBlock objects that do not depend on channel state.

Returns:

The compiled RFBlock.

Return type:

(RFBlock | List[RFBlock])

class synthesizer.synthesizer_sequences.AdjustPrevDuration(duration: float)

Bases: RFBlock

Adjusts the duration of the previous Timestamp. Throws an error on compilation if the previous RFBlock is not a Timestamp or the adjustment would result in negative duration.

__init__(duration: float) None
Parameters:

duration (float) – The duration in seconds by which to increment the duration of the previous timestamp.

atomic = True
compile(self)

Compiles the block into a list of basic RFBlock that can be sent to the synthesizer.

Parameters:

state (SequenceState, optional) – The state of the channel when the block is to be called. Defaults to None, which can be used for testing compile functions of RFBlock objects that do not depend on channel state.

Returns:

The compiled RFBlock.

Return type:

(RFBlock | List[RFBlock])

class synthesizer.synthesizer_sequences.AmplitudeRamp(duration: float, start_amplitude: float | None = None, end_amplitude: float | None = None, phase: float | None = None, frequency: float | None = None, steps: int = 20)

Bases: RFBlock

Linearly ramps the amplitude of the RF tone while maintaining constant frequency and phase.

__init__(duration: float, start_amplitude: float | None = None, end_amplitude: float | None = None, phase: float | None = None, frequency: float | None = None, steps: int = 20)
Parameters:
  • duration (float) – The duration of the ramp in seconds.

  • start_amplitude (float, optional) – The initial amplitude, relative to full scale. Defaults to None, in which case the amplitude of the previous RFBlock is used.

  • end_amplitude (float, optional) – The final amplitude, relative to full scale. Defaults to None, in which case start_amplitude is used.

  • phase (float, optional) – The phase of the tone in radians. Defaults to None, in which case the previous phase setting is maintained.

  • frequency (float, optional) – The frequency of the tone in Hertz. Defaults to None, in which case the previous frequency setting is maintained.

  • steps (int, optional) – The number of amplitude steps to include in the ramp. Must be at least 2. Defaults to 20.

compile(self)

Compiles the block into a list of basic RFBlock that can be sent to the synthesizer.

Parameters:

state (SequenceState, optional) – The state of the channel when the block is to be called. Defaults to None, which can be used for testing compile functions of RFBlock objects that do not depend on channel state.

Returns:

The compiled RFBlock.

Return type:

(RFBlock | List[RFBlock])

class synthesizer.synthesizer_sequences.AreaPulse(pulse_area: float, amplitude: Optional[float] = None, phase: Optional[float] = None, frequency: Optional[float] = None, centered: bool = False, window: type[RFPulse] = <class 'synthesizer.synthesizer_sequences.RectangularPulse'>, **kwargs)

Bases: RFPulse

Class for generating an RF pulse on a specified Transition, which must be set by a SetTransition command before the first AreaPulse(). The pulse timing is calculated to provide the specified pulse area. See also Pulse() for a low level function for generating pulses with manually specified frequency, amplitude, and duration.

__init__(pulse_area: float, amplitude: Optional[float] = None, phase: Optional[float] = None, frequency: Optional[float] = None, centered: bool = False, window: type[RFPulse] = <class 'synthesizer.synthesizer_sequences.RectangularPulse'>, **kwargs) None
Parameters:
  • pulse_area (float) – The pulse area in radians.

  • amplitude (float, optional) – The peak amplitude of the pulse, relative to full scale. Defaults to None, in which case the default amplitude for the specified Transition is used.

  • phase (float, optional) – The phase of the pulse in radians. Defaults to None, in which case the previous phase setting is maintained.

  • centered (bool, optional) – Whether to reduce the duration of the preceding and following Wait commands duration/2. Will throw an error during compilation if the Wait commands are too short or the pulse is not adjacent to at least one Wait command. If there is only one neighboring Wait command, its duration is reduced by duration/2. Defaults to False.

  • window (RFPulse, optional) – The shape of the pulse. Defaults to RectangularPulse.

  • **kwargs – Additional keyword arguments, which are passed to window’s __init__ method

compile(self)

Compiles the block into a list of basic RFBlock that can be sent to the synthesizer.

Parameters:

state (SequenceState, optional) – The state of the channel when the block is to be called. Defaults to None, which can be used for testing compile functions of RFBlock objects that do not depend on channel state.

Returns:

The compiled RFBlock.

Return type:

(RFBlock | List[RFBlock])

class synthesizer.synthesizer_sequences.BB1(pulse_area: float, amplitude: Optional[float] = None, phase: Optional[float] = None, frequency: Optional[float] = None, centered: bool = False, window: type[RFPulse] = <class 'synthesizer.synthesizer_sequences.RectangularPulse'>, **kwargs)

Bases: AreaPulse

Generates a BB1 robust composite pulse.

compile(self)

Compiles the block into a list of basic RFBlock that can be sent to the synthesizer.

Parameters:

state (SequenceState, optional) – The state of the channel when the block is to be called. Defaults to None, which can be used for testing compile functions of RFBlock objects that do not depend on channel state.

Returns:

The compiled RFBlock.

Return type:

(RFBlock | List[RFBlock])

class synthesizer.synthesizer_sequences.BlackmanPulse(duration: float, amplitude: float, phase: float | None = None, frequency: float | None = None, centered: float | None = False, steps: int = 20, exact: bool = False)

Bases: RFPulse

Generates a pulse with an Blackman window.

__init__(duration: float, amplitude: float, phase: float | None = None, frequency: float | None = None, centered: float | None = False, steps: int = 20, exact: bool = False) None

Refer to Pulse() for descriptions of the arguments.

Keyword Arguments:
  • steps (int, optional) – The number of steps to approximate the pulse. Should be at least 7. Defaults to 20.

  • exact (bool, optional) – Whether to use exact parameters for the window, as described on Wikipedia. Defaults to False.

property area: float

Returns the area of the pulse, relative to a rectangular pulse of the same duration and peak amplitude.

Returns:

The area of the pulse, relative to a rectangular pulse of the same duration and peak amplitude

Return type:

(float)

compile(self)

Compiles the block into a list of basic RFBlock that can be sent to the synthesizer.

Parameters:

state (SequenceState, optional) – The state of the channel when the block is to be called. Defaults to None, which can be used for testing compile functions of RFBlock objects that do not depend on channel state.

Returns:

The compiled RFBlock.

Return type:

(RFBlock | List[RFBlock])

class synthesizer.synthesizer_sequences.CORPSE(pulse_area: float, amplitude: Optional[float] = None, phase: Optional[float] = None, frequency: Optional[float] = None, centered: bool = False, window: type[RFPulse] = <class 'synthesizer.synthesizer_sequences.RectangularPulse'>, **kwargs)

Bases: AreaPulse

Generates a CORPSE robust composite pulse.

compile(self)

Compiles the block into a list of basic RFBlock that can be sent to the synthesizer.

Parameters:

state (SequenceState, optional) – The state of the channel when the block is to be called. Defaults to None, which can be used for testing compile functions of RFBlock objects that do not depend on channel state.

Returns:

The compiled RFBlock.

Return type:

(RFBlock | List[RFBlock])

synthesizer.synthesizer_sequences.DROID60(duration: float, pulse: RFPulse | None = None)
class synthesizer.synthesizer_sequences.FrequencyRamp(duration: float, amplitude: float | None = None, phase: float | None = None, start_frequency: float | None = None, end_frequency: float | None = None, steps: int = 20)

Bases: RFBlock

Linearly ramps the frequency of the RF tone while maintaining constant amplitude and phase.

__init__(duration: float, amplitude: float | None = None, phase: float | None = None, start_frequency: float | None = None, end_frequency: float | None = None, steps: int = 20)
Parameters:
  • duration (float) – The duration of the ramp in seconds.

  • amplitude (float, optional) – The amplitude of the tone relative to full scale. Defaults to None.

  • phase (float, optional) – The phase of the tone in radians. Defaults to None, in which case the previous phase setting is maintained.

  • start_frequency (float, optional) – The initial frequency in Hertz. Defaults to None, in which case the previous frequency setting is used.

  • end_frequency (float, optional) – The final frequency in Hertz. Defaults to None, in which case start_frequency is used.

  • steps (int, optional) – The number of frequency steps to include in the ramp. Defaults to 20.

compile(self)

Compiles the block into a list of basic RFBlock that can be sent to the synthesizer.

Parameters:

state (SequenceState, optional) – The state of the channel when the block is to be called. Defaults to None, which can be used for testing compile functions of RFBlock objects that do not depend on channel state.

Returns:

The compiled RFBlock.

Return type:

(RFBlock | List[RFBlock])

class synthesizer.synthesizer_sequences.GaussianPulse(duration: float, amplitude: float, phase: float | None = None, frequency: float | None = None, centered: bool = False, steps: int = 26, sigt: float = 0.11)

Bases: RFPulse

Generates a pulse with an approximate confined Gaussian window. See also here for more details.

__init__(duration: float, amplitude: float, phase: float | None = None, frequency: float | None = None, centered: bool = False, steps: int = 26, sigt: float = 0.11) None

Refer to Pulse() for descriptions of the arguments.

Keyword Arguments:
  • steps (int, optional) – The number of steps to approximate the pulse. Should be at least 16. Defaults to 26.

  • sigt (float, optional) – The RMS time width of the pulse relative to duration. Approximates a cosine window for \(\sigma_{t} \approx 0.18\) and approaches the time-frequency uncertainty limit for \(\sigma_{t} \leq 0.13\). Throws an error if not between 0.08 and 0.20. Defaults to 0.11.

property area: float

Returns the area of the pulse, relative to a rectangular pulse of the same duration and peak amplitude.

Returns:

The area of the pulse, relative to a rectangular pulse of the same duration and peak amplitude

Return type:

(float)

compile(self)

Compiles the block into a list of basic RFBlock that can be sent to the synthesizer.

Parameters:

state (SequenceState, optional) – The state of the channel when the block is to be called. Defaults to None, which can be used for testing compile functions of RFBlock objects that do not depend on channel state.

Returns:

The compiled RFBlock.

Return type:

(RFBlock | List[RFBlock])

synthesizer.synthesizer_sequences.KDD(duration, pulse=None)

Returns a list of pulses and Wait commands implementing a KDD decoupling sequence. Refer to this review and this paper for information about the KDD pulse sequence.

Parameters:
  • duration (float) – The duration of the decoupling sequence in seconds.

  • pulse (RFPulse, optional) – The pulse to use for the pi pulses in the decoupling sequence. Should normally be generated by PiPulse() or be a subclass of RFPulse. The phase of the pulses are overridden in the sequence. Defaults to None, in which case a RectangularPulse with the default amplitude and frequency for the selected Transition is used.

Returns:

Returns a list of pulses and Wait commands implementing a KDD decoupling sequence.

Return type:

list of RFBlock

class synthesizer.synthesizer_sequences.PhaseRamp(duration: float, amplitude: float | None = None, start_phase: float | None = None, end_phase: float | None = None, frequency: float | None = None, steps: int = 20)

Bases: RFBlock

Linearly ramps the amplitude of the RF tone while maintaining constant frequency and phase.

__init__(duration: float, amplitude: float | None = None, start_phase: float | None = None, end_phase: float | None = None, frequency: float | None = None, steps: int = 20)
Parameters:
  • duration (float) – The duration of the ramp in seconds.

  • amplitude (float, optional) – The amplitude of the tone relative to full scale. Defaults to None, in which case the previous ammplitude setting is maintained.

  • start_phase (float, optional) – The initial phase in radians. Defaults to None, in which case the phase of the previous RFBlock is used.

  • end_phase (float, optional) – The final phase in radians. Defaults to None, in which case start_phase is used.

  • frequency (float, optional) – The frequency of the tone in Hertz. Defaults to None, in which case the previous frequency setting is maintained.

  • steps (int, optional) – The number of amplitude steps to include in the ramp. Must be at least 2. Defaults to 20.

compile(self)

Compiles the block into a list of basic RFBlock that can be sent to the synthesizer.

Parameters:

state (SequenceState, optional) – The state of the channel when the block is to be called. Defaults to None, which can be used for testing compile functions of RFBlock objects that do not depend on channel state.

Returns:

The compiled RFBlock.

Return type:

(RFBlock | List[RFBlock])

synthesizer.synthesizer_sequences.PiOver2Pulse(amplitude=None, phase=None, centered=False, window=RectangularPulse, **kwargs)

A wrapper for AreaPulse() with pulse area set to pi/2. Refer to AreaPulse() for full documentation.

synthesizer.synthesizer_sequences.PiPulse(amplitude=None, phase=None, centered=False, window=RectangularPulse, **kwargs)

A wrapper for AreaPulse() with pulse area set to pi. Refer to AreaPulse() for full documentation.

synthesizer.synthesizer_sequences.Pulse(duration, amplitude, phase=None, frequency=None, centered=False, window=RectangularPulse, **kwargs)

Low level function for generating an RF pulse. Provides a unified constructor for all subclasses of RFPulse. See also AreaPulse() for a higher level interface to pulses on a specified Transition.

Parameters:
  • duration (float) – The duration of the pulse in seconds.

  • amplitude (float) – The peak amplitude of the pulse, relative to full scale.

  • phase (float, optional) – The phase of the pulse in radians. Defaults to None, in which case the previous phase setting is maintained.

  • frequency (float, optional) – The frequency of the pulse in Hertz. Defaults to None, in which case the previous frequency setting is maintained.

  • centered (bool, optional) – Whether to reduce the duration of the preceding and following Wait commands duration/2. Will throw an error during compilation if the Wait commands are too short or the pulse is not adjacent to at least one Wait command. If there is only one neighboring Wait command, its duration is reduced by duration/2. Defaults to False.

  • window (RFPulse, optional) – The shape of the pulse. Defaults to RectangularPulse.

  • **kwargs – Additional keyword arguments, which are passed to window’s __init__ method

Returns:

An RFPulse with the specified parameters

Return type:

RFPulse

class synthesizer.synthesizer_sequences.RFBlock

Bases: object

A base class for elements of a sequence for a synthesizer channel.

Parameters:

atomic (bool) – Whether the block is handled directly by the compiler (True) or returns a sequence of blocks which need to be compiled (False). Defaults to False.

__init__() None
atomic = False
compile(self)

Compiles the block into a list of basic RFBlock that can be sent to the synthesizer.

Parameters:

state (SequenceState, optional) – The state of the channel when the block is to be called. Defaults to None, which can be used for testing compile functions of RFBlock objects that do not depend on channel state.

Returns:

The compiled RFBlock.

Return type:

(RFBlock | List[RFBlock])

class synthesizer.synthesizer_sequences.RFPulse

Bases: RFBlock

A base class for RF pulses.

property area: float

Returns the area of the pulse, relative to a rectangular pulse of the same duration and peak amplitude.

Returns:

The area of the pulse, relative to a rectangular pulse of the same duration and peak amplitude

Return type:

(float)

static center(center: bool, sequence: List[RFBlock], duration: float)

center(center, sequence, duration):

Helper function for centering a pulse by adjusting the duration of the surrounding Timestamp. Should be included in the RFBlock.compile() methods of subclasses as

sequence = generate_some_stuff()
return RFPulse.center(self.center, sequence, self.duration)
Parameters:
  • center (bool) – Whether to center the sequence by adjusting the time of the surrounding Timestamp.

  • sequence (List[RFBlock]) – The sequence.

  • duration (float) – The duration of the sequence in seconds.

Returns:

The sequence, centered if center.

Return type:

(list of RFBlock)

compile(self)

Compiles the block into a list of basic RFBlock that can be sent to the synthesizer.

Parameters:

state (SequenceState, optional) – The state of the channel when the block is to be called. Defaults to None, which can be used for testing compile functions of RFBlock objects that do not depend on channel state.

Returns:

The compiled RFBlock.

Return type:

(RFBlock | List[RFBlock])

synthesizer.synthesizer_sequences.Ramsey(duration, phase, pulse=None, decoupling=None)

Returns a list of pulses and Wait commands implementing a Ramsey interferometry sequence, consisting of a pi/2 pulse with zero phase, a Wait of length duration, and a final pi/2 pulse with phase phase. A decoupling sequence can optionally be inserted instead of the Wait.

Parameters:
  • duration (float) – The dark time (in seconds) for the Ramsey sequence.

  • phase (float, optional) – The phase of the final pulse. Defaults to 0.

  • pulse (RFPulse, optional) – The pulse to use for the pi/2 pulses in the Ramsey sequence. Should normally be generated by PiOver2Pulse() or be a subclass of RFPulse. The phase of the pulses are overridden in the sequence. Defaults to None, in which case a RectangularPulse with the default amplitude and frequency for the selected Transition is used.

  • decoupling (list of RFBlock, optional) – A decoupling sequence (generated by XY8(), for example) to insert during the dark time. The duration of Wait commands is adjusted to make the total length equal to duration. Must only contain RFPulse and Wait blocks. Defaults to None.

Returns:

Returns a list of pulses and Wait commands implementing a Ramsey sequence.

Return type:

list of RFBlock

class synthesizer.synthesizer_sequences.RectangularPulse(duration: float, amplitude: float, phase: float | None = None, frequency: float | None = None, centered: bool = False)

Bases: RFPulse

Generates a rectangular pulse.

__init__(duration: float, amplitude: float, phase: float | None = None, frequency: float | None = None, centered: bool = False) None

Refer to Pulse() for descriptions of the arguments.

property area: float

Returns the area of the pulse, relative to a rectangular pulse of the same duration and peak amplitude.

Returns:

The area of the pulse, relative to a rectangular pulse of the same duration and peak amplitude

Return type:

(float)

compile(self)

Compiles the block into a list of basic RFBlock that can be sent to the synthesizer.

Parameters:

state (SequenceState, optional) – The state of the channel when the block is to be called. Defaults to None, which can be used for testing compile functions of RFBlock objects that do not depend on channel state.

Returns:

The compiled RFBlock.

Return type:

(RFBlock | List[RFBlock])

class synthesizer.synthesizer_sequences.SequenceState(amplitude: float = 0, phase: float = 0, frequency: float = 1000000.0, transition: Transition | None = None, time: float = 0, triggers: int = 0, syncpoints: List[SyncPoint] = [], digital_out: List[bool] = [False, False, False, False, False, False, False])

Bases: object

Records the state of a synthesizer channel at any point in the sequence. Used by compile_sequence() and the RFBlock.compile().

__init__(amplitude: float = 0, phase: float = 0, frequency: float = 1000000.0, transition: Transition | None = None, time: float = 0, triggers: int = 0, syncpoints: List[SyncPoint] = [], digital_out: List[bool] = [False, False, False, False, False, False, False]) None
Parameters:
  • amplitude (float) – The amplitude of the channel. Defaults to 0.

  • phase (float) – The phase of the channel. Defaults to 0.

  • frequency (float) – The frequency of the channel. Defaults to 1E6.

  • transition (Transition) – The selected transition, as set by SetTransition. Defaults to None.

  • time (float) – The time since the start or the last trigger. Defaults to 0.

  • triggers (int) – The number of triggers required so far. Defaults to 0.

  • syncpoints (list of str) – The ordered list of SyncPoint so far. Defaults to [].

  • digital_out (list of bool) – The state of the digital outputs. Defaults to [False]*7.

class synthesizer.synthesizer_sequences.SetTransition(transition: Transition)

Bases: RFBlock

Sets the transition to be used for subsequent AreaPulse() commands.

__init__(transition: Transition) None
Parameters:

transition (Transition) – The transition to use for the following AreaPulse() commands.

atomic = True
compile(self)

Compiles the block into a list of basic RFBlock that can be sent to the synthesizer.

Parameters:

state (SequenceState, optional) – The state of the channel when the block is to be called. Defaults to None, which can be used for testing compile functions of RFBlock objects that do not depend on channel state.

Returns:

The compiled RFBlock.

Return type:

(RFBlock | List[RFBlock])

synthesizer.synthesizer_sequences.SpinEcho(duration, pulse=None)

Returns a list of pulses and Wait commands implementing a spin echo decoupling sequence consisting of a duration/2 Wait, a pi pulse about the x axis and another duration/2 Wait.

Parameters:
  • duration (float) – The duration of the decoupling sequence in seconds.

  • pulse (RFPulse, optional) – The pulse to use for the pi pulses in the decoupling sequence. Should normally be generated by PiPulse() or be a subclass of RFPulse. The phase of the pulse is overridden in the sequence. Defaults to None, in which case a RectangularPulse with the default amplitude and frequency for the selected Transition is used.

Returns:

Returns a list of pulses and Wait commands implementing a spin echo decoupling sequence.

Return type:

list of RFBlock

class synthesizer.synthesizer_sequences.SyncPoint(name: str)

Bases: RFBlock

Allows different channels to be synchronized. If SyncPoints with the same name appear in different channels, an appropriate sequence of Wait blocks are inserted into the channels for which it would occur earlier such that all channels reach the SyncPoint at the same time.

Throws an error upon compilation if multiple SyncPoints with the same name occur in one channel’s sequence or in an order such that they cannot be applied.

__init__(name: str) None
Parameters:

name – An identifier for the synchronization point.

atomic = True
compile(self)

Compiles the block into a list of basic RFBlock that can be sent to the synthesizer.

Parameters:

state (SequenceState, optional) – The state of the channel when the block is to be called. Defaults to None, which can be used for testing compile functions of RFBlock objects that do not depend on channel state.

Returns:

The compiled RFBlock.

Return type:

(RFBlock | List[RFBlock])

class synthesizer.synthesizer_sequences.Timestamp(duration: float, amplitude: float | None = None, phase: float | None = None, frequency: float | None = None, wait_for_trigger: bool | None = False, digital_out: dict | None = {}, absolute_phase: bool | None = False)

Bases: RFBlock

A single timestamp, at which the amplitude, phase, and frequency of the tone can be set for a specified duration.

__init__(duration: float, amplitude: float | None = None, phase: float | None = None, frequency: float | None = None, wait_for_trigger: bool | None = False, digital_out: dict | None = {}, absolute_phase: bool | None = False) None
Parameters:
  • duration (float) – The duration of the timestamp. If the duration is zero, the parameters override ommited parameters in the next Timestamp.

  • amplitude (float, optional) – The amplitude of the tone relative to full scale. Defaults to None, in which case the previous amplitude is maintained.

  • phase (float, optional) – The phase of the tone in radians. Defaults to None, in which case the previous phase is maintained.

  • frequency (float, optional) – The frequency of the tone in Hertz. Defaults to None, in which case the previous frequency is maintained.

  • wait_for_trigger (bool, optional) – Whether to wait for a trigger to start the timestamp. Defaults to False.

  • ({int (digital_out) – bool}, optional): A dictionary with keys (integers between 0 and 6) corresponding to the indices of digital outputs to set and boolean values corresponding to the desired state of the output. If a key is not present, the corresponding output is unchanged. Only used for the first channel. Defaults to {}.

  • absolute_phase (bool, optional) – If true, sets the phase to phase radians at the beginning of the timestamp. Otherwise offsets the phase to phase radians relative to a reference clock. If True, phase must not be None. Defaults to False.

atomic = True
compile(self)

Compiles the block into a list of basic RFBlock that can be sent to the synthesizer.

Parameters:

state (SequenceState, optional) – The state of the channel when the block is to be called. Defaults to None, which can be used for testing compile functions of RFBlock objects that do not depend on channel state.

Returns:

The compiled RFBlock.

Return type:

(RFBlock | List[RFBlock])

class synthesizer.synthesizer_sequences.Transition(frequency: float, amplitudes, Rabi_frequencies=None, default_amplitude: float | None = None, frequency_offset: float = 0)

Bases: object

Describes the calibrated frequency and Rabi frequencies for a transition. Used in SetTransition to set parameters for AreaPulse().

Rabi_frequency(self, amplitude=None)

Computes the Rabi frequency corresponding to amplitude using interpolation or extrapolation from the values provided by amplitudes and Rabi_frequencies.

Parameters:

amplitude (float, optional) – The amplitude for which to compute the Rabi frequency. Defaults to None, in which case default_amplitude is used.

Returns:

The Rabi frequency, in Hertz, associated with amplitude.

Return type:

float

__init__(frequency: float, amplitudes, Rabi_frequencies=None, default_amplitude: float | None = None, frequency_offset: float = 0) None
Parameters:
  • frequency (float) – The frequency of the transition in Hertz.

  • amplitudes (dict or list of float) – A list of amplitudes (relative to full scale) for which the Rabi frequencies are calibrated. Linearly interpolates and extrapolates relative to specified amplitudes. Can also take a dictionary with amplitude keys and Rabi frequency values, in which case Rabi_frequencies is ignored.

  • Rabi_frequencies (list of float, optional) – A list of Rabi frequencies (in Hertz) corresponding to amplitudes. Must be the same length as amplitudes if lists are used. Defaults to None.

  • default_amplitude (float, optional) – The default amplitude for pulses on the transition. Defaults to None, in which case the first element of amplitudes is used.

  • frequency_offset (float, optional) – The frequency (in Hertz) of the tone that is mixed with the synthesizer output. The actual output frequency of the synthesizer is frequency - frequency_offset. Defaults to 0.

synthesizer.synthesizer_sequences.WAHUHA(duration: float, pulse: RFPulse | None = None)
class synthesizer.synthesizer_sequences.Wait(duration: float, wait_for_trigger: bool = False)

Bases: Timestamp

Waits for a fixed duration.

__init__(duration: float, wait_for_trigger: bool = False) None
Parameters:
  • duration (float) – The duration to wait in seconds.

  • wait_for_trigger (bool) – Whether to wait for a trigger. Defaults to False.

synthesizer.synthesizer_sequences.XY16(duration, pulse=None)

Returns a list of pulses and Wait commands implementing an XY16 decoupling sequence. Refer to this review for information about the XY8 pulse sequence.

Parameters:
  • duration (float) – The duration of the decoupling sequence in seconds.

  • pulse (RFPulse, optional) – The pulse to use for the pi pulses in the decoupling sequence. Should normally be generated by PiPulse() or be a subclass of RFPulse. The phase of the pulses are overridden in the sequence. Defaults to None, in which case a RectangularPulse with the default amplitude and frequency for the selected Transition is used.

Returns:

Returns a list of pulses and Wait commands implementing an XY16 decoupling sequence.

Return type:

list of RFBlock

synthesizer.synthesizer_sequences.XY8(duration, pulse=None)

Returns a list of pulses and Wait commands implementing an XY8 decoupling sequence. Refer to this review for information about the XY8 pulse sequence.

Parameters:
  • duration (float) – The duration of the decoupling sequence in seconds.

  • pulse (RFPulse, optional) – The pulse to use for the pi pulses in the decoupling sequence. Should normally be generated by PiPulse() or be a subclass of RFPulse. The phase of the pulses are overridden in the sequence. Defaults to None, in which case a RectangularPulse with the default amplitude and frequency for the selected Transition is used.

Returns:

Returns a list of pulses and Wait commands implementing an XY8 decoupling sequence.

Return type:

list of RFBlock

synthesizer.synthesizer_sequences.compile_sequence(sequence)
Compilation steps:
  • Compiles instance of RFBlock with compile functions

  • Updates durations based on AdjustPrevDuration and AdjustNextDuration

  • Replaces SyncPoint blocks with Wait blocks.

  • Converts timestamps from relative to absolute time

  • Computes durations of each section of the sequence

  • Outputs the sequence in a list of serializable dictionaries that can be sent to the synthesizer server.

Parameters:
  • sequence (dictionary of lists of RFBlock) – The sequence to compile. Keys should be channels, values should be list of RFBlock.

  • output_json (bool) – Outputs a JSON-formatted string of timestamos that can be sent to synthesizer.synthesizer_server if True, or a list of RFBlock if False. Defaults to True.

Returns

((List[RFBlock] | str), Dict[int : List[float]]): A tuple containing the compiled sequence and a list of lists the durations of the sequences for each channel

synthesizer.synthesizer_sequences.fromdB(amplitude_dB)

Converts an amplitude ratio from decibels to linear per \(A = 10^{A_{dB}/20}\).

Parameters:

amplitude_lin (float) – An amplitude ratio in decibels.

Returns:

The amplitude ratio.

Return type:

float

synthesizer.synthesizer_sequences.plot_sequence(seq)

Plots a sequence using Plotly.

Parameters:

seq ([RFBlock]) – The sequence to plot

synthesizer.synthesizer_sequences.send_seq(seq)
synthesizer.synthesizer_sequences.todB(amplitude_lin)

Converts an amplitude ratio from linear to decibels per \(A_{dB} = 20 \log_{10}(A)\).

Parameters:

amplitude_lin (float) – An amplitude ratio.

Returns:

The amplitude ratio in decibels.

Return type:

float

synthesizer.synthesizer_sequences.validate_parameters(duration=None, amplitude=None, phase=None, frequency=None)

Checks that commonly used parameters are within acceptable ranges.

Parameters:
  • duration (float, optional) – Duration in seconds. Checks that it’s non-negative. Defaults to None.

  • amplitude (float, optional) – Amplitude relative to full scale. Checks that it’s between zero and one. Defaults to None.

  • phase (float, optional) – Phase in radians. Checks that it’s a real number. Defaults to None.

  • frequency (float, optional) – Frequency in Hertz. Checks that it’s between zero and MAX_FREQUENCY. Defaults to None.

Raises:

ValueError – If any of the parameters are not None and outside their valid range.