flexcompute / tidy3d

Fast electromagnetic solver (FDTD) at scale.
https://docs.flexcompute.com/projects/tidy3d/en/latest/
GNU Lesser General Public License v2.1
189 stars 44 forks source link

Convenience method for creating CustomMedium #1971

Closed tylerflex closed 1 month ago

tylerflex commented 1 month ago

kind of a shower thought, but I think the usability for creating CustomMedium would be improved if we had some kind of method that automatically created the coordinates and DataArray bits given some geometry. For example:

s = td.Structure.from_data(
    geometry=box,
    eps_data=np.random.random((Nx, Ny, Nz))
)

and this would just use the geometry.bounds to create some evenly spaced coords inside and set up the CustomMedium.