예제 #1
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
예제 #2
0
def test_mask():
    workspace_folder = pathlib.Path(__file__).parent
    filepath_yml = workspace_folder / "config.yml"
    config = load_config(filepath_yml)
    gdspath = str(config["mask"]["gds"])

    top_level = component_grid_from_yaml(config)
    pp.write_gds(top_level, gdspath)
    assert config["mask"]["gds"].exists()
    return gdspath
예제 #3
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
예제 #4
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
예제 #5
0
    mask_name = config["mask"]["name"]
    jsons_directory = config["gds_directory"]
    json_out_path = config["mask_directory"] / (mask_name + ".json")

    cells = {}
    does = {}
    logging.debug("Merging JSON files:")

    for filename in jsons_directory.glob("*.json"):
        logging.debug(filename)
        with open(filename, "r") as f:
            data = json.load(f)
            if data.get("type") == "doe":
                does[data["name"]] = data
            else:
                cells.update(data.get("cells"))

    config.update({"json_version": json_version, "cells": cells, "does": does})
    write_config(config, json_out_path)
    logging.info("Wrote {}".format(os.path.relpath(json_out_path)))
    return config


if __name__ == "__main__":
    config_path = CONFIG["samples_path"] / "mask" / "config.yml"
    config = load_config(config_path)
    config = merge_json(config)
    # print(config["module_versions"])
    print(config)
예제 #6
0
def test_load_doe():
    config = load_config(CONFIG["samples_path"] / "mask" / "config.yml")
    does = load_does(config)
    assert does
    return does
예제 #7
0
        if not isinstance(value, list):
            kwargs[key] = [value]

    if do_permutations:
        keys, list_values = list(zip(*[x for x in list(kwargs.items())]))
        settings = [
            dict(list(zip(keys, perms))) for perms in it.product(*list_values)
        ]
    else:
        keys, list_values = list(zip(*[x for x in list(kwargs.items())]))
        settings = [
            dict(list(zip(keys, values))) for values in zip(*list_values)
        ]

    return settings


def test_load_doe():
    config = load_config(CONFIG["samples_path"] / "mask" / "config.yml")
    does = load_does(config)
    assert does
    return does


if __name__ == "__main__":
    # test_load_doe()
    from pprint import pprint

    config = load_config(CONFIG["samples_path"] / "mask" / "config.yml")
    pprint(load_does(config))
예제 #8
0
def test_write_doe_from_yaml():
    config = load_config(CONFIG["samples_path"] / "mask" / "config.yml")
    write_doe_from_yaml(config)