예제 #1
0
def test_simple_xsection(datadir):
    small1 = part_3d.ExtrudePart("small1", "Sketch001", z0=-2, thickness=2)

    big = part_3d.ExtrudePart("big", "Sketch", z0=-4, thickness=8)

    input_parts = [small1, big]
    file_path = os.path.join(datadir, "simple.FCStd")
    geo_data = build_3d_geometry(
        input_parts=input_parts,
        input_file=file_path,
        xsec_dict={"test_xsec": {
            "axis": (1, 0, 0),
            "distance": 0
        }},
    )

    cut_2d_geo_data = geo_data.xsec_to_2d("test_xsec")

    assert set(cut_2d_geo_data.parts["small1"].exterior.coords) == {
        (-5.0, -2.0),
        (-5.0, 0.0),
        (5.0, -2.0),
        (5.0, 0.0),
    }
    assert set(cut_2d_geo_data.parts["big"].exterior.coords) == {
        (-10.0, -4.0),
        (-10.0, 4.0),
        (10.0, -4.0),
        (10.0, 4.0),
    }
예제 #2
0
파일: test_dot_geo.py 프로젝트: sycomix/qmt
def test_dot_geo(datadir):
    """
    Tests building a simplified version of the example 'quantum_dot_device.'
    The syntax of this example should match the corresponding example.
    ANY CHANGES MADE TO THIS TEST SHOULD ALSO BE MADE IN CORRESPONDING EXAMPLE.
    """

    substrate = part_3d.ExtrudePart("Substrate",
                                    "Sketch027",
                                    z0=-2,
                                    thickness=2.0)

    gate1 = part_3d.ExtrudePart("Gate 1", "Sketch003", z0=0, thickness=10)

    wrap1 = part_3d.LithographyPart(
        "Wrap 1",
        "Sketch028",
        z0=0,
        thickness=2,
        layer_num=1,
        litho_base=[substrate, gate1],
    )

    layer2 = part_3d.LithographyPart("Layer 2",
                                     "Sketch002",
                                     z0=0,
                                     thickness=10,
                                     layer_num=2)

    wrap2 = part_3d.LithographyPart("Wrap 2",
                                    "Sketch029",
                                    z0=0,
                                    thickness=2,
                                    layer_num=3)

    layer3 = part_3d.ExtrudePart("Layer 3", "Sketch023", z0=0, thickness=30)

    # Parameters for geometry building
    input_file = os.path.join(datadir, "qd_device_parts.FCStd")
    input_parts = [substrate, gate1, wrap1, layer2, wrap2, layer3]

    # Compute parametrised geometries in parallel with dask
    geo = build_3d_geometry(input_parts=input_parts, input_file=input_file)

    # Create a local temporary directory to investigate results
    with tempfile.TemporaryDirectory() as temp_dir_path:
        geo.write_fcstd(os.path.join(temp_dir_path, "tmp.fcstd"))
        for label, part in geo.parts.items():
            part.write_stl(os.path.join(temp_dir_path, label + ".stl"))
예제 #3
0
def test_build(fix_exampleDir, fix_FCDoc):
    myPart = part_3d.ExtrudePart("block_of_gold", "Sketch", thickness=10)
    opts = {
        "file_path":
        os.path.join(fix_exampleDir, "geometry_sweep",
                     "geometry_sweep_showcase.fcstd"),
        "input_parts": [myPart],
        "xsec_dict": {},
    }
    fix_FCDoc.load(opts["file_path"])
    build(opts)
예제 #4
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Example geometry sweeping for electrostatically-gated quantum dot device.
NOTE: The syntax of this example should match the test 'test_dot_geo.'
      If it does not, this example needs to be updated.
