Luochenghuang / metabox

A multi-scale differential optimization framework for diffractive optical systems.
MIT License
31 stars 7 forks source link

Polygon's bug #2

Open Larrisa001 opened 5 months ago

Larrisa001 commented 5 months ago

Maybe this is a simple question. When I simulatied complex meta-atom by using metebox code, it alwayes report an error : ValueError: Attempt to convert a value (Feature(vmin=3e-9, vmax=periodicity[0], name='var', initial_value=None, sampling=10, value=0.0)) with an unsupported type (<class 'metabox.utils.Feature'>) to a Tensor. Could you please tell me how to simulate a complex meta-atom? Thank you very much! Good luck!

var = utils.Feature(vmin=3e-9, vmax=periodicity[0], name="var",sampling=10) pattern = rcwa.Polygon(material=TiO2,vertices=[(0, 0), (var, 0), (var, vmax=periodicity[0]), (0, vmax=periodicity[0])]) patterned_layer = rcwa.Layer(material=1, thickness=300e-9, shapes=[pattern], enforce_4fold_symmetry=True) substrate = rcwa.Layer(material=quartz, thickness=300e-9) cell = rcwa.UnitCell( layers=[patterned_layer, substrate], periodicity=periodicity ) protocell = rcwa.ProtoUnitCell(cell)

sim_lib = modeling.sample_protocell( protocell=protocell, incidence=incidence, sim_config=sim_config, )

Luochenghuang commented 5 months ago

Hi @Larrisa001, Thank you for submitting a bug report. Can you try to pass in the vertices as List[List[...]]? So it would be:

pattern = rcwa.Polygon(material=TiO2,vertices=[[0, 0], [var, 0], [var, periodicity[0]], [0, periodicity[0]]])

This should a temporary fix while I work on a fix. Best, Huang

Larrisa001 commented 5 months ago

Thank you very much for the detailed answer. Look forward to your fix code to implement complex meta-atom simulations of multiple parameter variables

Panhonganadd commented 6 days ago

How to use the complex scatterer to design a metalens?