Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 19 additions & 17 deletions docs/src/concepts/solidmodels_experimental.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,23 +214,25 @@ the structure of the data and the information that gets recorded:
"vacuum": { "type": "generated", "dim": 3, "pgs": ["vacuum"] },
"exterior_boundary": { "type": "generated", "dim": 2, "pgs": ["exterior_boundary"] }
},
"ports": {
"imon.jj": {
"type": "LumpedPort", "name": "imon.jj", "index": 1, "layer": "ports",
"direction": [0.0, 1.0, 0.0],
"pgs": ["__d8d680a0ae2f5cfd"]
}
},
"terminals": {
"METAL_CC__592bac94fb8108ba": {
"locators": ["imon.island"],
"pgs": ["__592bac94fb8108ba"]
}
},
"ground": {
"METAL_CC__d45f9082fcee6bf5": { "pgs": ["__d45f9082fcee6bf5"] }
},
"tagged": {}
"selections": {
"ports": {
"imon.jj": {
"type": "LumpedPort", "name": "imon.jj", "index": 1, "layer": "ports",
"direction": [0.0, 1.0, 0.0],
"pgs": ["__d8d680a0ae2f5cfd"]
}
},
"terminals": {
"METAL_CC__592bac94fb8108ba": {
"locators": ["imon.island"],
"pgs": ["__592bac94fb8108ba"]
}
},
"ground": {
"METAL_CC__d45f9082fcee6bf5": { "pgs": ["__d45f9082fcee6bf5"] }
},
"tagged": {}
}
}
```

Expand Down
4 changes: 2 additions & 2 deletions examples/SingleTransmon/SingleTransmonExperimental.jl
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,9 @@ function configfile(
dir = dirname(metadata_path)
tags(pg_names) = [metadata["physical_groups"][pg_name]["tag"] for pg_name in pg_names]
layer_attributes(layer_name) = tags(metadata["layers"][layer_name]["pgs"])
port = name -> metadata["ports"][name]
port = name -> metadata["selections"]["ports"][name]
port_attributes(name) = tags(port(name)["pgs"])
wave_ports = any(p -> p["type"] == "WavePort", values(metadata["ports"]))
wave_ports = any(p -> p["type"] == "WavePort", values(metadata["selections"]["ports"]))

config = Dict(
"Problem" => Dict(
Expand Down
37 changes: 22 additions & 15 deletions schemas/sm_metadata.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"title": "DeviceLayout experimental solid-model metadata",
"type": "object",
"additionalProperties": false,
"required": ["metadata", "physical_groups", "layers", "tagged", "ports", "terminals", "ground"],
"required": ["metadata", "physical_groups", "layers", "selections"],
"properties": {
"metadata": {
"type": "object",
Expand Down Expand Up @@ -35,21 +35,28 @@
"type": "object",
"additionalProperties": { "$ref": "#/definitions/layer" }
},
"tagged": {
"type": "object",
"additionalProperties": { "$ref": "#/definitions/tagged" }
},
"ports": {
"type": "object",
"additionalProperties": { "$ref": "#/definitions/port" }
},
"terminals": {
"selections": {
"type": "object",
"additionalProperties": { "$ref": "#/definitions/terminal" }
},
"ground": {
"type": "object",
"additionalProperties": { "$ref": "#/definitions/group_membership" }
"additionalProperties": false,
"required": ["tagged", "ports", "terminals", "ground"],
"properties": {
"tagged": {
"type": "object",
"additionalProperties": { "$ref": "#/definitions/tagged" }
},
"ports": {
"type": "object",
"additionalProperties": { "$ref": "#/definitions/port" }
},
"terminals": {
"type": "object",
"additionalProperties": { "$ref": "#/definitions/terminal" }
},
"ground": {
"type": "object",
"additionalProperties": { "$ref": "#/definitions/group_membership" }
}
}
}
},
"definitions": {
Expand Down
10 changes: 6 additions & 4 deletions src/solidmodels/experimental/serialization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,12 @@ function serialize_metadata(
"metadata" => metadata,
"physical_groups" => physical_groups,
"layers" => layers_dict,
"tagged" => sections.tagged,
"ports" => sections.ports,
"terminals" => sections.terminals,
"ground" => sections.ground
"selections" => Dict{String, Any}(
"tagged" => sections.tagged,
"ports" => sections.ports,
"terminals" => sections.terminals,
"ground" => sections.ground
)
)
end

Expand Down
12 changes: 7 additions & 5 deletions test/test_examples.jl
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,11 @@ end
@test layer_entities("lumped_element") == 1
@test layer_entities("port") == 2
# Ground, island, and transmission line
@test sort([only(t["locators"]) for t in values(metadata["terminals"])]) == ["p_ro.feedline", "qubit.island"]
@test length(metadata["ground"]) == 1
@test Set(keys(metadata["ports"])) ==
@test sort([
only(t["locators"]) for t in values(metadata["selections"]["terminals"])
]) == ["p_ro.feedline", "qubit.island"]
@test length(metadata["selections"]["ground"]) == 1
@test Set(keys(metadata["selections"]["ports"])) ==
Set(["p_ro.port_1", "p_ro.port_2", "qubit.junction"])

config = SingleTransmonExperimental.configfile(metadata_path)
Expand Down Expand Up @@ -118,11 +120,11 @@ end
end
wave_metadata = JSON.parsefile(wave_metadata_path)
@test isvalid(schema, wave_metadata)
@test Set(keys(wave_metadata["ports"])) ==
@test Set(keys(wave_metadata["selections"]["ports"])) ==
Set(["qubit.junction", "p_ro_wave_port_1", "p_ro_wave_port_2"])
# Each patch is split where the substrate surface meets it
for name in ("p_ro_wave_port_1", "p_ro_wave_port_2")
@test sum(wave_metadata["ports"][name]["pgs"]) do pg_name
@test sum(wave_metadata["selections"]["ports"][name]["pgs"]) do pg_name
return length(SolidModels.entitytags(wave_sm[pg_name, 2]))
end == 2
end
Expand Down
30 changes: 15 additions & 15 deletions test/test_solidmodels_experimental.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1776,14 +1776,14 @@ end
@test_throws ErrorException render("selection_default")
end
with_test_logger(no_metal; required=no_metal) do
@test isempty(render("selection_nonstrict"; strict=:no)["terminals"])
@test isempty(render("selection_nonstrict"; strict=:no)["selections"]["terminals"])
end
metadata = with_test_logger(_ -> false) do
return render("selection_no_terminals"; select_terminals=false)
end
@test isempty(metadata["terminals"])
@test haskey(metadata["tagged"], "q1.pad")
@test haskey(metadata["ports"], "q1.drive")
@test isempty(metadata["selections"]["terminals"])
@test haskey(metadata["selections"]["tagged"], "q1.pad")
@test haskey(metadata["selections"]["ports"], "q1.drive")
metadata = with_test_logger(_ -> false) do
return render(
"selection_no_selections";
Expand All @@ -1792,8 +1792,8 @@ end
select_ports=false
)
end
@test isempty(metadata["tagged"])
@test isempty(metadata["ports"])
@test isempty(metadata["selections"]["tagged"])
@test isempty(metadata["selections"]["ports"])
end

@testitem "SolidModel end-to-end" begin
Expand Down Expand Up @@ -2130,8 +2130,8 @@ end
end

@testset "Terminal identification" begin
terminals = solid_model_metadata["terminals"]
ground = solid_model_metadata["ground"]
terminals = solid_model_metadata["selections"]["terminals"]
ground = solid_model_metadata["selections"]["ground"]

# One ground plane
@test length(ground) == 1
Expand Down Expand Up @@ -2178,7 +2178,7 @@ end
end

@testset "Port locator metadata" begin
ports = solid_model_metadata["ports"]
ports = solid_model_metadata["selections"]["ports"]
@test length(ports) == 4
for (port_name, port_data) in ports
@test !isempty(port_data["pgs"])
Expand Down Expand Up @@ -2230,17 +2230,17 @@ end
for (pg_name, pg_data) in solid_model_metadata["physical_groups"]
meta_pgs[pg_name] = pg_data["dim"]
end
for (_, cc_info) in solid_model_metadata["terminals"]
for (_, cc_info) in solid_model_metadata["selections"]["terminals"]
for pg_name in cc_info["pgs"]
meta_pgs[pg_name] = 2
end
end
for (_, cc_info) in solid_model_metadata["ground"]
for (_, cc_info) in solid_model_metadata["selections"]["ground"]
for pg_name in cc_info["pgs"]
meta_pgs[pg_name] = 2
end
end
for (_, port_info) in solid_model_metadata["ports"]
for (_, port_info) in solid_model_metadata["selections"]["ports"]
for pg_name in port_info["pgs"]
meta_pgs[pg_name] = 2
end
Expand All @@ -2264,7 +2264,7 @@ end
end

@testset "Tag locator serialized in tagged section" begin
tagged = solid_model_metadata["tagged"]
tagged = solid_model_metadata["selections"]["tagged"]

# Each MockTransmon places a Tag locator on its island → 2 tagged entries
@test length(tagged) == 2
Expand Down Expand Up @@ -2396,8 +2396,8 @@ end
pg_name = only(metadata["layers"]["metal"]["pgs"])
@test collect(SolidModels.bounds3d(sm[pg_name, 2])) ≈ [0.0, 0.0, 0.0, 10.0, 10.0, 0.0] atol =
1e-6
@test length(metadata["ground"]) == 1
@test isempty(metadata["terminals"])
@test length(metadata["selections"]["ground"]) == 1
@test isempty(metadata["selections"]["terminals"])

cell = Cell("legacy_in_experimental", nm)
with_test_logger(_ -> false) do
Expand Down
Loading