qat.experimental.frontend.importer.pulse.purr module

class PurrImporter(post_processing_factory=None)

Bases: object

Takes a PuRR builder and produces a module representing that program.

From a high-level, the module consists of two objects:

  1. A kernel that contains the pulse instructions and any acquisition instructions, embedded within the shot loop. This kernel returns a results collection.

  2. A main function that calls the kernel and applies any post-processing to the results through a results.map operation. The main function returns the results collection after post-processing has been applied.

The importer does not currently support sweeps, or general device updates and parameterised operation operands.

The importer starts by doing an analysis walk through the builder, understanding what results processing operations happen, and collecting unique pulse channels (frames). This allows us to structure the program in a way that does not necessarily map onto the builder in a linear fashion, but instead allows us to produce the structure described above.

Initialise the importer.

Parameters:

post_processing_factory (Optional[PostProcessingFactory]) –

Optional post-processing factory. When provided, it supplies both stages of results post-processing:

  • each post-processing chain that does not already discriminate is terminated with a DiscriminateOp carrying the calibrated policy of the channel associated with the acquisition;

  • a PostSelectOp is inserted after the results map in the main function, filtering shots whose discriminated states are disallowed.

Pass PostProcessingFactory(PostProcessingView.derive(system_data), post_selection_enabled=config.post_selection) at the call site.

build(purr_ir)

Translate purr_ir into a module containing a kernel and a main function.

Parameters:

purr_ir (QuantumInstructionBuilder) – The purr IR to translate.

Return type:

ModuleOp

translate(instruction, builder)
Return type:

None