Generator package

Submodules

Devices module

class c3.generator.devices.AWG(name: str = 'awg', desc: str = ' ', comment: str = ' ', resolution: numpy.float64 = 0.0, logdir: str = '/tmp/')[source]

Bases: c3.generator.devices.Device

AWG device, transforms digital input to analog signal.

Parameters

logdir (str) – Filepath to store generated waveforms.

create_IQ(channel: str, components: dict, t_start: float, t_end: float)[source]

Construct the in-phase (I) and quadrature (Q) components of the signal. These are universal to either experiment or simulation. In the xperiment these will be routed to AWG and mixer electronics, while in the simulation they provide the shapes of the instruction fields to be added to the Hamiltonian.

Parameters
  • channel (str) – Identifier for the selected drive line.

  • components (dict) – Separate signals to be combined onto this drive line.

  • t_start (float) – Beginning of the signal.

  • t_end (float) – End of the signal.

Returns

Waveforms as I and Q components.

Return type

dict

enable_drag()[source]
enable_drag_2()[source]
get_I()[source]
get_Q()[source]
get_average_amp()[source]

Compute average and sum of the amplitudes. Used to estimate effective drive power for non-trivial shapes.

Returns

Average and sum.

Return type

tuple

log_shapes()[source]
params: dict
class c3.generator.devices.Device(name: str = ' ', desc: str = ' ', comment: str = ' ', resolution: numpy.float64 = 0.0)[source]

Bases: c3.c3objs.C3obj

A Device that is part of the stack generating the instruction signals.

Parameters

resolution (np.float64) – Number of samples per second this device operates at.

calc_slice_num(t_start: numpy.float64, t_end: numpy.float64)[source]

Effective number of time slices given start, end and resolution.

Parameters
  • t_start (np.float64) – Starting time for this device.

  • t_end (np.float64) – End time for this device.

create_ts(t_start: numpy.float64, t_end: numpy.float64, centered: bool = True)[source]

Compute time samples.

Parameters
  • t_start (np.float64) – Starting time for this device.

  • t_end (np.float64) – End time for this device.

  • centered (boolean) – Sample in the middle of an interval, otherwise at the beginning.

params: dict
prepare_plot()[source]
write_config()[source]

Return the current device as a JSON compatible dict.

class c3.generator.devices.Digital_to_Analog(name: str = 'dac', desc: str = ' ', comment: str = ' ', resolution: numpy.float64 = 0.0)[source]

Bases: c3.generator.devices.Device

Take the values at the awg resolution to the simulation resolution.

params: dict
resample(awg_signal, t_start, t_end)[source]

Resample the awg values to higher resolution.

Parameters
  • awg_signal (tf.Tensor) – Bandwith-limited, low-resolution AWG signal.

  • t_start (np.float64) – Beginning of the signal.

  • t_end (np.float64) – End of the signal.

Returns

Inphase and Quadrature compontent of the upsampled signal.

Return type

dict

class c3.generator.devices.Filter(name: str = 'FLTR', desc: str = ' ', comment: str = ' ', resolution: numpy.float64 = 0.0, filter_function: function = None)[source]

Bases: c3.generator.devices.Device

Apply a filter function to the signal.

filter(Hz_signal)[source]

Apply a filter function to the signal.

params: dict
class c3.generator.devices.FluxTuning(name: str = ' ', desc: str = ' ', comment: str = ' ', resolution: numpy.float64 = 0.0, phi_0: float = 0.0, Phi: float = 0.0, omega_0: float = 0.0)[source]

Bases: c3.generator.devices.Device

Flux tunable qubit frequency.

Parameters
frequency(signal)[source]

Compute the qubit frequency resulting from an applied flux.

Parameters

signal (tf.float64) –

Returns

Qubit frequency.

Return type

tf.float64

params: dict
class c3.generator.devices.LO(name: str = 'lo', desc: str = ' ', comment: str = ' ', resolution: numpy.float64 = 0.0)[source]

Bases: c3.generator.devices.Device

Local oscillator device, generates a constant oscillating signal.

create_signal(channel: dict, t_start: float, t_end: float)[source]

