Shell¶
- class Shell(faces)[source]¶
Bases:
ShapeObject
Shell inherits from ShapeObject
Inits Shell. Each shell keeps track internally of several lists for each type of subcomponent (ex: faces, wireframes, edges, vertices) :type faces:
List
[Face
] :param faces: Faces that make up the Shell instance :type faces: List[Face]Methods
- add_parent(parent)¶
Adds parent
- Parameters:
parent (ShapeObject) – Adds parent
- Return type:
None
- static create_id()¶
Creates int as unique ID for ShapeObject instance. ShapeObject class tracks which IDs have previously been used and are thus not available.
- Returns:
Unique ID
- Return type:
int
- draw(qubit_data=None, show_index=False, show_face_ids=False, show_axis=True, face_colors=False, show_qubits=True, figsize=None, point_size=50, xcolor='tomato', zcolor='yellowgreen', ycolor='steelblue', **kwargs)[source]¶
Draws the shell
Coloring only works at the moment for CSS codes.
- Parameters:
qubit_data (Optional[QubitData], optional) – _description_. Defaults to None.
show_index (bool, optional) – _description_. Defaults to False.
show_face_ids (bool, optional) – _description_. Defaults to False.
show_axis (bool, optional) – _description_. Defaults to True.
face_colors (bool, optional) – _description_. Defaults to False.
show_qubits (bool, optional) – _description_. Defaults to True.
figsize (Optional[Tuple[float, float]], optional) – _description_. Defaults to None.
point_size (optional) – size of points for qubits or vertices. Default is 50
xcolor (str, optional) – _description_. Defaults to “tomato”.
zcolor (str, optional) – _description_. Defaults to “yellowgreen”.
ycolor (str, optional) – _description_. Defaults to “steelblue”.
**kwargs – other options
- Returns:
_description_
- Return type:
_type_
- extract(is_inside, qubit_data, qubit_count, levels=None, inside_levels=None, boundary_levels=None, exclude=None, boundary_strategy='combine', debug=False)[source]¶
Extracts the subshell defined by in_vertices and is_inside
- Parameters:
is_inside (Dict[Vertex,bool]) – _description_
qubit_data (QubitData) – _description_
qubit_count (QubitCount) – _description_
levels (Optional[List[int]], optional) – _description_. Defaults to [2,3,4]
inside_levels (optional) – Which operator weights to include for operators inside the cutter region. Default is levels
boundary_levels (optional) – Which operator weights to include for operators cut by the cutter region (on the boundary). Default is levels
exclude (optional) –
method used to determine which boundary operators are to be used. Must be of the form
- def exclude(vertex_paths: List[List[Vertex]], qubit_data: QubitData) -> bool:
pass
Will return a True value if the given operator (given by the vertex_paths) is to be excluded. Deflault always returns False. That is exlude nothing extra.
boundary_strategy (str, optional) – _description_. Defaults to “combine”.
debug (optional) – With debug set to True a range of intermediate details are printed. Used
method. (for debuging the addition of features to the)
- Returns:
_description_
- Return type:
Tuple[Shell, QubitData, QubitCount]
- rotate2d(angle=90, about_point=None)[source]¶
Inplace rotation of shell
- Parameters:
angle (Optional[float], optional) – _description_. Defaults to 90.
about_point (Optional[Tuple[float]], optional) – _description_. Defaults to None.
- Return type:
None
- scale(scale=1)[source]¶
Scale the shell by scale
- Parameters:
scale (float, optional) – Scaling value. Defaults to 1.
- Return type:
None
- static shell2symplectic(shell, qubit_data, qubit_count, from_index=None, from_qubit=None)[source]¶
Converts a shell into a symplectic matrix given the qubit data and counts
- Parameters:
shell (Shell) – _description_
qubit_data (QubitData) – _description_
qubit_count (QubitCount) – _description_
from_index (Optional[Dict[int,int]], optional) – _description_. Defaults to None.
from_qubit (Optional[Dict[int,int]], optional) – _description_. Defaults to None.
- Returns:
_description_
- Return type:
- shift(vector=None)[source]¶
Shift/traslate the shell by vector
- Parameters:
vector (optional) – Shift/traslate the shell by vector. Defaults to None.
- Return type:
None
- union(other_shell)[source]¶
Add all subcomponents of other_shell to self.
Must be disjoint at moment.
- Parameters:
other_shell (Shell) – A different shell
Attributes
- last_id = 0¶