gettables_profiled#

This module represents the Q-Profile quantum control electronics profiler.

Profiling of the control electronics is enabled by using the ProfiledScheduleGettable in place of ScheduleGettable.

Note

The ProfiledScheduleGettable is currently only tested to support Qblox hardware.

Module Contents#

Classes#

ProfiledInstrumentCoordinator

Subclass of InstrumentCoordinator that implements a profiling tool to log

ProfiledScheduleGettable

To be used in place of ScheduleGettable to enable profiling of the

Functions#

profiler(func)

Decorator that reports the execution time of the decorated function

profiler(func)[source]#

Decorator that reports the execution time of the decorated function and stores this in ProfiledInstrumentCoordinator.profile.

Parameters:

func (Callable) – Target function to be profiled.

class ProfiledInstrumentCoordinator(name: str, parent_ic: quantify_scheduler.instrument_coordinator.instrument_coordinator.InstrumentCoordinator)[source]#

Bases: quantify_scheduler.instrument_coordinator.instrument_coordinator.InstrumentCoordinator

Subclass of InstrumentCoordinator that implements a profiling tool to log timing results. Time results are stored in ProfiledInstrumentCoordinator.profile.

ProfiledInstrumentCoordinator is set up to be used when using ProfiledScheduleGettable, code example:

ic = InstrumentCoordinator(name="instrument_coordinator")

quantum_device = QuantumDevice(name="quantum_device")
quantum_device.instr_instrument_coordinator(ic.name)

profiled_gettable = ProfiledScheduleGettable(
    quantum_device=quantum_device,
    schedule_function=...,
    schedule_kwargs=...,
)

profiled_gettable.initialize()
profiled_ic = (
    profiled_gettable.quantum_device.instr_instrument_coordinator.get_instr()
)
Parameters:
profile[source]#
parent_ic[source]#
plot = None[source]#
add_component(component) None[source]#

Adds a component to the components collection.

Parameters:

component – The component to add.

Raises:
  • ValueError – If a component with a duplicated name is added to the collection.

  • TypeError – If component is not an instance of the base component.

prepare(compiled_schedule) None[source]#

Prepares each component for execution of a schedule.

It attempts to configure all instrument coordinator components for which compiled instructions, typically consisting of a combination of sequence programs, waveforms and other instrument settings, are available in the compiled schedule.

Parameters:

compiled_schedule – A schedule containing the information required to execute the program.

Raises:
  • KeyError – If the compiled schedule contains instructions for a component absent in the instrument coordinator.

  • TypeError – If the schedule provided is not a valid CompiledSchedule.

start()[source]#

Start all of the components that appear in the compiled instructions.

The instruments will be started in the order in which they were added to the instrument coordinator.

stop(allow_failure=False)[source]#

Stops all components.

The components are stopped in the order in which they were added.

Parameters:

allow_failure – By default it is set to False. When set to True, the AttributeErrors raised by a component are demoted to warnings to allow other components to stop.

retrieve_acquisition()[source]#

Retrieves the latest acquisition results of the components with acquisition capabilities.

Returns:

The acquisition data in an xarray.Dataset. For each acquisition channel it contains an xarray.DataArray.

wait_done(timeout_sec: int = 10)[source]#

Awaits each component until it is done.

The timeout in seconds specifies the allowed amount of time to run before it times out.

Parameters:

timeout_sec – The maximum amount of time in seconds before a timeout.

class ProfiledScheduleGettable(*args, **kwargs)[source]#

Bases: quantify_scheduler.gettables.ScheduleGettable

To be used in place of ScheduleGettable to enable profiling of the compilation. Logged execution times can be read from self.profile, and plotted via plot_profile().

profile[source]#
plot = None[source]#
instr_coordinator[source]#
profiled_instr_coordinator[source]#
_compile(sched)[source]#

Overwrite compile step for profiling.

close()[source]#

Cleanup new profiling instruments to avoid future conflicts.

log_profile(obj=None, path='profiling_logs', filename=None, indent: int = 4, separators=None)[source]#

Store profiling logs to json file.

plot_profile(path=None, filename='average_runtimes.pdf')[source]#

Create barplot of accumulated profiling data.