Generate a sinusodial signal.

Parameters
  • channel (dict) – Drive channels.

  • t_start (float) – Beginning of the signal.

  • t_end (float) – End of the signal.

Returns

Local oscillator signal and frequency.

Return type

dict, tf.float64

params: dict
class c3.generator.devices.Mixer(name: str = 'mixer', desc: str = ' ', comment: str = ' ', resolution: numpy.float64 = 0.0)[source]

Bases: c3.generator.devices.Device

Mixer device, combines inputs from the local oscillator and the AWG.

combine(lo_signal, awg_signal)[source]

Combine signal from AWG and LO.

Parameters
  • lo_signal (dict) – Local oscillator signal.

  • awg_signal (dict) – Waveform generator signal.

Returns

Mixed signal.

Return type

dict

params: dict
class c3.generator.devices.Readout(name: str = 'readout', desc: str = ' ', comment: str = ' ', resolution: numpy.float64 = 0.0, factor: c3.c3objs.Quantity = None, offset: c3.c3objs.Quantity = None)[source]

Bases: c3.generator.devices.Device

Mimic the readout process by multiplying a state phase with a factor and offset.

Parameters
params: dict
readout(phase)[source]

Apply the readout rescaling

Parameters

phase (tf.float64) – Raw phase of a quantum state

Returns

Rescaled readout value

Return type

tf.float64

class c3.generator.devices.Response(name: str = 'resp', desc: str = ' ', comment: str = ' ', resolution: numpy.float64 = 0.0, rise_time: c3.c3objs.Quantity = None)[source]

Bases: c3.generator.devices.Device

Make the AWG signal physical by convolution with a Gaussian to limit bandwith.

Parameters

rise_time (Quantity) – Time constant for the gaussian convolution.

convolve(signal: list, resp_shape: list)[source]

Compute the convolution with a function.

Parameters
  • signal (list) – Potentially unlimited signal samples.

  • resp_shape (list) – Samples of the function to model limited bandwidth.

Returns

Processed signal.

Return type

tf.Tensor

params: dict
process(iq_signal)[source]

Apply a Gaussian shaped limiting function to an IQ signal.

Parameters

iq_signal (dict) – I and Q components of an AWG signal.

Returns

Bandwidth limited IQ signal.

Return type

dict

class c3.generator.devices.Volts_to_Hertz(name: str = 'v_to_hz', desc: str = ' ', comment: str = ' ', resolution: numpy.float64 = 0.0, V_to_Hz: c3.c3objs.Quantity = None, offset=None)[source]

Bases: c3.generator.devices.Device

Convert the voltage signal to an amplitude to plug into the model Hamiltonian.

Parameters
  • V_to_Hz (Quantity) – Conversion factor.

  • offset (tf.float64) – Drive frequency offset.

params: dict
transform(mixed_signal, drive_frequency)[source]

Transform signal from value of V to Hz.

Parameters
  • mixed_signal (tf.Tensor) – Waveform as line voltages after IQ mixing

  • drive_frequency (Quantity) – For frequency-dependent attenuation

Returns

Waveform as control amplitudes

Return type

tf.Tensor

Generator module

Signal generation stack.

Contrary to most quanutm simulators, C^3 includes a detailed simulation of the control stack. Each component in the stack and its functions are simulated individually and combined here.

Example: A local oscillator and arbitrary waveform generator signal are put through via a mixer device to produce an effective modulated signal.

class c3.generator.generator.Generator(devices: list, resolution: numpy.float64 = 0.0)[source]

Bases: object

Generator, creates signal from digital to what arrives to the chip.

Parameters
  • devices (list) – Physical or abstract devices in the signal processing chain.

  • resolution (np.float64) – Resolution at which continuous functions are sampled.

generate_signals(instr: c3.signal.gates.Instruction)[source]

Perform the signal chain for a specified instruction, including local oscillator, AWG generation and IQ mixing.

Parameters

instr (Instruction) – Operation to be performed, e.g. logical gate.

Returns

Signal to be applied to the physical device.

Return type

dict

write_config()[source]

Module contents