Creating Basic Geometries

Creating Basic Geometries#

[1]:
%matplotlib inline
%config InlineBackend.figure_format='retina'

# use '%matplotlib widget' for interactive plot

import sys
import numpy as np
import matplotlib.pyplot as plt


from zeroheliumkit import Anchor, Structure, MicroChannels, Taper, SpiralInductor, IDC, Fillet, Layer
from zeroheliumkit import Square, Rectangle, Circle, RegularPolygon
from zeroheliumkit.src.settings import *

plot_cfg = {"layer1": BLUE, "layer2": YELLOW2, "anchors": RED, "skeletone":CYAN}
[2]:
### Simple geometries
[3]:
s = Structure()
s.add(Layer("layer1", Square(5, direction=37)))

a = Structure()
a.add(Layer("layer2", Rectangle(5, 2)))
a.rotate(57).move(10,0)

b = Structure()
b.add(Layer("layer1", Circle(2)))
b.move(10,10).mirror("y", keep_original=True)

c = Structure()
c.add(Layer("layer2", RegularPolygon(radius=3, num_edges=7, location=(0, 10))))

s.append(a).append(b).append(c)
s.quickplot(color_config=plot_cfg, size="medium")
[3]:
<Axes: >
../_images/notebooks_geometries_3_1.png
[4]:
### Lego-style assembling
[7]:
a1 = Anchor((5,3), 0, "a1")
a2 = Anchor((40, 20), 60, "a2")
layer_info = {"layer1": 3,
              "layer2": 1}
s1 = Fillet(anchor=(a1, a2), radius=15, layers=layer_info)

b1 = Anchor((5,15), 80, "b1")
b2 = Anchor((40, 30), 0, "b2")
s2 = Fillet(anchor=(b1, b2), radius=15, layers=layer_info)

assembled = Structure()
assembled.append(s1).move(-20, -30).append(s2, anchoring=("a2", "b1"), direction_snap=True)

fig = plt.figure(figsize=SIZE)
ax = fig.add_subplot(111)
s1.quickplot(color_config=plot_cfg, ax=ax)
s2.quickplot(color_config=plot_cfg, ax=ax)
assembled.quickplot(color_config=plot_cfg, ax=ax)
[7]:
<Axes: >
../_images/notebooks_geometries_5_1.png
[ ]:
### RES uChannels
[8]:
layer_info = {"layer1": 12,
              "layer2": 8}
reservior = MicroChannels(length=80,
                          spacing=20,
                          num=9,
                          angle=0,
                          layers=layer_info,
                          alabel=("p1", "p2"))

reservior.quickplot(color_config=plot_cfg, size="medium")
[8]:
<Axes: >
../_images/notebooks_geometries_7_1.png
[ ]:
### Taper
[9]:
layer_info = {"layer2": (2, 0.5),
              "layer1": (3, 5)}
tp = Taper(length=2,
           layers=layer_info,
           alabel=("a1","a2"),
           extension_sizes=(5,2))

tp.quickplot(color_config=plot_cfg, size="medium")
[9]:
<Axes: >
../_images/notebooks_geometries_9_1.png
[ ]:
### Spiral Inductor
[10]:
layer_info = {"layer2": 4,
              "layer1": 10}
spi = SpiralInductor(size = 200,
                    width = 4,
                    gap = 3,
                    num_turns = 6,
                    smallest_section_length = 0.5,
                    layers = layer_info,
                    alabel=("a1", "a2"))

spi.quickplot(color_config=plot_cfg, size="medium")
[10]:
<Axes: >
../_images/notebooks_geometries_11_1.png
[ ]:
### IDC
[11]:
layer_info = {"layer2": 2,
              "layer1": 5}
idc = IDC(length=20,
          spacing=15,
          num=15,
          layers=layer_info,
          alabel=("c1", "c2"))

idc.quickplot(color_config=plot_cfg)
[11]:
<Axes: >
../_images/notebooks_geometries_13_1.png
[ ]:
### CPW Launcher
[13]:
cpwlauncher = Taper(length = 200,
                    layers = {"layer2": (150, 8),
                              "layer1": (300, 16)},
                    alabel=("a1","a2"),
                    extension_sizes=(300, 10))
cpwlauncher.layer2.cut(Rectangle(150, 200, (-325,0)))
cpwlauncher.layer1.cut(Rectangle(75, 400, (-325-75/2,0)))
cpwlauncher.anchors["a1"].move(225)
cpwlauncher.skeletone.remove()
cpwlauncher.quickplot(color_config=plot_cfg, size="small")
[13]:
<Axes: >
../_images/notebooks_geometries_15_1.png