Skip to content

laboneq.simulator

laboneq.simulator.output_simulator

OutputSimulator(compiled_experiment, max_simulation_length=None, max_output_length=1e-05)

Interface to the output simulator.

Parameters:

Name Type Description Default
compiled_experiment CompiledExperiment

The compiled experiment to simulate.

required
max_simulation_length float | None

The maximum amount of time to simulate (in seconds).

None
max_output_length float

Deprecated and has no effect. Use the output_length argument to the get_snippet method instead.

1e-05

Attributes:

Name Type Description
max_output_length float

Deprecated and has no effect. Use the output_length argument to the get_snippet method instead.

Examples:

Example showing how to compile an experiment and make use of the
output simulator:

``` py
# Given compiled_experiment
compiled_experiment = session.compile(exp)

# Create an output simulation object
output_simulator = OutputSimulator(compiled_experiment)

# By default, simulation is stopped after 10 ms, but it can be explicitly specified
output_simulator = OutputSimulator(compiled_experiment, max_simulation_length=10e-3)

# Also the maximum output snippet length is configurable, defaulting to 1us
output_simulator = OutputSimulator(compiled_experiment, max_output_length=5e-6)

# Maximum output length can also be set later
output_simulator.max_output_length = 5e-6

# As next, retrieve the actual simulated waveform
data = output_simulator.get_snippet(
    physical_channel,
    start=1e-6,
    output_length=500e-9,
    get_wave=True,  # Default True
    get_trigger=True,  # Default False
    get_frequency=True,  # Default False
)

# Returned structure has 4 members, each is a numpy array
data.time  # time axis
data.wave  # waveform data
data.trigger  # trigger values
data.frequency  # frequency data
```

max_output_length: float property writable

get_snippet(physical_channel, start, output_length, channel_type=PhysicalChannelType.IQ_CHANNEL, get_wave=True, get_trigger=False, get_marker=False, get_frequency=False)

Retrieve the simulated waveforms for a given channel and window of time.

Parameters:

Name Type Description Default
physical_channel str | PhysicalChannel

The physical channel to retrieve waveforms for.

required
start float

The start time of the window of events to retrieve (in seconds).

required
output_length float

The maximum length of the window to retrieve (in seconds).

required
get_wave bool

Whether to return the waveform data.

True
get_trigger bool

Whether to return the trigger data.

False
get_marker bool

Whether to return the marker data.

False
get_frequency bool

Whether to return the oscillator frequency data.

False

Returns:

Type Description
OutputData

The output data has the following attributes:

  • time: an array of the times corresponding to the returned waveform samples.
  • wave: an array of waveform values at the given times.
  • trigger: an array of trigger values at the given times.
  • frequency: an array of oscillator frequencies at the given times.

The corresponding attribute is None if the associated data was not requested.