API Reference
Basic Class
Point
- class splayout.Point(x, y)
Bases:
objectPoint Definition in SPLayout. Point is the basic unit that describe the locations of all the components in SPLayout.
- Parameters
x (float) – The x coordinate of a point.
y (float) – The y coordinate of a point.
Notes
By overloading operators, the Point object can do calculations with Point object and Tuples, the available operations are: Point == Point Point + Point Point + Tuple Point - Point Point - Tuple Point / float
- to_tuple()
Convert Point into Tuple.
- Returns
out – (x,y).
- Return type
Tuple
- get_percent_point(others, percent=0.5)
Derive the point on the connection line of the point and the other point.
Cell
- class splayout.Cell(name, lib=<gdspy.library.GdsLibrary object>)
Bases:
objectCell Definition in SPLayout. The object of Cell can be used to “**.draw(cell,)” functions of the components.
- Parameters
name (string) – The name of the cell.
lib (gdspy.GdsLibrary) – The library that the cell will belong to (Normally, no need to specify it).
- remove_components()
Remove all the polygons and sub-cells in the cell.
- flatten()
Flatten all the polygons in the cell.
Layer
Components
Waveguide
- class splayout.Waveguide(start_point, end_point, width, z_start=None, z_end=None, material=None, rename=None)
Bases:
objectWaveguide Definition in SPLayout.
- Parameters
start_point (Point or Tuple) – Start point of the waveguide.
end_point (Point or Tuple) – End point of the waveguide.
width (float) – Width of the waveguide (μm).
z_start (Float) – The start point for the structure in z axis (unit: μm, default: None, only useful when draw on CAD).
z_end (Float) – The end point for the structure in z axis (unit: μm, default: None, only useful when draw on CAD).
material (str or float) – Material setting for the structure in Lumerical FDTD (SiO2 = “SiO2 (Glass) - Palik”, SiO2 = “SiO2 (Glass) - Palik”). When it is a float, the material in FDTD will be <Object defined dielectric>, and index will be defined. (default: None, only useful when draw on CAD)
rename (String) – New name of the structure in Lumerical.
Notes
The waveguide should be vertical or horizontal, which means the x-axis value or the y-axis value of the start_point and the end_point should be the same. For arbitrary angle waveguide, please use ArbitraryAngleWaveguide.
- draw(cell, layer)
Draw the Component on the layout.
- draw_on_lumerical_CAD(engine)
Draw the Component on the lumerical CAD (FDTD or MODE).
- Parameters
engine (FDTDSimulation or MODESimulation) – CAD to draw the component.
- get_start_point()
Derive the start point of the taper.
- Returns
out – Start point.
- Return type
ArbitraryAngleWaveguide
- class splayout.ArbitraryAngleWaveguide(start_point, end_point, width, z_start=None, z_end=None, material=None, rename=None)
Bases:
objectArbitrary Waveguide Definition in SPLayout.
- Parameters
start_point (Point or Tuple) – Start point of the waveguide.
end_point (Point or Tuple) – End point of the waveguide.
width (float) – Width of the waveguide (μm).
z_start (Float) – The start point for the structure in z axis (unit: μm, default: None, only useful when draw on CAD).
z_end (Float) – The end point for the structure in z axis (unit: μm, default: None, only useful when draw on CAD).
material (str or float) – Material setting for the structure in Lumerical FDTD (SiO2 = “SiO2 (Glass) - Palik”, SiO2 = “SiO2 (Glass) - Palik”). When it is a float, the material in FDTD will be <Object defined dielectric>, and index will be defined. (default: None, only useful when draw on CAD)
rename (String) – New name of the structure in Lumerical.
- draw(cell, layer)
Draw the Component on the layout.
- draw_on_lumerical_CAD(engine)
Draw the Component on the lumerical CAD (FDTD or MODE).
- Parameters
engine (FDTDSimulation or MODESimulation) – CAD to draw the component.
- get_start_point()
Derive the start point of the waveguide.
- Returns
out – Start point.
- Return type
Taper
- class splayout.Taper(start_point, end_point, start_width, end_width, z_start=None, z_end=None, material=None, rename=None)
Bases:
objectBend Definition in SPLayout.
- Parameters
start_point (Point) – Start point of the taper.
end_point (Point) – End point of the taper.
start_width (float) – Start width of the taper (μm).
end_width (float) – End width of the taper (μm).
z_start (Float) – The start point for the structure in z axis (unit: μm, default: None, only useful when draw on CAD).
z_end (Float) – The end point for the structure in z axis (unit: μm, default: None, only useful when draw on CAD).
material (str or float) – Material setting for the structure in Lumerical FDTD (SiO2 = “SiO2 (Glass) - Palik”, SiO2 = “SiO2 (Glass) - Palik”). When it is a float, the material in FDTD will be <Object defined dielectric>, and index will be defined. (default: None, only useful when draw on CAD)
rename (String) – New name of the structure in Lumerical.
Notes
The taper should be vertical or horizontal, which means the x-axis value or the y-axis value of the start_point and the end_point should be the same.
- draw(cell, layer)
Draw the Component on the layout.
- draw_on_lumerical_CAD(engine)
Draw the Component on the lumerical CAD (FDTD or MODE).
- Parameters
engine (FDTDSimulation or MODESimulation) – CAD to draw the component.
- get_start_point()
Derive the start point of the taper.
- Returns
out – Start point.
- Return type
Bend
- class splayout.Bend(center_point, start_radian, end_radian, width, radius, z_start=None, z_end=None, material=None, rename=None)
Bases:
objectBend Definition in SPLayout.
- Parameters
center_point (Point) – Center point of the based ring.
start_radian (float) – Start radian (radian) [can be easily defined by math.pi].
end_radian (float) – End radian (radian) [can be easily defined by math.pi].
width (float) – Width of the waveguide (μm).
radius (float) – Radius of the bend (μm).
z_start (Float) – The start point for the structure in z axis (unit: μm, default: None, only useful when draw on CAD).
z_end (Float) – The end point for the structure in z axis (unit: μm, default: None, only useful when draw on CAD).
material (str or float) – Material setting for the structure in Lumerical FDTD (SiO2 = “SiO2 (Glass) - Palik”, SiO2 = “SiO2 (Glass) - Palik”). When it is a float, the material in FDTD will be <Object defined dielectric>, and index will be defined. (default: None, only useful when draw on CAD)
rename (String) – New name of the structure in Lumerical.
- draw(cell, layer)
Draw the Component on the layout.
- draw_on_lumerical_CAD(engine)
Draw the Component on the lumerical CAD (FDTD or MODE).
- Parameters
engine (FDTDSimulation or MODESimulation) – CAD to draw the component.
SBend
- class splayout.SBend(start_point, end_point, width, length=None, radius=5, z_start=None, z_end=None, material=None, rename=None)
Bases:
objectS-Bend Definition with a First Clockwise Bend in SPLayout.
- Parameters
start_point (Point) – Start point of the S-Bend.
end_point (Point) – End point of the S-Bend.
width (float) – Width of the waveguides (μm).
length (float) – Length of the S-Bend (μm).
radius (float) – Radius of the S-Bend once length is specified (μm).
z_start (Float) – The start point for the structure in z axis (unit: μm, default: None, only useful when draw on CAD).
z_end (Float) – The end point for the structure in z axis (unit: μm, default: None, only useful when draw on CAD).
material (str or float) – Material setting for the structure in Lumerical FDTD (SiO2 = “SiO2 (Glass) - Palik”, SiO2 = “SiO2 (Glass) - Palik”). When it is a float, the material in FDTD will be <Object defined dielectric>, and index will be defined. (default: None, only useful when draw on CAD)
rename (String) – New name of the structure in Lumerical.
Notes
Once length is specified, the end_point of the S-Bend will be re-calculated.
- draw(cell, layer)
Draw the Component on the layout.
- draw_on_lumerical_CAD(engine)
Draw the Component on the lumerical CAD (FDTD or MODE).
- Parameters
engine (FDTDSimulation or MODESimulation) – CAD to draw the component.
- get_start_point()
Derive the start point of the S-Bend.
- Returns
out – Start point.
- Return type
ASBend
- class splayout.ASBend(start_point, end_point, width, length=None, radius=5, z_start=None, z_end=None, material=None, rename=None)
Bases:
objectS-Bend Definition with a First Anti-Clockwise Bend in SPLayout.
- Parameters
start_point (Point) – Start point of the S-Bend.
end_point (Point) – End point of the S-Bend.
width (float) – Width of the waveguides (μm).
length (float) – Length of the S-Bend (μm).
radius (float) – Radius of the S-Bend once length is specified (μm).
z_start (Float) – The start point for the structure in z axis (unit: μm, default: None, only useful when draw on CAD).
z_end (Float) – The end point for the structure in z axis (unit: μm, default: None, only useful when draw on CAD).
material (str or float) – Material setting for the structure in Lumerical FDTD (SiO2 = “SiO2 (Glass) - Palik”, SiO2 = “SiO2 (Glass) - Palik”). When it is a float, the material in FDTD will be <Object defined dielectric>, and index will be defined. (default: None, only useful when draw on CAD)
rename (String) – New name of the structure in Lumerical.
Notes
Once length is specified, the end_point of the S-Bend will be re-calculated.
- draw(cell, layer)
Draw the Component on the layout.
- draw_on_lumerical_CAD(engine)
Draw the Component on the lumerical CAD (FDTD or MODE).
- Parameters
engine (FDTDSimulation or MODESimulation) – CAD to draw the component.
- get_start_point()
Derive the start point of the S-Bend.
- Returns
out – Start point.
- Return type
QuarBend
- class splayout.QuarBend(start_point, end_point, width, radius=5, z_start=None, z_end=None, material=None, rename=None)
Bases:
objectClockwise Connector Definition in SPLayout with an anticlockwise bend and two waveguides.
- Parameters
start_point (Point) – Start point of the connector.
point (end) – End point of the connector.
width (float) – Width of the waveguides (μm).
radius (float) – Radius of the bend (μm).
z_start (Float) – The start point for the structure in z axis (unit: μm, default: None, only useful when draw on CAD).
z_end (Float) – The end point for the structure in z axis (unit: μm, default: None, only useful when draw on CAD).
material (str or float) – Material setting for the structure in Lumerical FDTD (SiO2 = “SiO2 (Glass) - Palik”, SiO2 = “SiO2 (Glass) - Palik”). When it is a float, the material in FDTD will be <Object defined dielectric>, and index will be defined. (default: None, only useful when draw on CAD)
rename (String) – New name of the structure in Lumerical.
- draw(cell, layer)
Draw the Component on the layout.
- draw_on_lumerical_CAD(engine)
Draw the Component on the lumerical CAD (FDTD or MODE).
- Parameters
engine (FDTDSimulation or MODESimulation) – CAD to draw the component.
- get_start_point()
Derive the start point of the connector.
- Returns
out – Start point.
- Return type
AQuarBend
- class splayout.AQuarBend(start_point, end_point, width, radius=5, z_start=None, z_end=None, material=None, rename=None)
Bases:
objectAnticlockwise Connector Definition in SPLayout with an anticlockwise bend and two waveguides.
- Parameters
start_point (Point) – Start point of the connector.
point (end) – End point of the connector.
width (float) – Width of the waveguides (μm).
radius (float) – Radius of the bend (μm).
z_start (Float) – The start point for the structure in z axis (unit: μm, default: None, only useful when draw on CAD).
z_end (Float) – The end point for the structure in z axis (unit: μm, default: None, only useful when draw on CAD).
material (str or float) – Material setting for the structure in Lumerical FDTD (SiO2 = “SiO2 (Glass) - Palik”, SiO2 = “SiO2 (Glass) - Palik”). When it is a float, the material in FDTD will be <Object defined dielectric>, and index will be defined. (default: None, only useful when draw on CAD)
rename (String) – New name of the structure in Lumerical.
- draw(cell, layer)
Draw the Component on the layout.
- draw_on_lumerical_CAD(engine)
Draw the Component on the lumerical CAD (FDTD or MODE).
- Parameters
engine (FDTDSimulation or MODESimulation) – CAD to draw the component.
- get_start_point()
Derive the start point of the connector.
- Returns
out – Start point.
- Return type
Polygon
- class splayout.Polygon(point_list, z_start=None, z_end=None, material=None, rename=None, start_point=None, end_point=None, input_point=None, through_point=None, drop_point=None, add_point=None)
Bases:
objectPolygon Definition in SPLayout.
- Parameters
point_list (List of Point or List of Tuple) – Points for the polygon.
z_start (Float) – The start point for the structure in z axis (unit: μm, default: None, only useful when draw on CAD).
z_end (Float) – The end point for the structure in z axis (unit: μm, default: None, only useful when draw on CAD).
material (str or float) – Material setting for the structure in Lumerical FDTD (SiO2 = “SiO2 (Glass) - Palik”, SiO2 = “SiO2 (Glass) - Palik”). When it is a float, the material in FDTD will be <Object defined dielectric>, and index will be defined. (default: None, only useful when draw on CAD)
rename (String) – New name of the structure in Lumerical.
start_point (Point) – Start point definition for the Polygon, it can be used by “self.get_start_point()”.
end_point (Point) – End point definition for the Polygon, it can be used by “self.get_end_point()”.
input_point (Point) – Input point definition for the Polygon, it can be used by “self.get_input_point()”.
through_point (Point) – Through point definition for the Polygon, it can be used by “self.get_through_point()”.
drop_point (Point) – Drop point definition for the Polygon, it can be used by “self.get_drop_point()”.
add_point (Point) – Add point definition for the Polygon, it can be used by “self.get_add_point()”.
- draw(cell, layer)
Draw the Component on the layout.
- draw_on_lumerical_CAD(engine)
Draw the Component on the lumerical CAD (FDTD or MODE).
- Parameters
engine (FDTDSimulation or MODESimulation) – CAD to draw the component.
- get_the_point_at_number(i)
Draw the Component on the layout.
- Parameters
i (int) – The number of the point you want.
- Returns
out – The ith Point in List.
- Return type
- get_start_point()
Derive the start point of the Polygon.
- Returns
out – Start point.
- Return type
- get_input_point()
Derive the input port point of the Polygon.
- Returns
out – Input point.
- Return type
- get_through_point()
Derive the through port point of the Polygon.
- Returns
out – Through point.
- Return type
- get_drop_point()
Derive the drop port point of the Polygon.
- Returns
out – Drop point.
- Return type
DoubleBendConnector
- class splayout.DoubleBendConnector(start_point, end_point, width, z_start=None, z_end=None, material=None, rename=None, radius=5, xpercent=0.5, ypercent=0.5, direction=1)
Bases:
objectDouble Bend Connector Definition in SPLayout with Triple Waveguide and two 90-degree Bends.
- Parameters
start_point (Point) – Start point of the DoubleBendConnector.
end_point (Point) – End point of the DoubleBendConnector.
width (float) – Width of the waveguide (μm).
z_start (Float) – The start point for the structure in z axis (unit: μm, default: None, only useful when draw on CAD).
z_end (Float) – The end point for the structure in z axis (unit: μm, default: None, only useful when draw on CAD).
material (str or float) – Material setting for the structure in Lumerical FDTD (SiO2 = “SiO2 (Glass) - Palik”, SiO2 = “SiO2 (Glass) - Palik”). When it is a float, the material in FDTD will be <Object defined dielectric>, and index will be defined. (default: None, only useful when draw on CAD)
rename (String) – New name of the structure in Lumerical.
radius (float) – Radius of the bends (μm).
xpercent (float) – The center point location between start point and end point in the x axis (0~1).
ypercent (float) – The center point location between start point and end point in the y axis (0~1).
direction (HORIZONAL or VERTICAL) – HORIZONAL means the DoubleBendConnector will connect start point and end point in the horizontal direction. VERTICAL means the DoubleBendConnector will connect start point and end point in the vertical direction
- draw(cell, layer)
Draw the Component on the layout.
- draw_on_lumerical_CAD(engine)
Draw the Component on the lumerical CAD (FDTD or MODE).
- Parameters
engine (FDTDSimulation or MODESimulation) – CAD to draw the component.
- get_start_point()
Derive the start point of the connector.
- Returns
out – Start point.
- Return type
AddDropMicroring
- class splayout.AddDropMicroring(start_point, radius, gap, wg_width, coupling_length, relative_position=0)
Bases:
objectAdd-drop micro-ring Definition in SPLayout with two bend coupling region.
- Parameters
start_point (Point) – Input port point of the Add-drop micro-ring.
radius (float) – Radius of the ring (μm).
gap (float) – Gap between the two waveguides in coupling region (μm).
wg_width (float) – Width of the waveguides.
coupling_length (float) – The coupling length in coupling region (μm).
relative_position (RIGHT or UP or LEFT or DOWN) – The relative position of the microring according to the other components.
- draw(cell, layer)
Draw the Component on the layout.
- add_heater(cell, heater_layer, heater_radian=1.5707963267948966, heater_width=2, connect_pad_width=14, bus_width=4, contact=0, contact_layer=None, contact_width=150, contact_bus_width=10, contact_position=90, open=0, open_layer=None, open_width=140, touch=0, touch_layer=None)
Add heater and corresponding pads for the micro-ring.
- Parameters
cell (Cell) – Cell to draw the heater and pads.
heater_layer (Layer) – Layer to draw heater.
heater_radian (float) – Radian for adjusting the cover region of the heater (radian) [can be easily defined by math.pi].
heater_width (float) – Width of the heater (μm).
connect_pad_width (float) – The width of pads that connect the heater material to the conductor material.
bus_width (float) – The width of the heater material bus waveguide (μm).
contact (bool or int) – If add contact (conductor material) for the microring.
contact_layer (Layer) – The Layer to draw the contact (conductor material).
contact_bus_width (float) – The width of the conductor bus waveguide (μm).
contact_position (UP or DOWN) – The relative position of the contact pads according to the microring.
open (bool or int) – If add an open region for the contact pad.
open_layer (Layer) – The Layer to draw the open region.
open_width (float) – The width of the open region (rectradian) (μm).
touch (bool or int) – If add an touch region for the connect pad.
touch_layer (Layer) – The Layer to draw the touch region.
- get_input_point()
Derive the input port point of the AddDropMicroringFlat.
- Returns
out – Input point.
- Return type
- get_through_point()
Derive the through port point of the AddDropMicroringFlat.
- Returns
out – Through point.
- Return type
- get_drop_point()
Derive the drop port point of the AddDropMicroringFlat.
- Returns
out – Drop point.
- Return type
- get_add_point()
Derive the add port point of the AddDropMicroringFlat.
- Returns
out – Add point.
- Return type
- get_left_contact_point()
Derive the left contact center point of the AddDropMicroringFlat.
- Returns
out – Left contact center point.
- Return type
- get_right_contact_point()
Derive the right contact center point of the AddDropMicroringFlat.
- Returns
out – Right contact center point.
- Return type
- get_left_pad_point()
Derive the left conductor pad center point of the AddDropMicroringFlat.
- Returns
out – Left conductor pad center point.
- Return type
AddDropMicroringFlat
- class splayout.AddDropMicroringFlat(start_point, radius, gap, wg_width, coupling_length, relative_position=0)
Bases:
objectAdd-drop micro-ring Definition in SPLayout with two flat coupling region.
- Parameters
start_point (Point) – Input port point of the Add-drop micro-ring.
radius (float) – Radius of the ring (μm).
gap (float) – Gap between the two waveguides in coupling region (μm).
wg_width (float) – Width of the waveguides.
coupling_length (float) – The coupling length in coupling region (μm).
relative_position (RIGHT or UP or LEFT or DOWN) – The relative position of the microring according to the other components.
- draw(cell, layer)
Draw the Component on the layout.
- add_heater(cell, heater_layer, heater_radian=1.5707963267948966, heater_width=2, connect_pad_width=14, bus_width=4, contact=0, contact_layer=None, contact_width=150, contact_bus_width=10, contact_position=90, open=0, open_layer=None, open_width=140, touch=0, touch_layer=None)
Add heater and corresponding pads for the micro-ring.
- Parameters
cell (Cell) – Cell to draw the heater and pads.
heater_layer (Layer) – Layer to draw heater.
heater_radian (float) – Radian for adjusting the cover region of the heater (radian) [can be easily defined by math.pi].
heater_width (float) – Width of the heater (μm).
connect_pad_width (float) – The width of pads that connect the heater material to the conductor material.
bus_width (float) – The width of the heater material bus waveguide (μm).
contact (bool or int) – If add contact (conductor material) for the microring.
contact_layer (Layer) – The Layer to draw the contact (conductor material).
contact_bus_width (float) – The width of the conductor bus waveguide (μm).
contact_position (UP or DOWN) – The relative position of the contact pads according to the microring.
open (bool or int) – If add an open region for the contact pad.
open_layer (Layer) – The Layer to draw the open region.
open_width (float) – The width of the open region (rectradian) (μm).
touch (bool or int) – If add an touch region for the connect pad.
touch_layer (Layer) – The Layer to draw the touch region.
- get_input_point()
Derive the input port point of the AddDropMicroringFlat.
- Returns
out – Input point.
- Return type
- get_through_point()
Derive the through port point of the AddDropMicroringFlat.
- Returns
out – Through point.
- Return type
- get_drop_point()
Derive the drop port point of the AddDropMicroringFlat.
- Returns
out – Drop point.
- Return type
- get_add_point()
Derive the add port point of the AddDropMicroringFlat.
- Returns
out – Add point.
- Return type
- get_left_contact_point()
Derive the left contact center point of the AddDropMicroringFlat.
- Returns
out – Left contact center point.
- Return type
- get_right_contact_point()
Derive the right contact center point of the AddDropMicroringFlat.
- Returns
out – Right contact center point.
- Return type
- get_left_pad_point()
Derive the left conductor pad center point of the AddDropMicroringFlat.
- Returns
out – Left conductor pad center point.
- Return type
Text
- class splayout.Text(start_point, text, size=20, horizontal=True)
Bases:
objectText Definition in SPLayout.
- Parameters
start_point (Point) – Start point of the DoubleBendConnector.
text (string) – Characters that you want to put on the layout.
size (int) – The size of the characters.
horizontal (bool) – If the text will be put horizontally.
Circle
- class splayout.Circle(center_point, radius, z_start=None, z_end=None, material=None, rename=None)
Bases:
objectFilled Circle Definition in SPLayout.
- Parameters
center_point (Point) – Center point of the circle.
radius (float) – Radius of the circle.
z_start (Float) – The start point for the structure in z axis (unit: μm, default: None, only useful when draw on CAD).
z_end (Float) – The end point for the structure in z axis (unit: μm, default: None, only useful when draw on CAD).
material (str or float) – Material setting for the structure in Lumerical FDTD (SiO2 = “SiO2 (Glass) - Palik”, SiO2 = “SiO2 (Glass) - Palik”). When it is a float, the material in FDTD will be <Object defined dielectric>, and index will be defined. (default: None, only useful when draw on CAD)
rename (String) – New name of the structure in Lumerical.
- draw(cell, layer)
Draw the Component on the layout.
- draw_on_lumerical_CAD(engine)
Draw the Component on the lumerical CAD (FDTD or MODE).
- Parameters
engine (FDTDSimulation or MODESimulation) – CAD to draw the component.
Rectangle
- class splayout.Rectangle(center_point, width, height=None, z_start=None, z_end=None, material=None, rename=None)
Bases:
objectFilled Rectangle Definition in SPLayout.
- Parameters
center_point (Point) – Center point of the circle.
width (float) – Width of the rectangle.
height (float) – Height of the rectangle(if not specified, height will equal to width).
z_start (Float) – The start point for the structure in z axis (unit: μm, default: None, only useful when draw on CAD).
z_end (Float) – The end point for the structure in z axis (unit: μm, default: None, only useful when draw on CAD).
material (str or float) – Material setting for the structure in Lumerical FDTD (SiO2 = “SiO2 (Glass) - Palik”, SiO2 = “SiO2 (Glass) - Palik”). When it is a float, the material in FDTD will be <Object defined dielectric>, and index will be defined. (default: None, only useful when draw on CAD)
rename (String) – New name of the structure in Lumerical.
- draw(cell, layer)
Draw the Component on the layout.
- draw_on_lumerical_CAD(engine)
Draw the Component on the lumerical CAD (FDTD or MODE).
- Parameters
engine (FDTDSimulation or MODESimulation) – CAD to draw the component.
Functions for Self-define Components
MAKE_AEMD_GRATING
- splayout.MAKE_AEMD_GRATING(port_width=0.45, waveguide_layer=<splayout.utils.Layer object>, etch_layer=<splayout.utils.Layer object>, grating_number=40, grating_period=0.63, grating_duty=0.47619047619047616)
Make an AEMD Grating Class.
- Parameters
port_width (float (unit: μm)) – The port width of the grating.
waveguide_layer (Layer) – The layer for waveguide.
etch_layer (Layer) – The layer for etching.
grating_number (int) – Number of the etching slices.
grating_period (float) – Period of the grating.
grating_duty (float) – Duty of the grating.
- Returns
out – Can be used to define an AEMD grating.
- Return type
‘Class’
Notes
The port width should not be too small or too large (better between 0.4 and 0.5). The returned Class has two parameters: start_point,relative_position. It can be drawn on the cell with: object.draw(cell).
Examples
>>> # get a AEMD grating definition >>> AEMDgrating = MAKE_AEMD_GRATING(port_width=0.5) >>> # start point for the AEMD grating >>> grating_point = Point(90,-30) >>> # make the AEMD grating >>> right_grating = AEMDgrating(grating_point,RIGHT) >>> # draw the AEMD grating on the layout >>> right_grating.draw(cell)
MAKE_COMPONENT
- splayout.MAKE_COMPONENT(filename, rename=None, relative_start_point=<splayout.utils.Point object>, relative_end_point=None, relative_input_point=None, relative_through_point=None, relative_drop_point=None, relative_add_point=None, initial_relative_position=0)
Make an self-defined Class with another gdsii file.
- Parameters
filename (string) – The name of the file that contains your component.
rename (string) – Name of the cell (default: the filename).
relative_start_point (Point) – The start point in the file that contains your component (can be missing).
relative_end_point (Point) – The end point in the file that contains your component (can be missing).
relative_input_point (Point) – The input point in the file that contains your component (can be missing).
relative_through_point (Point) – The through point in the file that contains your component (can be missing).
relative_drop_point (Point) – The drop point in the file that contains your component (can be missing).
relative_add_point (Point) – The add point in the file that contains your component (can be missing).
initial_relative_position (RIGHT or UP or LEFT or DOWN) – The relative position of the component that is contained in the file with ‘filename’.
- Returns
out – Can be used to define your own component that is contained in the file with ‘filename’.
- Return type
‘Class’
Notes
The returned Class has two parameters: start_point,relative_position. It can be drawn on the cell with: object.draw(cell). If the relative_***_point is specified, then you can use: object.get_***_point() to drive the corresponding point in the cell.
Examples
>>> # take the "selfdefine.gds" as an example >>> SelfDefineComponent = MAKE_COMPONENT("selfdefine.gds") >>> # start point for the component >>> start_point = Point(0,-90) >>> # make the component >>> component = SelfDefineComponent(start_point,RIGHT) >>> # draw the component on the layout >>> component.draw(cell)
Make File and Generate Specifical Layer
make_gdsii_file
- splayout.make_gdsii_file(filename, cover_source_layer=None, cover_target_layer=None, inv_source_layer=None, inv_target_layer=None, lib=<gdspy.library.GdsLibrary object>)
Make gdsii file based on all the drawn component before the function is called.
- Parameters
filename (string) – The name of the target file (can include the path to the file, e.g. “./output/test.gds”).
cover_source_layer (Layer) – The layer based on which the cover layer will be generated.
cover_target_layer (Layer) – The layer that will contain the generated cover layer.
inv_source_layer (Layer) – The layer based on which the inverse layer will be generated.
cover_target_layer – The layer that will contain the generated inverse layer.
remove_cell
FDTD API
FDTDSimulation
- class splayout.FDTDSimulation(hide=0, fdtd_path='C:\\Program Files\\Lumerical\\v202\\api\\python\\', load_file=None)
Bases:
objectFDTD Simulation via Lumerical FDTD API, especially for 2-Dimension structures.
- Parameters
hide (Bool) – Whether the Lumerical window is hidden (default: False).
fdtd_path (String) – Path to the Lumerical Python API folder.
load_file (String) – Path to the .fsp file that what want to be loaded (default: None).
- add_structure_from_gdsii(filename, cellname, layer=1, datatype=0, material='Si (Silicon) - Palik', z_start=- 0.11, z_end=0.11, rename=None)
Draw the structure to the simulation CAD from gdsii file.
- Parameters
filename (String) – GDSII file path.
cellname (String) – The name of the cell that contains the structure.
layer (Int) – The number of the layer that contains the structure (default: 1).
datatype (Int) – The datatype of the layer that contains the structure (default: 0).
material (String) – Material setting for the structure in Lumerical FDTD (Si = “Si (Silicon) - Palik”, SiO2 = “SiO2 (Glass) - Palik”, default: Si).
z_start (Float) – The start point for the structure in z axis (unit: μm, default: -0.11).
z_end (Float) – The end point for the structure in z axis (unit: μm, default: 0.11).
rename (String) – New name of the structure in Lumerical FDTD.
- add_power_monitor(position, width=2, height=0.8, monitor_name='powermonitor', points=1001)
Add power monitor in Lumerical FDTD (DFT Frequency monitor).
- Parameters
position (Point or tuple) – Center point of the monitor.
width (Float) – Width of the monitor (in y axis, unit: μm, default: 2).
height (Float) – Height of the monitor (in z axis, unit: μm, default: 0.8).
monitor_name (String) – Name of the structure in Lumerical FDTD (default: “powermonitor”).
points (Int) – The number of the frequency points that will be monitored (default: 1001).
- add_mode_expansion(position, mode_list, width=2, height=0.8, expansion_name='expansion', points=251, update_mode=0)
Add mode expansion monitor in Lumerical FDTD. Add mode expansion monitor in Lumerical FDTD.
- Parameters
position (Point or tuple) – Center point of the monitor.
mode_list (List) – List that contains the index of desired mode (start from 1).
width (Float) – Width of the monitor (in y axis, unit: μm, default: 2).
height (Float) – Height of the monitor (in z axis, unit: μm, default: 0.8).
expansion_name (String) – Name of the mode expansion monitor in Lumerical FDTD (default: “expansion”).
points (Int) – The number of the frequency points that will be monitored (default: 251).
update_mode (Int or bool) – Whether update the mode after defining FDTD and mesh (default: 0).
Notes
This function will automatically add a power monitor at the same position with same shape. If use update_mode the monitor should be put after adding fdtd region and mesh region.
- reset_mode_expansion_modes(expansion_name, mode_list)
Reset mode list for mode expansion monitor.
- Parameters
expansion_name (String) – Name of the mode expansion monitor in Lumerical FDTD.
mode_list (List) – List that contains the index of desired mode (start from 1).
Notes
This function should be called after setting a mode expansion.
- add_mode_source(position, width=2, height=0.8, source_name='source', mode_number=1, amplitude=1, phase=0, wavelength_start=1.54, wavelength_end=1.57, direction=1, update_mode=0)
Add source in Lumerical FDTD.
- Parameters
position (Point or tuple) – Center point of the source.
width (Float) – Width of the source (in y axis, unit: μm, default: 2).
height (Float) – Height of the source (in z axis, unit: μm, default: 0.8).
source_name (String) – Name of the source in Lumerical FDTD (default: “source”).
mode_number (Int) – The selected mode index (start from 1).
amplitude (Float or Int) – The amplitude of the source.
phase (Float or Int) – The phase of the source.
wavelength_start (Float) – The start wavelength of the source (unit: μm, default: 1.540).
wavelength_end (Float) – The end wavelength of the source (unit: μm, default: 1.570).
direction (Int) – The light propagation direction 1: the positive direction of x-axis, 0: the negative direction of x-axis(FORWARD:1, BACKWARD:0 , default: FORWARD).
update_mode (Int or bool) – Whether update the mode after defining FDTD and mesh (default: 0).
Notes
If use update_mode the monitor should be put after adding fdtd region and mesh region.
- reset_source_mode(source_name, mode_number)
Reset mode for source.
- Parameters
source_name (String) – Name of the source in Lumerical FDTD.
mode_number (Int) – The selected mode index (start from 1).
Notes
This function should be called after setting a source.
- reset_source_amplitude(source_name, amplitude)
Reset amplitude for source.
- Parameters
source_name (String) – Name of the source in Lumerical FDTD.
amplitude (Float or Int) – New amplitude for the source.
Notes
This function should be called after setting a source.
- reset_source_phase(source_name, phase)
Reset amplitude for source.
- Parameters
source_name (String) – Name of the source in Lumerical FDTD.
phase (Float or Int) – New phase for the source.
Notes
This function should be called after setting a source.
- add_fdtd_region(bottom_left_corner_point, top_right_corner_point, simulation_time=5000, background_index=1.444, mesh_order=2, dimension=3, height=1, z_symmetric=0, y_antisymmetric=0, pml_layers=8)
Add simulation region in Lumerical FDTD.
- Parameters
bottom_left_corner_point (Point) – Lower left corner of the region.
top_right_corner_point (Point) – Upper right corner of the region.
simulation_time (int) – Total simulation time (unit: fs, default: 5000).
background_index (float) – Background refractive index in the simualtion region (default: 1.444).
mesh_order (int) – The level of the mesh grid in Lumerical FDTD (default: 2).
dimension (Int) – Dimension of FDTD simulation (default: 3).
height (Float) – Height of the simulation region (in z axis, unit: μm, default: 1).
z_symmetric (Bool) – Whether set symmetric in z-axis (default: 0).
- add_index_region(bottom_left_corner_point, top_right_corner_point, height=1, z_min=None, z_max=None, index_monitor_name='index', dimension=2)
Add index monitor (x-y plane) in Lumerical FDTD.
- Parameters
bottom_left_corner_point (Point) – Lower left corner of the region.
top_right_corner_point (Point) – Upper right corner of the region.
height (Float) – Height of the monitor (in z axis, unit: μm, default: 1).
index_monitor_name (String) – Name of the monitor in Lumerical FDTD (default: “index”).
dimension (Int) – Dimension of monitor (default: 2).
- add_field_region(bottom_left_corner_point, top_right_corner_point, height=1, z_min=None, z_max=None, field_monitor_name='field', dimension=2)
Add field monitor (x-y plane) in Lumerical FDTD (DFT Frequency monitor).
- Parameters
bottom_left_corner_point (Point) – Lower left corner of the region.
top_right_corner_point (Point) – Upper right corner of the region.
height (Float) – Height of the monitor (in z axis, unit: μm, default: 1).
field_monitor_name (String) – Name of the monitor in Lumerical FDTD (default: “field”).
dimension (Int) – Dimension of monitor (default: 2).
- add_mesh_region(bottom_left_corner_point, top_right_corner_point, x_mesh, y_mesh, z_mesh=0.0025, height=1, z_min=None, z_max=None)
Reset the mesh grid in Lumerical FDTD.
- Parameters
bottom_left_corner_point (Point) – Lower left corner of the region.
top_right_corner_point (Point) – Upper right corner of the region.
x_mesh (Float) – The grid unit in x-axis (unit: μm).
y_mesh (Float) – The grid unit in y-axis (unit: μm).
z_mesh (Float) – The grid unit in z-axis (unit: μm, default: 0.0025).
height (Float) – Height of the region (in z axis, unit: μm, default: 1).
z_min (Float) – The start point for the structure in z axis (unit: μm, default: -0.11).
z_max (Float) – The end point for the structure in z axis (unit: μm, default: 0.11).
- save(filename='temp')
Save the simulation as a “.fsp” file.
- Parameters
filename (String) – File name or File path (default: “temp”).
- run(filename='temp')
Save the simulation as a “.fsp” file and run.
- Parameters
filename (String) – File name or File path (default: “temp”).
- get_transmission(monitor_name, datafile=None)
Get data from power monitor after running the simulation.
- Parameters
monitor_name (String) – Name of the power monitor.
datafile (String) – The name of the file for saving the data, None means no saving (default: None).
- Returns
out – Spectrum [wavelength,transmission], size: (2,frequency points).
- Return type
Array
- get_mode_transmission(expansion_name, direction=1, datafile=None)
Get data from mode expansion monitor after running the simulation.
- Parameters
expansion_name (String) – Name of the mode expansion monitor.
datafile (String) – The name of the file for saving the data, None means no saving (default: None).
- Returns
out – Spectrum [[wavelength,transmission],…], size: (number of modes,2,frequency points).
- Return type
Array
- get_mode_phase(expansion_name, direction=1, datafile=None)
Get data and calculate phase vs wavelength from mode expansion monitor after running the simulation.
- Parameters
expansion_name (String) – Name of the mode expansion monitor.
direction (Int) – The light propagation direction 1: the positive direction of x-axis, 0: the negative direction of x-axis(FORWARD:1, BACKWARD:0 , default: FORWARD).
datafile (String) – The name of the file for saving the data, None means no saving (default: None).
- Returns
out – Phase, size: (1,frequency points).
- Return type
Array
- get_mode_coefficient(expansion_name, direction=1, datafile=None)
Get data and calculate coefficient from mode expansion monitor after running the simulation.
- Parameters
expansion_name (String) – Name of the mode expansion monitor.
direction (Int) – The light propagation direction 1: the positive direction of x-axis, 0: the negative direction of x-axis(FORWARD:1, BACKWARD:0 , default: FORWARD).
datafile (String) – The name of the file for saving the data, None means no saving (default: None).
- Returns
out – Spectrum, size: (1,frequency points).
- Return type
Array
- get_source_power(source_name=None, datafile=None)
Get source power spectrum from source.
- Parameters
source_name (String) – Name of the source.
datafile (String) – The name of the file for saving the data, None means no saving (default: None).
- Returns
out – Spectrum, size: (1,frequency points).
- Return type
Array
Notes
This function should be called after setting the frequency points in any frequency domain monitor.
- get_wavelength()
Get wavelength points from Lumerical simulation.
- Returns
out – Wavelength points, size: (1,frequency points).
- Return type
Array
Notes
This function should be called after setting the wavelength range in source and the frequency points in any frequency domain monitor.
- get_frequency()
Get frequency points from Lumerical simulation.
- Returns
out – Frequency points, size: (1,frequency points).
- Return type
Array
Notes
This function should be called after setting the wavelength range in source and the frequency points in any frequency domain monitor.
- get_omega()
Get omega points from Lumerical simulation (omega = 2*pi*frequency).
- Returns
out – Omega points, size: (1,frequency points).
- Return type
Array
Notes
This function should be called after setting the wavelength range in source and the frequency points in any frequency domain monitor.
- get_epsilon_distribution(index_monitor_name='index', data_name='index_data', datafile=None)
Get epsilon distribution from index monitor.
- Parameters
index_monitor_name (String) – Name of the index monitor (default: “index”).
data_name (String) – Name of the data in Lumeircal FDTD (default: “index_data”).
datafile (String) – The name of the file for saving the data, None means no saving (default: None).
- Returns
out – Spectrum, size: (x mesh, y mesh, z mesh, 1).
- Return type
Array
- get_epsilon_distribution_in_CAD(index_monitor_name='index', data_name='index_data')
Get epsilon distribution from index monitor and save the data in CAD. (From: lumopt. https://github.com/chriskeraly/lumopt)
- Parameters
index_monitor_name (String) – Name of the index monitor (default: “index”).
data_name (String) – Name of the data in Lumeircal FDTD (default: “index_data”).
- Returns
data_name – The name of the data in Lumerical.
- Return type
String
- get_E_distribution(field_monitor_name='field', data_name='field_data', datafile=None, if_get_spatial=0)
Get electric field distribution from field monitor.
- Parameters
field_monitor_name (String) – Name of the field monitor (default: “field”).
data_name (String) – Name of the data in Lumeircal FDTD (default: “field_data”).
datafile (String) – The name of the file for saving the data, None means no saving (default: None).
if_get_spatial (Bool) – Whether get spatial information as return (default: 0).
- Returns
out –
- if if_get_spatial == 0: field
size: (x mesh, y mesh, z mesh, frequency points, 3).
- if if_get_spatial == 1: field, x mesh, y mesh, z mesh
size: (x mesh, y mesh, z mesh, frequency points, 3), (x mesh,), (y mesh,), (z mesh,)
- Return type
Array
- get_E_distribution_in_CAD(field_monitor_name='field', data_name='field_data')
Get electric field distribution from field monitor and save the data in CAD.
- Parameters
field_monitor_name (String) – Name of the field monitor (default: “field”).
data_name (String) – Name of the data in Lumeircal FDTD (default: “field_data”).
- Returns
data_name – The name of the data in Lumerical.
- Return type
String
- clear_data_in_CAD()
Clear the pre-saved data in CAD.
- switch_to_layout()
Switch the Lumerical FDTD simulation to “Layout” mode.
- set_disable(item_name)
Set an item of the simulation to “disable” state.
- Parameters
item_name (String or list) – Name of the item.
Notes
This function should be called in “Layout” mode for the Lumerical FDTD simulaiton.
- set_enable(item_name)
Set an item of the simulation to “enable” state.
- Parameters
item_name (String or list) – Name of the item.
Notes
This function should be called in “Layout” mode for the Lumerical FDTD simulaiton.
- remove(item_name)
Remove an item of the simulation.
- Parameters
item_name (String or list) – Name of the item.
Notes
This function should be called in “Layout” mode for the Lumerical FDTD simulaiton.
- static str_list(list)
Convert a list to String expression.
- Parameters
list (List) – The List for conversion.
- Returns
out – The String expression of the input List.
- Return type
String
- static lumerical_list(tuple_list)
Convert a tuple list to Lumerical list String expression.
- Parameters
tuple_list (List) – The List for conversion.
- Returns
out – The Lumerical list String expression of the input List.
- Return type
String
- put_rectangle(bottom_left_corner_point, top_right_corner_point, z_start, z_end, material, rename)
Draw a rectangle on the fdtd simulation CAD.
- Parameters
bottom_left_corner_point (tuple or Point) – Bottom left corner point of the rectangle.
top_right_corner_point (tuple or Point) – Top right corner point of the rectangle.
z_start (Float) – The start point for the structure in z axis (unit: μm).
z_end (Float) – The end point for the structure in z axis (unit: μm).
material (str or float) – Material setting for the structure in Lumerical FDTD (SiO2 = “SiO2 (Glass) - Palik”, SiO2 = “SiO2 (Glass) - Palik”, default: SiO2). When it is a float, the material in FDTD will be <Object defined dielectric>, and index will be defined.
rename (String) – New name of the structure in Lumerical.
- put_polygon(tuple_list, z_start, z_end, material, rename)
Draw a polygon on the fdtd simulation CAD.
- Parameters
point_list (List of Tuple) – Points for the polygon.
z_start (Float) – The start point for the structure in z axis (unit: μm).
z_end (Float) – The end point for the structure in z axis (unit: μm).
material (str or float) – Material setting for the structure in Lumerical FDTD (SiO2 = “SiO2 (Glass) - Palik”, SiO2 = “SiO2 (Glass) - Palik”, default: SiO2). When it is a float, the material in FDTD will be <Object defined dielectric>, and index will be defined.
rename (String) – New name of the structure in Lumerical.
- update_polygon(polygon_name, point_list)
Update a polygon on the fdtd simulation CAD.
- Parameters
polygon_name (str) – Name of the polygon.
point_list (List of Point) – Points for the polygon.
- put_round(center_point, inner_radius, outer_radius, start_radian, end_radian, z_start, z_end, material, rename)
Draw a round on the fdtd simulation CAD.
- Parameters
center_point (Point) – Points for the center of the round.
inner_radius (float) – Inner radius of the round.
outer_radius (float) – Outer radius of the round.
start_radian (float) – The start radian of the round (unit: radian).
end_radian (float) – The end radian of the round (unit: radian).
z_start (Float) – The start point for the structure in z axis (unit: μm).
z_end (Float) – The end point for the structure in z axis (unit: μm).
material (str or float) – Material setting for the structure in Lumerical FDTD (SiO2 = “SiO2 (Glass) - Palik”, SiO2 = “SiO2 (Glass) - Palik”, default: SiO2). When it is a float, the material in FDTD will be <Object defined dielectric>, and index will be defined.
rename (String) – New name of the structure in Lumerical.
- add_structure_circle(center_point, radius, material='SiO2 (Glass) - Palik', z_start=- 0.11, z_end=0.11, rename='circle')
Draw the a circle on the simulation CAD.
- Parameters
center_point (Point) – Center point of the circle.
radius (float) – Radius of the circle (unit: μm).
material (str or float) – Material setting for the structure in Lumerical FDTD (SiO2 = “SiO2 (Glass) - Palik”, SiO2 = “SiO2 (Glass) - Palik”, default: SiO2). When it is a float, the material in FDTD will be <Object defined dielectric>, and index will be defined.
z_start (Float) – The start point for the structure in z axis (unit: μm, default: -0.11).
z_end (Float) – The end point for the structure in z axis (unit: μm, default: 0.11).
rename (String) – New name of the structure in Lumerical FDTD (default: “circle”).
- add_structure_rectangle(center_point, x_length, y_length, material='SiO2 (Glass) - Palik', z_start=- 0.11, z_end=0.11, rename='rect')
Draw the a rectangle on the simulation CAD.
- Parameters
center_point (Point) – Center point of the rectangle.
x_length (float) – Length in the x axis (unit: μm).
y_length (float) – Length in the y axis (unit: μm).
material (str or float) – Material setting for the structure in Lumerical FDTD (SiO2 = “SiO2 (Glass) - Palik”, SiO2 = “SiO2 (Glass) - Palik”, default: SiO2). When it is a float, the material in FDTD will be <Object defined dielectric>, and index will be defined.
z_start (Float) – The start point for the structure in z axis (unit: μm, default: -0.11).
z_end (Float) – The end point for the structure in z axis (unit: μm, default: 0.11).
rename (String) – New name of the structure in Lumerical FDTD (default: “rect”).
- eval(command)
Execute the command on the fdtd.
- Parameters
command (str) – Command that can be evaluated in fdtd.
MODESimulation
- class splayout.MODESimulation(hide=0, fdtd_path='C:\\Program Files\\Lumerical\\v202\\api\\python\\', load_file=None)
Bases:
objectMODE Simulation via Lumerical varFDTD API, especially for 2-Dimension structures.
- Parameters
hide (Bool) – Whether the Lumerical window is hidden (default: False).
fdtd_path (String) – Path to the Lumerical Python API folder.
load_file (String) – Path to the .lms file that what want to be loaded (default: None).
- save(filename='temp')
Save the simulation as a “.lms” file.
- Parameters
filename (String) – File name or File path (default: “temp”).
- run(filename='temp')
Save the simulation as a “.lms” file and run.
- Parameters
filename (String) – File name or File path (default: “temp”).
- add_varfdtd_region(bottom_left_corner_point, top_right_corner_point, mode_position, simulation_time=5000, test_points=None, background_index=1.444, mesh_order=2, height=1, z_symmetric=0)
Add varFDTD simulation region in Lumerical MODE.
- Parameters
bottom_left_corner_point (Point or tuple) – Lower left corner of the region.
top_right_corner_point (Point or tuple) – Upper right corner of the region.
mode_position (Point or tuple) – The point for slab mode calculation.
simulation_time (int) – Total simulation time (unit: fs, default: 5000).
test_points (List of tuple) – Four test point for effective index (default: None).
background_index (float) – Background refractive index in the simualtion region (default: 1.444).
mesh_order (int) – The level of the mesh grid in Lumerical MODE (default: 2).
height (Float) – Height of the simulation region (in z axis, unit: μm, default: 1).
z_symmetric (Bool) – Whether set symmetric in z-axis (default: 0).
- add_gaussian_source(position, width=2, source_name='gauss', amplitude=1, phase=0, waist_radius=2.45, wavelength_start=1.54, wavelength_end=1.57, direction=1)
Add gaussian source in Lumerical MODE.
- Parameters
position (Point or tuple) – Center point of the source.
width (Float) – Width of the source (in y axis, unit: μm, default: 2).
source_name (String) – Name of the source in Lumerical MODE (default: “source”).
amplitude (float) – Amplitude of the source.
phase (float) – Phase of the source (unit: radian).
waist_radius (float) – Waist radius of the gauss source (unit: μm).
wavelength_start (Float) – The start wavelength of the source (unit: μm, default: 1.540).
wavelength_end (Float) – The end wavelength of the source (unit: μm, default: 1.570).
direction (Int) – The light propagation direction 1: the positive direction of x-axis, 0: the negative direction of x-axis(FORWARD:1, BACKWARD:0 , default: FORWARD).
- add_power_monitor(position, width=2, height=0.8, monitor_name='powermonitor', points=101)
Add power monitor in Lumerical MODE.
- Parameters
position (Point or tuple) – Center point of the monitor.
width (Float) – Width of the monitor (in y axis, unit: μm, default: 2).
height (Float) – Height of the monitor (in z axis, unit: μm, default: 0.8).
monitor_name (String) – Name of the structure in Lumerical MODE (default: “powermonitor”).
points (Int) – The number of the frequency points that will be monitored (default: 1001).
- add_structure_from_gdsii(filename, cellname, layer=1, datatype=0, material='Si (Silicon) - Palik', z_start=- 0.11, z_end=0.11, rename=None)
Draw the structure to the simulation CAD from gdsii file.
- Parameters
filename (String) – GDSII file path.
cellname (String) – The name of the cell that contains the structure.
layer (Int) – The number of the layer that contains the structure (default: 1).
datatype (Int) – The datatype of the layer that contains the structure (default: 0).
material (String) – Material setting for the structure in Lumerical MODE (Si = “Si (Silicon) - Palik”, SiO2 = “SiO2 (Glass) - Palik”, default: Si).
z_start (Float) – The start point for the structure in z axis (unit: μm, default: -0.11).
z_end (Float) – The end point for the structure in z axis (unit: μm, default: 0.11).
rename (String) – New name of the structure in Lumerical MODE.
- static lumerical_list(tuple_list)
Convert a tuple list to Lumerical list String expression.
- Parameters
tuple_list (List) – The List for conversion.
- Returns
out – The Lumerical list String expression of the input List.
- Return type
String
- put_rectangle(bottom_left_corner_point, top_right_corner_point, z_start, z_end, material, rename)
Draw a rectangle on the varFDTD simulation CAD.
- Parameters
bottom_left_corner_point (tuple or Point) – Bottom left corner point of the rectangle.
top_right_corner_point (tuple or Point) – Top right corner point of the rectangle.
z_start (Float) – The start point for the structure in z axis (unit: μm).
z_end (Float) – The end point for the structure in z axis (unit: μm).
material (str or float) – Material setting for the structure in Lumerical MODE (SiO2 = “SiO2 (Glass) - Palik”, SiO2 = “SiO2 (Glass) - Palik”, default: SiO2). When it is a float, the material in MODE will be <Object defined dielectric>, and index will be defined.
rename (String) – New name of the structure in Lumerical.
- put_polygon(tuple_list, z_start, z_end, material, rename)
Draw a polygon on the varFDTD simulation CAD.
- Parameters
point_list (List of Tuple) – Points for the polygon.
z_start (Float) – The start point for the structure in z axis (unit: μm).
z_end (Float) – The end point for the structure in z axis (unit: μm).
material (str or float) – Material setting for the structure in Lumerical MODE (SiO2 = “SiO2 (Glass) - Palik”, SiO2 = “SiO2 (Glass) - Palik”, default: SiO2). When it is a float, the material in MODE will be <Object defined dielectric>, and index will be defined.
rename (String) – New name of the structure in Lumerical.
- put_round(center_point, inner_radius, outer_radius, start_radian, end_radian, z_start, z_end, material, rename)
Draw a round on the varFDTD simulation CAD.
- Parameters
center_point (Point) – Points for the center of the round.
inner_radius (float) – Inner radius of the round.
outer_radius (float) – Outer radius of the round.
start_radian (float) – The start radian of the round (unit: radian).
end_radian (float) – The end radian of the round (unit: radian).
z_start (Float) – The start point for the structure in z axis (unit: μm).
z_end (Float) – The end point for the structure in z axis (unit: μm).
material (str or float) – Material setting for the structure in Lumerical MODE (SiO2 = “SiO2 (Glass) - Palik”, SiO2 = “SiO2 (Glass) - Palik”, default: SiO2). When it is a float, the material in MODE will be <Object defined dielectric>, and index will be defined.
rename (String) – New name of the structure in Lumerical.
- eval(command)
Execute the command on the MODE.
- Parameters
command (str) – Command that can be evaluated in MODE.
- add_structure_circle(center_point, radius, material='SiO2 (Glass) - Palik', z_start=- 0.11, z_end=0.11, rename='circle')
Draw the a circle on the simulation CAD.
- Parameters
center_point (Point) – Center point of the circle.
radius (float) – Radius of the circle (unit: μm).
material (str or float) – Material setting for the structure in Lumerical MODE (SiO2 = “SiO2 (Glass) - Palik”, SiO2 = “SiO2 (Glass) - Palik”, default: SiO2). When it is a float, the material in MODE will be <Object defined dielectric>, and index will be defined.
z_start (Float) – The start point for the structure in z axis (unit: μm, default: -0.11).
z_end (Float) – The end point for the structure in z axis (unit: μm, default: 0.11).
rename (String) – New name of the structure in Lumerical MODE (default: “circle”).
- add_structure_rectangle(center_point, x_length, y_length, material='SiO2 (Glass) - Palik', z_start=- 0.11, z_end=0.11, rename='rect')
Draw the a rectangle on the simulation CAD.
- Parameters
center_point (Point) – Center point of the rectangle.
x_length (float) – Length in the x axis (unit: μm).
y_length (float) – Length in the y axis (unit: μm).
material (str or float) – Material setting for the structure in Lumerical MODE (SiO2 = “SiO2 (Glass) - Palik”, SiO2 = “SiO2 (Glass) - Palik”, default: SiO2). When it is a float, the material in MODE will be <Object defined dielectric>, and index will be defined.
z_start (Float) – The start point for the structure in z axis (unit: μm, default: -0.11).
z_end (Float) – The end point for the structure in z axis (unit: μm, default: 0.11).
rename (String) – New name of the structure in Lumerical MODE (default: “rect”).
- add_mode_source(position, width=2, source_name='source', mode_number=1, wavelength_start=1.54, wavelength_end=1.57, direction=1)
Add eigen mode source in Lumerical MODE.
- Parameters
position (Point or tuple) – Center point of the source.
width (Float) – Width of the source (in y axis, unit: μm, default: 2).
height (Float) – Height of the source (in z axis, unit: μm, default: 0.8).
source_name (String) – Name of the source in Lumerical MODE (default: “source”).
mode_number (Int) – The selected mode index (start from 1).
wavelength_start (Float) – The start wavelength of the source (unit: μm, default: 1.540).
wavelength_end (Float) – The end wavelength of the source (unit: μm, default: 1.570).
direction (Int) – The light propagation direction 1: the positive direction of x-axis, 0: the negative direction of x-axis(FORWARD:1, BACKWARD:0 , default: FORWARD).
- switch_to_layout()
Switch the Lumerical MODE simulation to “Layout” mode.
- add_mode_expansion(position, mode_list, width=2, height=0.8, expansion_name='expansion', points=251)
Add mode expansion monitor in Lumerical MODE.
- Parameters
position (Point or tuple) – Center point of the monitor.
mode_list (List) – List that contains the index of desired mode (start from 1).
width (Float) – Width of the monitor (in y axis, unit: μm, default: 2).
height (Float) – Height of the monitor (in z axis, unit: μm, default: 0.8).
expansion_name (String) – Name of the mode expansion monitor in Lumerical MODE (default: “expansion”).
points (Int) – The number of the frequency points that will be monitored (default: 251).
Notes
This function will automatically add a power monitor at the same position with same shape.
- static str_list(list)
Convert a list to String expression.
- Parameters
list (List) – The List for conversion.
- Returns
out – The String expression of the input List.
- Return type
String
- set_disable(item_name)
Set an item of the simulation to “disable” state.
- Parameters
item_name (String) – Name of the item.
Notes
This function should be called in “Layout” mode for the Lumerical MODE simulaiton.
- set_enable(item_name)
Set an item of the simulation to “enable” state.
- Parameters
item_name (String) – Name of the item.
Notes
This function should be called in “Layout” mode for the Lumerical MODE simulaiton.
- remove(item_name)
Remove an item of the simulation.
- Parameters
item_name (String) – Name of the item.
Notes
This function should be called in “Layout” mode for the Lumerical MODE simulaiton.
- get_transmission(monitor_name, datafile=None)
Get data from power monitor after running the simulation.
- Parameters
monitor_name (String) – Name of the power monitor.
datafile (String) – The name of the file for saving the data, None means no saving (default: None).
- Returns
out – Spectrum [wavelength,transmission], size: (2,frequency points).
- Return type
Array
- get_mode_transmission(expansion_name, direction=1, datafile=None)
Get data from mode expansion monitor after running the simulation.
- Parameters
expansion_name (String) – Name of the mode expansion monitor.
datafile (String) – The name of the file for saving the data, None means no saving (default: None).
- Returns
out – Spectrum [[wavelength,transmission],…], size: (number of modes,2,frequency points).
- Return type
Array
- get_mode_phase(expansion_name, direction=1, datafile=None)
Get data and calculate phase vs wavelength from mode expansion monitor after running the simulation.
- Parameters
expansion_name (String) – Name of the mode expansion monitor.
direction (Int) – The light propagation direction 1: the positive direction of x-axis, 0: the negative direction of x-axis(FORWARD:1, BACKWARD:0 , default: FORWARD).
datafile (String) – The name of the file for saving the data, None means no saving (default: None).
- Returns
out – Phase, size: (1,frequency points).
- Return type
Array
- get_mode_coefficient(expansion_name, direction=1, datafile=None)
Get data and calculate coefficient from mode expansion monitor after running the simulation.
- Parameters
expansion_name (String) – Name of the mode expansion monitor.
direction (Int) – The light propagation direction 1: the positive direction of x-axis, 0: the negative direction of x-axis(FORWARD:1, BACKWARD:0 , default: FORWARD).
datafile (String) – The name of the file for saving the data, None means no saving (default: None).
- Returns
out – Spectrum, size: (1,frequency points).
- Return type
Array
- get_source_power(source_name='source', datafile=None)
Get source power spectrum from source.
- Parameters
source_name (String) – Name of the source.
datafile (String) – The name of the file for saving the data, None means no saving (default: None).
- Returns
out – Spectrum, size: (1,frequency points).
- Return type
Array
Notes
This function should be called after setting the frequency points in any frequency domain monitor.
- get_wavelength()
Get wavelength points from Lumerical simulation.
- Returns
out – Wavelength points, size: (1,frequency points).
- Return type
Array
Notes
This function should be called after setting the wavelength range in source and the frequency points in any frequency domain monitor.
- get_frequency()
Get frequency points from Lumerical simulation.
- Returns
out – Frequency points, size: (1,frequency points).
- Return type
Array
Notes
This function should be called after setting the wavelength range in source and the frequency points in any frequency domain monitor.
- get_omega()
Get omega points from Lumerical simulation (omega = 2*pi*frequency).
- Returns
out – Omega points, size: (1,frequency points).
- Return type
Array
Notes
This function should be called after setting the wavelength range in source and the frequency points in any frequency domain monitor.
- get_epsilon_distribution(index_monitor_name='index', data_name='index_data', datafile=None)
Get epsilon distribution from index monitor.
- Parameters
index_monitor_name (String) – Name of the index monitor (default: “index”).
data_name (String) – Name of the data in Lumeircal MODE (default: “index_data”).
datafile (String) – The name of the file for saving the data, None means no saving (default: None).
- Returns
out – Spectrum, size: (x mesh, y mesh, z mesh, 1).
- Return type
Array
- get_E_distribution(field_monitor_name='field', data_name='field_data', datafile=None, if_get_spatial=0)
Get electric field distribution from field monitor.
- Parameters
field_monitor_name (String) – Name of the field monitor (default: “field”).
data_name (String) – Name of the data in Lumeircal MODE (default: “field_data”).
datafile (String) – The name of the file for saving the data, None means no saving (default: None).
if_get_spatial (Bool) – Whether get spatial information as return (default: 0).
- Returns
out –
- if if_get_spatial == 0: field
size: (x mesh, y mesh, z mesh, frequency points, 3).
- if if_get_spatial == 1: field, x mesh, y mesh, z mesh
size: (x mesh, y mesh, z mesh, frequency points, 3), (x mesh,), (y mesh,), (z mesh,)
- Return type
Array
- add_index_region(bottom_left_corner_point, top_right_corner_point, height=1, z_min=None, z_max=None, index_monitor_name='index', dimension=2)
Add index monitor (x-y plane) in Lumerical MODE.
- Parameters
bottom_left_corner_point (Point) – Lower left corner of the region.
top_right_corner_point (Point) – Upper right corner of the region.
height (Float) – Height of the monitor (in z axis, unit: μm, default: 1).
index_monitor_name (String) – Name of the monitor in Lumerical MODE (default: “index”).
dimension (Int) – Dimension of monitor (default: 2).
- add_field_region(bottom_left_corner_point, top_right_corner_point, height=1, z_min=None, z_max=None, field_monitor_name='field', dimension=2)
Add field monitor (x-y plane) in Lumerical MODE (DFT Frequency monitor).
- Parameters
bottom_left_corner_point (Point) – Lower left corner of the region.
top_right_corner_point (Point) – Upper right corner of the region.
height (Float) – Height of the monitor (in z axis, unit: μm, default: 1).
field_monitor_name (String) – Name of the monitor in Lumerical MODE (default: “field”).
dimension (Int) – Dimension of monitor (default: 2).
Inverse Design Algorithms
BinaryBatAlgorithm
- class splayout.BinaryBatAlgorithm(noS, loS, cost_function, max_iteration=500, callback_function=None, loudness=0.25, pulse_rate=0.1)
Bases:
objectBinary Bat Algorithm.
- Parameters
noS (Int) – Number of solutions.
loS (Int) – Length of a single solution.
cost_function (func) – Cost function for evaluating a single solution, input: Array, size (loS,), output: Float, lower means better .
max_iteration (Int) – Maximum of iterations (default: 500).
callback_function (func) – Self-defined callback function that will be called after every iteration (default: None).
loudness (Float) – Loudness in Binary Bat Algorithm (default: 0.25).
pulse_rate (Float) – Pulse rate in Binary Bat Algorithm (default: 0.1).
- engine_init()
Initialize the Binary Bat Algorithm, evaluate the first iteration.
- run()
Run the engine.
- get_iteration_number()
Get the temporal iteration number.
- Returns
out – Iteration number.
- Return type
Int
- get_min_fitness()
Get the temporal minimum of fitness.
- Returns
out – Minimum of fitness.
- Return type
Float
- get_best_solution()
Get the temporal best solution.
- Returns
out – Best solution.
- Return type
Array
- get_total_solutions()
Get the temporal total solutions.
- Returns
out – All the solutions, size: (noS,loS).
- Return type
Array
- get_total_fitness()
Get the temporal fitness for all the solutions.
- Returns
out – Fitness, size: (noS,1).
- Return type
Array
DirectBianrySearchAlgorithm
- class splayout.DirectBianrySearchAlgorithm(loS, cost_function, max_iteration=4, callback_function=None, initial_solution=None)
Bases:
objectDirect Binary Search Algorithm.
- Parameters
loS (Int) – Length of a single solution.
cost_function (func) – Cost function for evaluating a single solution, input: Array, size (loS,), output: Float, lower means better.
max_iteration (Int) – Maximum of iterations (default: 500).
callback_function (func) – Self-defined callback function that will be called after every solution evaluated (default: None).
initial_solution (Array) – Initialize the solution, size: (noS,) (default: None, means random).
- run()
Run the DBS engine.
- get_remained_size()
Get the size of undisturbed positions.
- Returns
out – Size of undisturbed positions.
- Return type
Int
- get_remained()
Get the undisturbed positions.
- Returns
out – Undisturbed positions.
- Return type
Array
- get_iteration_number()
Get the temporal iteration number.
- Returns
out – Iteration number.
- Return type
Int
- get_fitness()
Get the temporal fitness.
- Returns
out – Fitness.
- Return type
Float
- get_best_solution()
Get the temporal best solution.
- Returns
out – Best solution.
- Return type
Array
Inverse Design Blocks for Adjoint Method
ShapeOptRegion2D
- class splayout.ShapeOptRegion2D(bottom_left_corner_point, top_right_corner_point, fdtd_engine, transfer_function, x_mesh=0.02, y_mesh=0.02, z_mesh=0.0071, z_start=- 0.11, z_end=0.11, rename='ShapeOptRegion')
Bases:
object2D Optimization region for shape derivative method.
- Parameters
bottom_left_corner_point (Point) – Lower left corner of the region.
top_right_corner_point (Point) – Upper right corner of the region.
fdtd_engine (FDTDSimulation) – The FDTDSimulation object.
transfer_function (func) – function for update geometry in CAD according to parameters.
x_mesh (Float) – The grid unit in x-axis (unit: μm, default: 0.02).
y_mesh (Float) – The grid unit in y-axis (unit: μm, default: 0.02).
z_mesh (Float) – The grid unit in z-axis (unit: μm, default: 0.0071).
z_start (Float) – The start point for the structure in z axis (unit: μm, default: -0.11).
z_end (Float) – The end point for the structure in z axis (unit: μm, default: 0.11).
rename (String) – New name for the components in Lumerical.
- update(params)
Update Shape Derivative Optimization Region according to the new params.
- Parameters
params (numpy.array) – A one-dimensional array in [0,1].
- get_E_distribution(if_get_spatial=0)
Get electric field distribution from the region.
- Parameters
if_get_spatial (Bool) – Whether get spatial information as return (default: 0).
- Returns
out –
- if if_get_spatial == 0: field
size: (x mesh, y mesh, 1, frequency points, 3).
- if if_get_spatial == 1: field, x mesh, y mesh, z mesh
size: (x mesh, y mesh, 1, frequency points, 3), (x mesh,), (y mesh,), (1,)
- Return type
Array
- get_E_distribution_in_CAD(data_name)
Get electric field distribution from the region and save the data in CAD.
- Parameters
data_name (String) – Name of the data in Lumeircal FDTD (default: “field_data”).
- Returns
data_name – The name of the data in Lumerical.
- Return type
String
- get_epsilon_distribution_in_CAD(data_name)
Get epsilon distribution from the region and save the data in CAD.
- Parameters
data_name (String) – Name of the data in Lumeircal FDTD (default: “index_data”).
- Returns
data_name – The name of the data in Lumerical.
- Return type
String
- get_epsilon_distribution()
Get epsilon distribution from the region.
- Returns
out – Spectrum, size: (x mesh, y mesh, z mesh, 1).
- Return type
Array
- plot_epsilon_figure(filename=None)
Plot epsilon distribution as a heatmap and save it as a file if filename is specified.
- Parameters
datafile (String) – The name of the file for saving the data, None means no saving (default: None).
- plot_field_figure(filename=None)
Plot electric distribution as a heatmap and save it as a file if filename is specified.
- Parameters
datafile (String) – The name of the file for saving the data, None means no saving (default: None).
ShapeOptRegion3D
- class splayout.ShapeOptRegion3D(bottom_left_corner_point, top_right_corner_point, fdtd_engine, transfer_function, x_mesh=0.02, y_mesh=0.02, z_mesh=0.02, z_start=- 0.11, z_end=0.11, rename='ShapeOptRegion')
Bases:
object3D Optimization region for shape derivative method.
- Parameters
bottom_left_corner_point (Point) – Lower left corner of the region.
top_right_corner_point (Point) – Upper right corner of the region.
fdtd_engine (FDTDSimulation) – The FDTDSimulation object.
transfer_function (func) – function for update geometry in CAD according to parameters.
x_mesh (Float) – The grid unit in x-axis (unit: μm, default: 0.02).
y_mesh (Float) – The grid unit in y-axis (unit: μm, default: 0.02).
z_mesh (Float) – The grid unit in z-axis (unit: μm, default: 0.02).
z_start (Float) – The start point for the structure in z axis (unit: μm, default: -0.11).
z_end (Float) – The end point for the structure in z axis (unit: μm, default: 0.11).
rename (String) – New name for the components in Lumerical.
- update(params)
Update Shape Derivative Optimization Region according to the new params.
- Parameters
params (numpy.array) – A one-dimensional array in [0,1].
- get_E_distribution(if_get_spatial=0)
Get electric field distribution from the region.
- Parameters
if_get_spatial (Bool) – Whether get spatial information as return (default: 0).
- Returns
out –
- if if_get_spatial == 0: field
size: (x mesh, y mesh, z mesh, frequency points, 3).
- if if_get_spatial == 1: field, x mesh, y mesh, z mesh
size: (x mesh, y mesh, z mesh, frequency points, 3), (x mesh,), (y mesh,), (z mesh,)
- Return type
Array
- get_E_distribution_in_CAD(data_name)
Get electric field distribution from the region and save the data in CAD.
- Parameters
data_name (String) – Name of the data in Lumeircal FDTD (default: “field_data”).
- Returns
data_name – The name of the data in Lumerical.
- Return type
String
- get_epsilon_distribution_in_CAD(data_name)
Get epsilon distribution from the region and save the data in CAD.
- Parameters
data_name (String) – Name of the data in Lumeircal FDTD (default: “index_data”).
- Returns
data_name – The name of the data in Lumerical.
- Return type
String
- get_epsilon_distribution()
Get epsilon distribution from the region.
- Returns
out – Spectrum, size: (x mesh, y mesh, z mesh, 1).
- Return type
Array
- plot_epsilon_figure(filename=None)
Plot epsilon distribution as a heatmap and save it as a file if filename is specified.
- Parameters
datafile (String) – The name of the file for saving the data, None means no saving (default: None).
- plot_field_figure(filename=None)
Plot electric distribution as a heatmap and save it as a file if filename is specified.
- Parameters
datafile (String) – The name of the file for saving the data, None means no saving (default: None).
TopologyOptRegion2D
- class splayout.TopologyOptRegion2D(bottom_left_corner_point, top_right_corner_point, fdtd_engine, x_mesh=0.02, y_mesh=0.02, z_mesh=0.0071, lower_index=1.444, higher_index=3.478, z_start=- 0.11, z_end=0.11, rename='ToOptRegion', filter_R=0.5, eta=0.5, beta=1)
Bases:
object2D Optimization region for topology optimization method.
- Parameters
bottom_left_corner_point (Point) – Lower left corner of the region.
top_right_corner_point (Point) – Upper right corner of the region.
fdtd_engine (FDTDSimulation) – The FDTDSimulation object.
x_mesh (Float) – The grid unit in x-axis (unit: μm, default: 0.02).
y_mesh (Float) – The grid unit in y-axis (unit: μm, default: 0.02).
z_mesh (Float) – The grid unit in z-axis (unit: μm, default: 0.0071).
lower_index (Float) – Lower boundary for refractive index (default: 1.444).
higher_index (Float) – Higher boundary for refractive index (default: 3.478).
z_start (Float) – The start point for the structure in z axis (unit: μm, default: -0.11).
z_end (Float) – The end point for the structure in z axis (unit: μm, default: 0.11).
rename (String) – New name for the components in Lumerical.
filter_R (Float) – The radius of smoothing filter (unit: μm, default: 0.5)
eta (Float) – Eta for the smoothing filter (default: 0.5)
beta (Float) – Beta fort hte smoothing filter (default: 1)
- get_x_size()
Return x-axis size of the region.
- Returns
self.x_size – x-axis size.
- Return type
Int
- get_y_size()
Return y-axis size of the region.
- Returns
self.y_size – y-axis size.
- Return type
Int
- update(params_matrix)
Update Toopology Optimization Region according to the new matrix. (Reference: lumopt. https://github.com/chriskeraly/lumopt)
- Parameters
params_matrix (numpy.array) – A two-dimensional array in [0,1].
- get_E_distribution(if_get_spatial=0)
Get electric field distribution from the region.
- Parameters
if_get_spatial (Bool) – Whether get spatial information as return (default: 0).
- Returns
out –
- if if_get_spatial == 0: field
size: (x mesh, y mesh, 1, frequency points, 3).
- if if_get_spatial == 1: field, x mesh, y mesh, z mesh
size: (x mesh, y mesh, 1, frequency points, 3), (x mesh,), (y mesh,), (1,)
- Return type
Array
- get_epsilon_distribution()
Get epsilon distribution from the region.
- Returns
out – Spectrum, size: (x mesh, y mesh, z mesh, 1).
- Return type
Array
- plot_epsilon_figure(filename=None)
Plot epsilon distribution as a heatmap and save it as a file if filename is specified.
- Parameters
datafile (String) – The name of the file for saving the data, None means no saving (default: None).
- plot_field_figure(filename=None)
Plot electric distribution as a heatmap and save it as a file if filename is specified.
- Parameters
datafile (String) – The name of the file for saving the data, None means no saving (default: None).
TopologyOptRegion3D
- class splayout.TopologyOptRegion3D(bottom_left_corner_point, top_right_corner_point, fdtd_engine, x_mesh=0.02, y_mesh=0.02, z_mesh=0.02, lower_index=1.444, higher_index=3.478, z_start=- 0.11, z_end=0.11, rename='ToOptRegion', filter_R=0.5, eta=0.5, beta=1)
Bases:
objectLayered 2D Optimization region for topology optimization method.
- Parameters
bottom_left_corner_point (Point) – Lower left corner of the region.
top_right_corner_point (Point) – Upper right corner of the region.
fdtd_engine (FDTDSimulation) – The FDTDSimulation object.
x_mesh (Float) – The grid unit in x-axis (unit: μm, default: 0.02).
y_mesh (Float) – The grid unit in y-axis (unit: μm, default: 0.02).
z_mesh (Float) – The grid unit in z-axis (unit: μm, default: 0.0071).
lower_index (Float) – Lower boundary for refractive index (default: 1.444).
higher_index (Float) – Higher boundary for refractive index (default: 3.478).
z_start (Float) – The start point for the structure in z axis (unit: μm, default: -0.11).
z_end (Float) – The end point for the structure in z axis (unit: μm, default: 0.11).
rename (String) – New name for the components in Lumerical.
filter_R (Float) – The radius of smoothing filter (unit: μm, default: 0.5)
eta (Float) – Eta for the smoothing filter (default: 0.5)
beta (Float) – Beta fort hte smoothing filter (default: 1)
- get_x_size()
Return x-axis size of the region.
- Returns
self.x_size – x-axis size.
- Return type
Int
- get_y_size()
Return y-axis size of the region.
- Returns
self.y_size – y-axis size.
- Return type
Int
- update(params_matrix)
Update Toopology Optimization Region according to the new matrix. For the first time it is called, the pixels will be created in the FDTD simulation CAD. In the following update process, it will enable/disable correspoinding pixels. (Reference: lumopt. https://github.com/chriskeraly/lumopt)
- Parameters
params_matrix (numpy.array) – A two-dimensional array in [0,1].
- get_E_distribution(if_get_spatial=0)
Get electric field distribution from the region.
- Parameters
if_get_spatial (Bool) – Whether get spatial information as return (default: 0).
- Returns
out –
- if if_get_spatial == 0: field
size: (x mesh, y mesh, z mesh, frequency points, 3).
- if if_get_spatial == 1: field, x mesh, y mesh, z mesh
size: (x mesh, y mesh, z mesh, frequency points, 3), (x mesh,), (y mesh,), (z mesh,)
- Return type
Array
- get_epsilon_distribution()
Get epsilon distribution from the region.
- Returns
out – Spectrum, size: (x mesh, y mesh, z mesh, 1).
- Return type
Array
- plot_epsilon_figure(filename=None)
Plot epsilon distribution as a heatmap and save it as a file if filename is specified.
- Parameters
datafile (String) – The name of the file for saving the data, None means no saving (default: None).
- plot_field_figure(filename=None)
Plot electric distribution as a heatmap and save it as a file if filename is specified.
- Parameters
datafile (String) – The name of the file for saving the data, None means no saving (default: None).
AdjointForShapeOpt
- class splayout.AdjointForShapeOpt(fdtd_engine, fom_monitor_name, target_fom, design_region, forward_source_name, backward_source_name, dx=0.001, sim_name='Adjoint', record_forward_field=1)
Bases:
objectAdjoint Method for Shape Derivative Optimization.
- Parameters
fdtd_engine (FDTDSimulation) – The FDTDSimulation object.
fom_monitor_name (String) – Monitor name for deriving FoM.
target_fom (Array) – Target FoM at different frequencies.
design_region (ShapeOptRegion2D or ShapeOptRegion3D) – Design region for shape derivative method.
forward_source_name (String) – Source name for Forward simulation.
backward_source_name (String) – Source name for Adjoint simulation.
dx (Float) – Micro element unit for gradient calculation(unit: μm, default: 0.001).
sim_name (String) – New name for the components in Lumerical(default: “Adjoint”).
record_forward_field (Bool or Int) – Whether to record field in the forward simulation.
- static cal_epsilon_diff_in_CAD(fdtd_engine, design_region, params, origin_epsilon_name, data_name, dx)
Calculate epsilon difference between new structure and original structure in Lumerical CAD. (From: lumopt. https://github.com/chriskeraly/lumopt)
- Parameters
fdtd_engine (FDTDSimulation) – The FDTDSimulation object.
design_region (ShapeOptRegion2D or ShapeOptRegion3D) – Design region for shape derivative method.
params (Array) – Parameters for the structure.
origin_epsilon_name (String) – Name of the data in Lumerical FDTD that records the original epsilon distribution.
data_name (String) – New name for the components in Lumerical(default: “Adjoint”).
dx (Float) – Micro element unit for gradient calculation(unit: μm).
- Returns
data_name – The name of the data in Lumerical.
- Return type
String
- static cal_partial_fom_in_CAD(fdtd_engine, forward_field_name, adjoint_field_name, scaling_factor_name, epsilon_diff_name)
Calculate Partial FoM in Lumerical CAD. (From: lumopt. https://github.com/chriskeraly/lumopt)
- Parameters
fdtd_engine (FDTDSimulation) – The FDTDSimulation object.
forward_field_name (String) – Design region for shape derivative method.
adjoint_field_name (String) – Parameters for the structure.
scaling_factor_name (String) – Name of the data in Lumerical FDTD that records the original epsilon distribution.
epsilon_diff_name (String) – New name for the components in Lumerical(default: “Adjoint”).
- Returns
partial_fom – Shape: (frequencies, number of parameters).
- Return type
Array
- call_fom(params)
Calculate FoM(Figure of Merit) and return. (Reference: lumopt. https://github.com/chriskeraly/lumopt)
- Parameters
params (Array) – Parameters for the structure.
- Returns
- self.fom – Figure of Merit (Lower, better).
- Return type
Float
- call_grad(params)
Calculate Gradient(Figure of Merit) and return. (Reference: lumopt. https://github.com/chriskeraly/lumopt)
- Parameters
params (Array) – Parameters for the structure.
- Returns
- T_fwd_partial_derivs / 1e6 – Gradients.
- Return type
Array
AdjointForTO
- class splayout.AdjointForTO(fdtd_engine, fom_monitor_name, target_fom, design_region, forward_source_name, backward_source_name, sim_name='Adjoint', y_antisymmetric=0)
Bases:
objectAdjoint Method for Topology Optimization.
- Parameters
fdtd_engine (FDTDSimulation) – The FDTDSimulation object.
fom_monitor_name (String or List of String) – Monitor names for deriving FoM.
target_fom (Array or List of Array) – Target FoMs at different frequencies.
design_region (TopologyOptRegion2D or TopologyOptRegion3D) – Design region for shape derivative method.
forward_source_name (String or List of String) – Source names for Forward simulation.
backward_source_name (String or List of String) – Source names for Adjoint simulation.
y_antisymmetric (Bool or Int) – Whether set y-axis antisymmetric in the simulation(default: 0).
- call_fom(params)
Calculate FoM(Figure of Merit) and return. (Reference: lumopt. https://github.com/chriskeraly/lumopt)
- Parameters
params (Array) – Parameters for the structure.
- Returns
- self.fom – Figure of Merit (Lower, better).
- Return type
Float
- call_grad(params)
Calculate Gradient(Figure of Merit) and return. (Reference: lumopt. https://github.com/chriskeraly/lumopt)
- Parameters
params (Array) – Parameters for the structure.
- Returns
- T_fwd_partial_derivs / 1e6 – Gradients.
- Return type
Array