ChunkTiming

class samplomatic.quantum_program.ChunkTiming(spans: Iterable[ChunkSpan])[source]

Bases: object

A collection of chunk timing information for a QuantumProgramResult.

This class is a readonly list-like containing ChunkSpan objects, where each span represents a single execution chunk on the backend and contains timing information and a description of which parts of the QuantumProgram were executed in that chunk.

To iterate over chunks:

chunk_timings = job.result().timing
for chunk in chunk_timings:
    print(chunk)

To draw the timings for a single result:

chunk_timings.draw()

To draw the timings for several results on one plot:

from samplomatic.visualization.draw_chunk_timings import draw_chunk_timings

draw_chunk_timings(
    chunk_timings1,
    chunk_timings2,
    names=["job 1", "job 2"],
    common_start=True,
)

Attributes Summary

duration

The total duration from first start to last stop, in seconds.

start

The start time of the earliest chunk, in UTC.

stop

The stop time of the latest chunk, in UTC.

Methods Summary

draw([name, normalize_y, line_width, tz])

Draw timing information on a bar plot.

Attributes Documentation

duration

The total duration from first start to last stop, in seconds.

start

The start time of the earliest chunk, in UTC.

stop

The stop time of the latest chunk, in UTC.

Methods Documentation

draw(name: str | None = None, normalize_y: bool = False, line_width: int = 4, tz: timezone | None = None) PlotlyFigure[source]

Draw timing information on a bar plot.

To draw chunk timings with additional options like common_start, or to draw timings of several jobs on the same axis, consider calling draw_chunk_timings() directly.

Parameters:
  • name – A label for this set of chunks.

  • normalize_y – Whether to display the y-axis units as a percentage of work complete, rather than cumulative elements completed.

  • line_width – The thickness of line segments.

  • tz – The timezone to use for displaying times. None (default) uses the local system timezone. Pass datetime.timezone.utc to display times in UTC.

Returns:

A plotly figure.