Skip to content

Commit

Permalink
Merge pull request #380 from gdsfactory/fix_docs
Browse files Browse the repository at this point in the history
small doc fixes
  • Loading branch information
joamatab authored Apr 15, 2024
2 parents ee858d0 + a563022 commit de3da46
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 29 deletions.
4 changes: 1 addition & 3 deletions docs/_toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,5 @@ parts:
- file: changelog
- url: https://gdsfactory.github.io/gdsfactory
title: gdsfactory
- url: https://github.com/gdsfactory/gdsfactory-photonics-training
- url: https://gdsfactory.github.io/gdsfactory-photonics-training/index.html
title: gdsfactory-photonics-training
- url: https://piel.readthedocs.io/en/latest/index.html
title: electronics-integration
6 changes: 3 additions & 3 deletions gplugins/femwell/mode_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,15 @@ def compute_component_slice_modes(
Keyword Args:
resolutions (Dict): Pairs {"layername": {"resolution": float, "distance": "float}}
to roughly control mesh refinement within and away from entity, respectively.
mesh_scaling_factor (float): factor multiply mesh geometry by.
default_resolution_min (float): gmsh minimal edge length.
default_resolution_max (float): gmsh maximal edge length.
default_characteristic_length (float): gmsh characteristic length.
background_tag (str): name of the background layer to add (default: no background added).
background_padding (Tuple): [xleft, ydown, xright, yup] distances to add to the components and to fill with background_tag.
background_remeshing_file (str): filename to load background remeshing from.
global_meshsize_array: np array [x,y,z,lc] to parametrize the mesh.
global_meshsize_interpolant_func: interpolating function for global_meshsize_array.
extra_shapes_dict: Optional[OrderedDict] of {key: geo} with key a label and geo a shapely (Multi)Polygon or (Multi)LineString of extra shapes to override component.
merge_by_material: boolean, if True will merge polygons from layers with the same layer.material. Physical keys will be material in this case.
wafer_layer: layer to use for WAFER padding.
"""

# Mesh
Expand Down
37 changes: 20 additions & 17 deletions gplugins/klayout/drc/count_drc.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,32 @@ def count_drc(rdb_path: PathType, threshold: int = 0) -> dict[str, int]:
if not rdb_path.exists():
raise FileNotFoundError(f"Cannot find {rdb_path}")

if rdb_path.is_dir():
for rdb_file in rdb_path.glob("*.rdb"):
errors_dict[rdb_file.stem] = count_drc(rdb_file)
if not rdb_path.is_dir():
return _get_errors(rdb_path, threshold, errors_dict)
for rdb_file in rdb_path.glob("*.rdb"):
errors_dict[rdb_file.stem] = count_drc(rdb_file)

else:
r = rdb.ReportDatabase()
r.load(rdb_path)
return errors_dict

categories = {cat.rdb_id(): cat for cat in r.each_category()}

errors_total = 0
def _get_errors(rdb_path, threshold, errors_dict):
r = rdb.ReportDatabase()
r.load(rdb_path)

for category_id, category in categories.items():
errors_per_category = r.each_item_per_category(category_id)
errors = len(list(errors_per_category))
errors_total += errors
categories = {cat.rdb_id(): cat for cat in r.each_category()}

if errors > threshold:
errors_dict[category.name()] = errors
errors_total = 0

errors_dict["total"] = errors_total
return dict(sorted(errors_dict.items(), key=lambda item: item[1], reverse=True))
return errors_dict
for category_id, category in categories.items():
errors_per_category = r.each_item_per_category(category_id)
errors = len(list(errors_per_category))
errors_total += errors

if errors > threshold:
errors_dict[category.name()] = errors

errors_dict["total"] = errors_total
return dict(sorted(errors_dict.items(), key=lambda item: item[1], reverse=True))


def write_yaml(rdb_path: PathType, filepath: PathType, threshold: int = 0) -> None:
Expand Down
9 changes: 3 additions & 6 deletions gplugins/klayout/tests/test_global_density.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ def component_test_density1(
small_rect2_offset=(25, 25),
):
c = gf.Component()
_large_rect = c << gf.components.rectangle(
size=large_rect_size, layer=(1, 0), centered=True
)
_ = c << gf.components.rectangle(size=large_rect_size, layer=(1, 0), centered=True)
small_rect1 = c << gf.components.rectangle(
size=small_rect1_size, layer=(2, 0), centered=True
)
Expand Down Expand Up @@ -60,7 +58,7 @@ def manual_density_calculation(
small_rect1_size=small_rect1_sizes[0],
small_rect2_size=small_rect2_sizes[0],
),
] * 3 + [0.5]
] * 3 + [0.125]


@pytest.mark.parametrize(
Expand All @@ -87,7 +85,6 @@ def test_estimate_weighted_global_density(
tile_size,
expected_global_density,
):
# Create test gds
gdspath = PATH.test_data / "test_gds_global_density.gds"
test_component = component_test_density1(
large_rect_size=large_rect_size,
Expand All @@ -108,5 +105,5 @@ def test_estimate_weighted_global_density(
estimated_density = estimate_weighted_global_density(
Xi=Xi, Yi=Yi, Zi=Zi, bbox=get_gds_bbox(gdspath)
)

print(estimated_density, expected_global_density)
assert np.isclose(estimated_density, expected_global_density)

0 comments on commit de3da46

Please sign in to comment.