Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

gm.get_meep_adjoint_optimizer function

Đang mở
#477 3 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
backend

Hướng nghiên cứu

The warning points to meep_adjoint_optimization.py at line 148 in the installed gplugins package; the issue does not identify the repository source path or a test. Read the block around that line and check how its center coordinates are passed into the gmeep flow. Reproduce with the supplied waveguide and design region; done means the warning is gone and the design is produced with the intended size.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug

Describe the bug
/path/to/miniconda3/envs/mp/lib/python3.11/site-packages/gplugins/gmeep/meep_adjoint_optimization.py:148: UserWarning: Setting rectangle_S5_5_LWG_CFal_d89a89d8_2500_2500.centerin um is deprecated and will change to DataBaseUnits in gdsfactory9. Please userectangle_S5_5_LWG_CFal_d89a89d8_2500_2500.dcenterinstead.

To Reproduce

import gdsfactory as gf
import gplugins as gp
import gplugins.gmeep as gm
import numpy as np
import meep as mp
from meep import MaterialGrid, Medium, Vector3, Volume
from meep.adjoint import (
    conic_filter,
    DesignRegion,
    get_conic_radius_from_eta_e,
    tanh_projection,
)

#### Demo to reproduce bug
Nx = 50
Ny = 50

c = gf.Component()
wg = c << gf.components.straight(layer=(1,0),width=0.5,length=10)

design_variables = mp.MaterialGrid(mp.Vector3(Nx, Ny), mp.Medium(index=1.444), mp.Medium(index=3.45), grid_type="U_MEAN")
design_region = \
    DesignRegion(
        design_variables,
        volume=Volume(
            center=Vector3(),
            size=Vector3(5, 5, 0),
        ),
    )

seed = 240
np.random.seed(seed)
x0 = np.random.rand(
        Nx * Ny,
    )

c.add_port("o1", port=wg.ports["o1"]) # assign ports to component
c.add_port("o2", port=wg.ports["o2"]) # assign ports to component


def J1(o1, o2):
    criterion = npa.abs(o2/o1)
    return criterion


gm.get_meep_adjoint_optimizer(
    c,
    J1,
    [design_region],
    [design_variables],
    x0,
    resolution=10,
    cell_size=(
        10,
        10,
    ),
    tpml=1.0,
    extend_ports_length=0,
    port_margin=1,
    port_source_name=f"o1",
    port_source_offset=-1.5,
    port_monitor_offset=-1.5,
    distance_source_to_monitors=1,
)

Expected behavior
Warning should not occur and design with a waveguide and design region (properly sized) should be produced.

Suggested fix
Potentially, Change block.center to block.dcenter on line 148 of path/to/site-packages/gplugins/gmeep/meep_adjoint_optimization.py
I haven't updated this as I'm not sure how changes will propagate through the gmeep library, given the new units update.

Ngôn ngữ chính
Python
Star
62
Fork
66
Merge trung bình
1 ngày 15 giờ
Pull request đã merge (30 ngày)
12

Chuẩn bị môi trường

  • Có Dockerfile hoặc tệp Docker Compose
  • Không có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của gdsfactory/gplugins

Tất cả issue của gdsfactory/gplugins

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.