def _test_hash_file(): """Test hash of the saved GDS file.""" gf.clear_cache() c = gf.components.straight() c.add_label("hi") gdspath = c.write_gds() h = hash_file(gdspath) assert h == "f2228aed8141f447e601ce93a6219415", h
def test_import_gds_hierarchy() -> gf.Component: c0 = gf.components.mzi_arms() gdspath = c0.write_gds() gf.clear_cache() c = import_gds(gdspath) assert len(c.get_dependencies()) == 3, len(c.get_dependencies()) assert c.name == c0.name, c.name return c
def _test_hash_array_file(): """Test hash of a component with an array of references.""" gf.clear_cache() c = gf.Component("array") wg = gf.components.straight(length=3.2) c.add_array(wg) gdspath = c.write_gds() h = hash_file(gdspath) assert h == "71d476075cf081b4099c1eea1c8984a1", h
def _test_hash_file(): """Test hash of the saved GDS file.""" gf.clear_cache() c = gf.components.straight() c.add_label("hi") gdspath = c.write_gds() h = hash_file(gdspath) print(h) assert h == "71655c3f7ab57e7a48b55683e8c1bfc4"
def _test_hash_array_file(): """Test hash of a component with an array of references.""" gf.clear_cache() c = gf.Component("array") wg = gf.components.straight(length=3.2) c.add_array(wg) gdspath = c.write_gds() h = hash_file(gdspath) print(h) assert h == "bec2ab8f157b429bd6ff210bedde6fe3"
def test_import_first(): c1 = gf.Component("parent") c1 << gf.c.mzi_arms() gdspath1 = c1.write_gds("extra/mzi.gds") gf.clear_cache() mzi1 = gf.import_gds(gdspath1) # IMPORT c1 = gf.c.mzi_arms() # BUILD c2 = gf.grid([mzi1, c1]) gdspath2 = c2.write_gds("extra/mzi2.gds") geometry.check_duplicated_cells(gdspath2)
def test_import_ports() -> gf.Component: """Make sure you can import the ports""" c0 = gf.components.mzi_arms(decorator=gf.add_pins) gdspath = c0.write_gds() c0x1 = c0.ports["o1"].x c0x2 = c0.ports["o2"].x gf.clear_cache() c1 = import_gds(gdspath, decorator=add_ports_from_markers_inside) c1x1 = c1.ports["o1"].x c1x2 = c1.ports["o2"].x assert c0x1 == c1x1 assert c0x2 == c1x2 return c1
def test_metadata_export_function(): gf.clear_cache() c = gf.c.mzi() d = c.to_dict_config() assert d.info.full.straight.function == "straight"