sf.io.load

load(f)[source]

Load a quantum program from a Blackbird .xbb file.

Example:

The following Blackbird file, program1.xbb,

name test_program
version 1.0

Sgate(0.543, 0.0) | 1
BSgate(0.6, 0.1) | [2, 0]
MeasureFock() | [0, 1, 2]

can be imported into Strawberry Fields using the loads function:

>>> sf.loads("program1.xbb")
>>> prog.name
'test_program'
>>> prog.num_subsystems
3
>>> prog.print()
Sgate(0.543, 0) | (q[1])
BSgate(0.6, 0.1) | (q[2], q[0])
MeasureFock | (q[0], q[1], q[2])
Parameters

f (Union[file, str, pathlib.Path]) – File or filename to which the data is saved. If file is a file-object, then the filename is unchanged. If file is a string or Path, a .xbb extension will be appended to the file name if it does not already have one.

Returns

Strawberry Fields program

Return type

prog (Program)