"""

import os
import numpy as np

from qmt.geometry import part_3d, build_3d_geometry

# Set up geometry task

substrate = part_3d.ExtrudePart("Substrate", "Sketch027", z0=-2, thickness=2.0)

gate1 = part_3d.ExtrudePart("Gate 1", "Sketch", z0=0, thickness=10)

gate2 = part_3d.ExtrudePart("Gate 2", "Sketch003", z0=0, thickness=10)

gate3 = part_3d.ExtrudePart("Gate 3", "Sketch006", z0=0, thickness=10)

gate4 = part_3d.ExtrudePart("Gate 4", "Sketch011", z0=0, thickness=10)

wrap1 = part_3d.LithographyPart(
    "Wrap 1",
    "Sketch028",
    z0=0,
    thickness=2,
    layer_num=1,
    litho_base=[substrate, gate1, gate2, gate3, gate4],
예제 #5
0
def test_geo_task(datadir):
    """
    Tests the build geometry task. For now, just verifies that the build doesn't encounter errors.
    """

    block1 = part_3d.ExtrudePart("Parametrised block",
                                 "Sketch",
                                 thickness=5.0,
                                 z0=-2.5)
    block2 = part_3d.ExtrudePart("Two blocks", "Sketch001", thickness=0.5)
    sag = part_3d.SAGPart("Garage",
                          "Sketch002",
                          z0=0,
                          z_middle=5,
                          thickness=6,
                          t_in=2.5,
                          t_out=0.5)
    wire = part_3d.WirePart("Nanowire", "Sketch003", z0=0, thickness=0.5)
    shell = part_3d.WireShellPart(
        "Wire cover",
        "Sketch004",
        depo_mode="depo",
        target_wire=wire,
        thickness=0.2,
        shell_verts=[1, 2],
    )
    block3 = part_3d.Geo3DPart("Passthrough", "Box")
    substrate = part_3d.ExtrudePart("Substrate",
                                    "Sketch005",
                                    z0=-2,
                                    thickness=2)
    wrap = part_3d.LithographyPart(
        "First Layer",
        "Sketch006",
        z0=0,
        layer_num=1,
        thickness=4,
        litho_base=[substrate],
    )
    wrap2 = part_3d.LithographyPart("Second Layer",
                                    "Sketch007",
                                    layer_num=2,
                                    thickness=1)
    input_file_path = os.path.join(datadir, "geometry_test.fcstd")
    print(input_file_path)

    build_order = [
        block1, block2, sag, wire, shell, block3, substrate, wrap, wrap2
    ]
    results = []
    for d1 in np.linspace(2.0, 7.0, 3):
        built_geo = build_3d_geometry(input_parts=build_order,
                                      input_file=input_file_path,
                                      params={"d1": d1})
        results += [built_geo]

    # Investigate results
    with tempfile.TemporaryDirectory() as temp_dir_path:
        for i, result in enumerate(results):
            file_name = os.path.join(temp_dir_path, f"{i}.fcstd")
            result.write_fcstd(file_name)
예제 #6
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Example geometry sweeping."""

import os
import numpy as np

from qmt.geometry import part_3d, build_3d_geometry

# Set up geometry task

block1 = part_3d.ExtrudePart("Parametrised block",
                             "Sketch",
                             thickness=5.0,
                             z0=2.5)

block2 = part_3d.ExtrudePart("Two blocks", "Sketch001", thickness=0.5)

sag = part_3d.SAGPart("Garage",
                      "Sketch002",
                      thickness=6,
                      z_middle=5,
                      t_in=2.5,
                      t_out=0.5,
                      z0=0)

wire = part_3d.WirePart("Nanowire", "Sketch003", z0=0, thickness=0.5)

shell = part_3d.WireShellPart(
    "Wire cover",
    "Sketch004",
예제 #7
0
def test_build_extrude(fix_FCDoc, fix_hexagon_sketch):
    sketch = fix_hexagon_sketch()
    input_part = part_3d.ExtrudePart("label", sketch.Name, thickness=10)
    built_part = build_extrude(input_part)