def test_autoplacer():
    mask_path.mkdir(parents=True, exist_ok=True)

    # Map the component factory names in the YAML file to the component factory
    name2factory = {"SPIRAL": SPIRAL}

    print(doe_root_path)
    generate_does(
        str(config_yml),
        component_factory=name2factory,
        doe_root_path=doe_root_path,
        doe_metadata_path=doe_metadata_path,
    )
    top_level = place_from_yaml(config_yml, doe_root_path)
    top_level.write(str(gdspath))

    merge_metadata(gdspath=gdspath)

    assert gdspath.exists()
    assert markdown_path.exists()
    assert json_path.exists()
    assert test_metadata_path.exists()

    report = open(markdown_path).read()
    assert report.count(
        "#") >= 1, f" only {report.count('#')} DOEs in {markdown_path}"
    return gdspath
Esempio n. 2
0
def test_mask():
    """Returns gdspath for a Mask

    - Write GDS files defined in does.yml (with JSON metadata)
    - place them into a mask following placer information in does.yml
    - merge mask JSON metadata into a combined JSON file

    """
    cwd = pathlib.Path(__file__).absolute().parent
    does_path = cwd / "does.yml"

    doe_root_path = cwd / "build" / "cache_doe_directory"
    mask_path = cwd / "build" / "mask"
    gdspath = mask_path / "mask.gds"
    mask_path.mkdir(parents=True, exist_ok=True)

    generate_does(
        str(does_path),
        doe_root_path=doe_root_path,
    )
    top_level = place_from_yaml(does_path, root_does=doe_root_path)
    top_level.write(str(gdspath))
    merge_metadata(gdspath)
    assert gdspath.exists()
    return gdspath
Esempio n. 3
0
def main():
    """

    """
    workspace_folder = pathlib.Path(__file__).absolute().parent
    filepath_yml = workspace_folder / "config.yml"
    filepath_does_yml = workspace_folder / "does.yml"

    CONFIG = load_config(filepath_yml)
    doe_directory = CONFIG["cache_doe_directory"]

    filepath_gds = str(workspace_folder / "build" / "mask" /
                       f"{CONFIG['mask']['name']}.gds")

    # Map the component factory names in the YAML file to the component factory
    component_type2factory.update({"SPIRAL": SPIRAL})

    generate_does(
        CONFIG,
        component_type2factory=component_type2factory,
        doe_root_path=doe_directory,
    )
    top_level = place_from_yaml(filepath_does_yml, doe_directory)
    top_level.write(filepath_gds)
    return filepath_gds
Esempio n. 4
0
def main():
    workspace_folder = pathlib.Path(__file__).parent
    filepath_yml = workspace_folder / "config.yml"
    filepath_gds = str(workspace_folder / "build" / "mask" / "top_level.gds")
    config = load_config(filepath_yml)

    # Map the component factory names in the YAML file to the component factory
    name2factory = {"SPIRAL": SPIRAL}

    generate_does(config, component_type2factory=name2factory)
    top_level = place_from_yaml(config)
    top_level.write(filepath_gds)
    return filepath_gds
Esempio n. 5
0
def write_mask():
    """ build and place does from config.yml """
    gdspath = CONFIG["mask"]["gds"]

    pb.build_does()
    # generate_does()

    top_level = place_from_yaml(CONFIG["config_path"])
    top_level.write(str(gdspath))

    write_labels(gdspath=gdspath)

    merge_json()
    merge_markdown()
    merge_test_metadata(gdspath=gdspath)
    return gdspath
Esempio n. 6
0
def test_mask_custom():
    # workspace_folder = pathlib.Path(__file__).parent
    workspace_folder = CONFIG["samples_path"] / "mask_custom"
    does_yml = workspace_folder / "does.yml"
    config_yml = workspace_folder / "config.yml"
    config = load_config(config_yml)
    gdspath = config["mask"]["gds"]

    # Map the component factory names in the YAML file to the component factory
    # generate_does(config)
    # build_does(config, component_type2factory=component_type2factory)
    generate_does(str(does_yml), component_type2factory=component_type2factory)

    top_level = place_from_yaml(does_yml)
    top_level.write(str(gdspath))
    assert gdspath.exists()
    return gdspath
Esempio n. 7
0
def test_mask():
    """

    """
    cwd = pathlib.Path(__file__).absolute().parent
    does_path = cwd / "does.yml"

    doe_root_path = cwd / "build" / "cache_doe_directory"
    mask_path = cwd / "build" / "mask"
    gdspath = mask_path / "mask.gds"
    mask_path.mkdir(parents=True, exist_ok=True)

    generate_does(
        str(does_path),
        doe_root_path=doe_root_path,
    )
    top_level = place_from_yaml(does_path, root_does=doe_root_path)
    top_level.write(str(gdspath))
    merge_metadata(gdspath)
    assert gdspath.exists()
    return gdspath
Esempio n. 8
0
def test_mask(precision=2e-9):
    workspace_folder = CONFIG["samples_path"] / "mask_custom"
    build_path = workspace_folder / "build"
    doe_root_path = build_path / "cache_doe"
    doe_metadata_path = build_path / "doe"
    mask_path = build_path / "mask"
    does_yml = workspace_folder / "does.yml"

    mask_path.mkdir(parents=True, exist_ok=True)

    gdspath = mask_path / "sample_mask.gds"
    markdown_path = gdspath.with_suffix(".md")
    json_path = gdspath.with_suffix(".json")
    test_metadata_path = gdspath.with_suffix(".tp.json")

    generate_does(
        str(does_yml),
        component_factory=component_factory,
        precision=precision,
        doe_root_path=doe_root_path,
        doe_metadata_path=doe_metadata_path,
    )

    top_level = place_from_yaml(does_yml, precision=precision, root_does=doe_root_path)
    top_level.write(str(gdspath))

    merge_metadata(gdspath=gdspath)

    assert gdspath.exists()
    assert markdown_path.exists()
    assert json_path.exists()
    assert test_metadata_path.exists()

    report = open(markdown_path).read()
    assert report.count("#") == 2, f" only {report.count('#')} DOEs in {markdown_path}"

    return gdspath