tidy3d.CustomGrid#
- class CustomGrid[source]#
Bases:
GridSpec1d
Custom 1D grid supplied as a list of grid cell sizes centered on the simulation center.
- Parameters:
attrs (dict = {}) β Dictionary storing arbitrary metadata for a Tidy3D object. This dictionary can be freely used by the user for storing data without affecting the operation of Tidy3D as it is not used internally. Note that, unlike regular Tidy3D fields,
attrs
are mutable. For example, the following is allowed for setting anattr
obj.attrs['foo'] = bar
. Also note that Tidy3D` will raise aTypeError
ifattrs
contain objects that can not be serialized. One can check ifattrs
are serializable by callingobj.json()
.dl (Tuple[PositiveFloat, ...]) β [units = um]. An array of custom nonuniform grid sizes. The resulting grid is centered on the simulation center such that it spans the region
(center - sum(dl)/2, center + sum(dl)/2)
, unless acustom_offset
is given. Note: if supplied sizes do not cover the simulation size, the first and last sizes are repeated to cover the simulation domain.custom_offset (Optional[float] = None) β [units = um]. The starting coordinate of the grid which defines the simulation center. If
None
, the simulation center is set such that it spans the region(center - sum(dl)/2, center + sum(dl)/2)
.
Example
>>> grid_1d = CustomGrid(dl=[0.2, 0.2, 0.1, 0.1, 0.1, 0.2, 0.2])
Attributes
Methods
Inherited Common Usage
- dl#
- custom_offset#
- __hash__()#
Hash method.