View source on GitHub |
Takes cirq.Circuit objects and displays them in 3D.
Inherits From: Widget
cirq_web.circuits.Circuit3D(
circuit: cirq.Circuit,
resolvers: Iterable[cirq_web.circuits.symbols.SymbolResolver
] = cirq_web.circuits.circuit.DEFAULT_SYMBOL_RESOLVERS
,
padding_factor: float = 1
)
Args | |
---|---|
circuit
|
The cirq.Circuit to be represented in 3D.
|
resolvers
|
The symbol resolve for how to show symbols in 3D. |
padding_factor
|
The distance between meshes. |
Methods
generate_html_file
generate_html_file(
output_directory: str = './',
file_name: str = 'bloch_sphere.html',
open_in_browser: bool = False
) -> str
Generates a portable HTML file of the widget that can be run anywhere. Prints out the absolute path of the file to the console.
Args | |
---|---|
output_directory
|
the directory in which the output file will be generated. The default is the current directory ('./') |
file_name
|
the name of the output file. Default is 'bloch_sphere' |
open_in_browser
|
if True, opens the newly generated file automatically in the browser. |
Returns | |
---|---|
The path of the HTML file in as a Path object. |
get_client_code
get_client_code() -> str
Returns HTML code to render the widget.
get_widget_bundle_name
get_widget_bundle_name() -> str
Returns the name of the Javascript library file for this widget.