This package contains classes and functions for creating time-domain algorithms in Strawberry Fields.


borealis_gbs(device[, modes, squeezing, …])

Creates a GBS instance in form of a gates_args dictionary that can be directly submitted to a TDMProgram.

full_compile(gate_args, device[, delays, …])

Makes a user-defined set of gate arguments compatible with TDMProgram and the Borealis hardware.


Calculates the mode indices for use in a TDMProgram.


Checks whether a variable name is a p-type variable.


Extracts the three loop-phase offsets from the device specification.

make_phases_compatible(gate_args, device[, …])

Adds a pi offset to the phase-gate arguments that cannot be applied by the Borealis modulators.

make_squeezing_compatible(gate_args, device)

Matches the user-defined squeezing values to a discrete set of squeezing levels supported by the device.

move_vac_modes(samples, N[, crop])

Moves all measured vacuum modes from the first shot of the returned TDM samples array to the end of the last shot.

random_bs(length[, low, high])

Creates a list of random beamsplitter arguments for GBS jobs.

random_r(length[, low, high])

Creates a list of random rotation-gate arguments for GBS jobs.

reshape_samples(samples_dict, modes, N, timebins)

Reshapes the samples dict so that they have the expected correct shape.

shift_by(l, n)

Convenience function to shift a list by a number of steps.

to_args_dict(gate_list, device)

Takes the gate arguments as a list and returns them as a dictionary.

to_args_list(gate_dict[, device])

Takes the gate arguments as a dictionary and returns them as a list.

vacuum_padding(gate_args[, delays])

Pad the gate arguments with 0 for vacuum modes.