API Reference
Basic Class
Point
- class splayout.Point(x, y)
Bases:
object
Point 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:
object
Cell 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
- class splayout.Layer(layer, datatype=0)
Bases:
object
Layer Definition in SPLayout. The object of Layer can be used to “**.draw(,layer)” functions of the components.
- Parameters:
layer (int) – The layer index.
datatype (int) – The datatype index.
- cut(another_layer, output_layer=None)
Cut the components in this layer with the components from another_layer, which means generate components ‘in this layer but not in another_layer’. If output_layer is not specified the result will replace the components in this layer.
- Parameters:
Notes
The sub-cells will be taken into calculation but will not be revised.
- add(another_layer, output_layer=None)
Add the components in this layer with the components from another_layer, which means generate components ‘in this layer or in another_layer’. If output_layer is not specified the result will replace the components in this layer.
- Parameters:
Notes
The sub-cells will be taken into calculation but will not be revised.
- common(another_layer, output_layer=None)
Find the common part of the components in this layer and the components from another_layer, which means generate components ‘in this layer and in another_layer’. If output_layer is not specified the result will replace the components in this layer.
- Parameters:
Notes
The sub-cells will be taken into calculation but will not be revised.
- dilation(distance=2, output_layer=None)
Dilate the components in this layer. If output_layer is not specified the result will replace the components in this layer.
- Parameters:
distance (Int or Float) – The distance for dilation.
output_layer (Layer) – The layer for output (default: None).
Notes
The sub-cells will be taken into calculation but will not be revised.
- inversion(distance=2, output_layer=None)
Make inversion for the components in this layer. If output_layer is not specified the result will replace the components in this layer.
- Parameters:
distance (Int or Float) – The distance for inversion.
output_layer (Layer) – The layer for output (default: None).
Notes
The sub-cells will be taken into calculation but will not be revised.s
Components
Waveguide
- class splayout.Waveguide(start_point, end_point, width, z_start=None, z_end=None, material=None, rename=None)
Bases:
object
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.
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:
object
Arbitrary 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:
object
Bend 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:
SlowlyVaryingTaper
- class splayout.SlowlyVaryingTaper(start_point, start_width, end_width, direction=0, z_start=None, z_end=None, material=None, rename=None, varying_angle=1.8)
Bases:
object
Slowly Varying (Default 1.8°) Taper Definition in SPLayout.
- Parameters:
start_point (Point) – Start point of the taper.
start_width (float) – Start width of the taper (μm).
end_width (float) – End width of the taper (μm).
direction (FROM_LEFT_TO_RIGHT or FROM_RIGHT_TO_LEFT or FROM_LOWER_TO_UPPER or FROM_UPPER_TO_LOWER) – The direction of the taper.
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 (String 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.
varying_angle (Float) – Varying angle of the taper.
- 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:
object
Bend 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.
- get_start_point()
Derive the start point of the bend.
- Returns:
out – Start point.
- Return type:
SBend
- class splayout.SBend(start_point, end_point, width, length=None, radius=5, z_start=None, z_end=None, material=None, rename=None)
Bases:
object
S-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:
object
S-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:
object
Clockwise 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:
object
Anticlockwise 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:
object
Polygon 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:
object
Double 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:
SimpleAsymmetricDirectionalCoupler
- class splayout.SimpleAsymmetricDirectionalCoupler(start_point, direction=0, json_file=None, coupling_length=None, bus_width=None, bus_coupler_gap=None, coupler_width=None, sbend_length=None, z_start=None, z_end=None, material=None, rename=None, opposite=0)
Bases:
object
Simple Asymmetric Directional Coupler in SPLayout.
- Parameters:
start_point (Point) – Start point of the coupler.
direction (FROM_LEFT_TO_RIGHT or FROM_RIGHT_TO_LEFT or FROM_LOWER_TO_UPPER or FROM_UPPER_TO_LOWER) – The direction of the coupler.
json_file (String) – Path to the json file that stocks the ADC information.
coupling_length (float) – Coupling length of the coupler (μm, default: None, only usefule when json_file is not defined).
bus_width (Float) – Width of the bus waveguide (μm, default: None, only usefule when json_file is not defined).
bus_coupler_gap (Float) – Gap between the bus waveguide and the coupler waveguide (μm, default: None, only usefule when json_file is not defined).
coupler_width (Float) – Width of the coupler waveguide (μm, default: None, only usefule when json_file is not defined).
sbend_length (Float) – Length of the sbends at the ports of the coupler waveguide (μm, default: None, only usefule when json_file is not defined).
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 (String 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 (default: None, only useful when draw on CAD).
opposite (Bool or Int) – Whether the coupler is mirrored (default: 0).
- 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 coupler.
- Returns:
out – Start point.
- Return type:
- get_through_point()
Derive the through point of the coupler.
- Returns:
out – End point.
- Return type:
- get_drop_point()
Derive the drop point of the coupler.
- Returns:
out – End point.
- Return type:
- get_input_width()
Derive the width of input waveguide.
- Returns:
out – Width.
- Return type:
float
- get_output_width()
Derive the width of the output waveguide.
- Returns:
out – Width.
- Return type:
float
- get_drop_width()
Derive the width of the drop port.
- Returns:
out – Width.
- Return type:
float
AddDropMicroring
- class splayout.AddDropMicroring(start_point, radius, gap, wg_width, coupling_length, relative_position=0)
Bases:
object
Add-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:
object
Add-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:
object
Text 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:
object
Filled 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:
object
Filled 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 Customizing Components
MAKE_AEMD_GRATING
- splayout.MAKE_AEMD_GRATING(port_width=0.45, waveguide_layer=<splayout.utils.utils.Layer object>, etch_layer=<splayout.utils.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.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:
object
FDTD 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, z_min=None, z_max=None, monitor_name='powermonitor', points=1001, normal_direction=1)
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).
z_min (Float) – The lower boundary on z-axis (unit: μm, default: None).
z_max (Float) – The upper boundary on z-axis (unit: μm, default: None).
monitor_name (String) – Name of the monitor in Lumerical FDTD (default: “powermonitor”).
points (Int) – The number of the frequency points that will be monitored (default: 1001).
normal_direction (HORIZONAL or VERTICAL) – The direction of the monitor. HORIZONAL: x-normal, VERTICAL: y-normal.
Notes
If z_min and z_max are specified, the height property will be invalid.
- add_mode_expansion(position, mode_list, width=2, height=0.8, z_min=None, z_max=None, expansion_name='expansion', points=251, update_mode=0, normal_direction=1, auto_update=1)
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).
z_min (Float) – The lower boundary on z-axis (unit: μm, default: None).
z_max (Float) – The upper boundary on z-axis (unit: μm, default: None).
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).
normal_direction (HORIZONAL or VERTICAL) – The direction of the monitor. HORIZONAL: x-normal, VERTICAL: y-normal.
update_mode – Whether enable auto update in Lumerical.
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. If z_min and z_max are specified, the height property will be invalid.
- 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, z_min=None, z_max=None, source_name='source', mode_number=1, amplitude=1, phase=0, wavelength_start=1.54, wavelength_end=1.57, direction=1, update_mode=0, normal_direction=1)
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).
z_min (Float) – The lower boundary on z-axis (unit: μm, default: None).
z_max (Float) – The upper boundary on z-axis (unit: μm, default: None).
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).
normal_direction (HORIZONAL or VERTICAL) – The direction of the mode source. HORIZONAL: x-normal, VERTICAL: y-normal.
Notes
If use update_mode the monitor should be put after adding fdtd region and mesh region. If z_min and z_max are specified, the height property will be invalid.
- add_imported_source(position, width, height, origin_x=None, origin_y=None, origin_z=None, E=None, H=None, z_min=None, z_max=None, source_name='source', amplitude=1, phase=0, direction=1, normal_direction=1)
Add imported 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).
origin_x (Array) – The origin nodes distribution on x-axis.
origin_y (Array) – The origin nodes distribution on y-axis.
origin_z (Array) – The origin nodes distribution on z-axis.
E (Array) – The imported electric field distribution.
H (Array) – The imported magnetic field distribution.
z_min (Float) – The lower boundary on z-axis (unit: μm, default: None).
z_max (Float) – The upper boundary on z-axis (unit: μm, default: None).
source_name (String) – Name of the source in Lumerical FDTD (default: “source”).
amplitude (Float or Int) – The amplitude of the source.
phase (Float or Int) – The phase of the source.
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).
normal_direction (HORIZONAL or VERTICAL) – The direction of the mode source. HORIZONAL: x-normal, VERTICAL: y-normal.
Notes
If z_min and z_max are specified, the height property will be invalid.
- 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_material=None, background_index=1.444, mesh_order=2, dimension=3, height=1, z_min=None, z_max=None, z_symmetric=0, y_antisymmetric=0, y_periodic=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_min (Float) – The lower boundary on z-axis (unit: μm, default: None).
z_max (Float) – The upper boundary on z-axis (unit: μm, default: None).
z_symmetric (Bool or Int) – Whether set symmetric in z-axis (default: 0).
y_antisymmetric (Bool or Int) – Whether set anti-symmetric in y-axis (default: 0).
y_antisymmetric – Whether set anti-symmetric in y-axis (default: 0).
y_periodic (Bool or Int) – Whether set periodic in y-axis (default: 0).
Notes
If z_min and z_max are specified, the height property will be invalid. If background_material is specified, the background_index will be invalid.
- 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).
z_min (Float) – The lower boundary on z-axis (unit: μm, default: None).
z_max (Float) – The upper boundary on z-axis (unit: μm, default: None).
index_monitor_name (String) – Name of the monitor in Lumerical FDTD (default: “index”).
dimension (Int) – Dimension of monitor (default: 2).
Notes
If z_min and z_max are specified, the height property will be invalid.
- add_index_monitor(position, width=2, height=0.8, z_min=None, z_max=None, monitor_name='index_monitor', normal_direction=1)
Add 2D index monitor in Lumerical FDTD.
- 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).
z_min (Float) – The lower boundary on z-axis (unit: μm, default: None).
z_max (Float) – The upper boundary on z-axis (unit: μm, default: None).
monitor_name (String) – Name of the monitor in Lumerical FDTD (default: “index_monitor”).
normal_direction (HORIZONAL or VERTICAL) – The direction of the monitor. HORIZONAL: x-normal, VERTICAL: y-normal.
Notes
If z_min and z_max are specified, the height property will be invalid.
- 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 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).
z_min (Float) – The lower boundary on z-axis (unit: μm, default: None).
z_max (Float) – The upper boundary on z-axis (unit: μm, default: None).
field_monitor_name (String) – Name of the monitor in Lumerical FDTD (default: “field”).
dimension (Int) – Dimension of monitor (default: 2).
Notes
If z_min and z_max are specified, the height property will be invalid.
- add_field_monitor(position, width=2, height=0.8, z_min=None, z_max=None, monitor_name='field_monitor', points=1001, normal_direction=1)
Add 2D field 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).
z_min (Float) – The lower boundary on z-axis (unit: μm, default: None).
z_max (Float) – The upper boundary on z-axis (unit: μm, default: None).
monitor_name (String) – Name of the monitor in Lumerical FDTD (default: “powermonitor”).
points (Int) – The number of the frequency points that will be monitored (default: 1001).
normal_direction (HORIZONAL or VERTICAL) – The direction of the monitor. HORIZONAL: x-normal, VERTICAL: y-normal.
Notes
If z_min and z_max are specified, the height property will be invalid.
- 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_eigen_E(expansion_name, mode_number, if_get_spatial=0, datafile=None)
Get electric field distribution of the eigenmode from mode expansion monitor.
- Parameters:
expansion_name (String) – Name of the mode expansion monitor.
mode_number (Int) – The selected mode index (start from 1).
if_get_spatial (Bool) – Whether get spatial information as return (default: 0).
datafile (String) – The name of the file for saving the data, None means no saving (default: None).
out (Array) –
- 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,)
- get_mode_eigen_H(expansion_name, mode_number, if_get_spatial=0, datafile=None)
Get magnetic field distribution of the eigenmode from mode expansion monitor.
- Parameters:
expansion_name (String) – Name of the mode expansion monitor.
mode_number (Int) – The selected mode index (start from 1).
if_get_spatial (Bool) – Whether get spatial information as return (default: 0).
datafile (String) – The name of the file for saving the data, None means no saving (default: None).
out (Array) –
- 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,)
- 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, wavelengths=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_E', 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_E”).
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_H_distribution(field_monitor_name='field', data_name='field_data_H', datafile=None, if_get_spatial=0)
Get magnetic 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_H”).
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.
- reset_wavelengths_of_sources(wavelength_start, wavelength_end)
Reset the wavelength_start and wavelength_end of the sources.
- Parameters:
wavelength_start (Float) – The start wavelength of the source (unit: μm).
wavelength_end (Float) – The end wavelength of the source (unit: μm).
Notes
This function should be called when any source is added.
- reset_wavelength_points_of_monitors(points)
Reset wavelength points of the monitors.
- Parameters:
points (Int) – The number of the frequency points that will be monitored.
Notes
This function should be called when any monitor is added.
- reset_wavelength_points_of_selected_monitor(monitor_name, points)
Reset wavelength points of the monitors.
- Parameters:
monitor_name (String) – Name of the monitor in Lumerical FDTD.
points (Int) – The number of the frequency points that will be monitored.
- 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.
- add_electric_dipole(center_point, source_name='source', z_min=0, amplitude=1, phase=0, wavelength_start=1.54, wavelength_end=1.57)
Add source in Lumerical FDTD.
- Parameters:
center_point (Point or tuple) – Center point of the source.
z_min (Float) – The position on z-axis (unit: μm, default: 0).
source_name (String) – Name of the source in Lumerical FDTD (default: “source”).
amplitude (Float or Int) – The amplitude of the source (default: 1).
phase (Float or Int) – The phase of the source (default: 0).
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).
- add_field_point(center_point, z_min=0, field_monitor_name='field', points=1)
Add a point field monitor in Lumerical FDTD (DFT Frequency monitor).
- Parameters:
center_point (Point or tuple) – Center point of the monitor.
z_min (Float) – The position on z-axis (unit: μm, default: 0).
field_monitor_name (String) – Name of the monitor in Lumerical FDTD (default: “field”).
points (Int) – The number of the frequency points that will be monitored (default: 1).
- get_dipole_power(source_name=None, wavelengths=None, datafile=None)
Get source power spectrum from source.
- Parameters:
source_name (String) – Name of the dipole 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_dipole_base_amplitude(source_name, datafile=None)
Get source power spectrum from source.
- Parameters:
source_name (String) – Name of the dipole source.
datafile (String) – The name of the file for saving the data, None means no saving (default: None).
- Returns:
out – Base amplitude, size: (1,frequency points).
- Return type:
Array
Notes
This function should be called after setting the frequency points in any frequency domain monitor.
- reset_imported_source(origin_x, origin_y, origin_z, E, H=None, source_name='source', amplitude=1, phase=0)
Reset imported source in Lumerical FDTD.
- Parameters:
origin_x (Array) – The origin nodes distribution on x-axis.
origin_y (Array) – The origin nodes distribution on y-axis.
origin_z (Array) – The origin nodes distribution on z-axis.
E (Array) – The imported electric field distribution.
H (Array) – The imported magnetic field distribution.
source_name (String) – Name of the source in Lumerical FDTD (default: “source”).
amplitude (Float or Int) – The amplitude of the source.
phase (Float or Int) – The phase of the source.
MODESimulation
- class splayout.MODESimulation(hide=0, fdtd_path='C:\\Program Files\\Lumerical\\v202\\api\\python\\', load_file=None)
Bases:
object
MODE 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:
object
Binary 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_cost()
Get the temporal minimum of cost.
- Returns:
out – Minimum of cost.
- 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_cost()
Get the temporal cost for all the solutions.
- Returns:
out – cost, size: (noS,1).
- Return type:
Array
DirectBinarySearchAlgorithm
- class splayout.DirectBinarySearchAlgorithm(loS, cost_function, max_iteration=4, callback_function=None, initial_solution=None)
Bases:
object
Direct 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_cost()
Get the temporal cost.
- Returns:
out – cost.
- Return type:
Float
- get_best_solution()
Get the temporal best solution.
- Returns:
out – Best solution.
- Return type:
Array
ParticleSwarmAlgorithm
- class splayout.ParticleSwarmAlgorithm(param_constrains, noS, cost_function, max_iteration=50, callback_function=None, v_max=0.5, inertia_weight=1.0, c_1=2, c_2=2, ratio_personal=0.2, ratio_global=0.8, ratio_random=True)
Bases:
object
Particle Swarm Optimization Algorithm. :param noS: Initial Number of solutions. :type noS: Int :param loS: Length of a single solution. :type loS: Int :param cost_function: Cost function for evaluating a single solution, input: Array, size (loS,), output: Float, lower means better . :type cost_function: func :param max_iteration: Maximum of iterations (default: 500). :type max_iteration: Int :param callback_function: Self-defined callback function that will be called after every iteration (default: None). :type callback_function: func :param v_max: Maximum of particle velocity (default: 6). :type v_max: Float or Int :param inertia_weight: Intertia weight for particles (default: 0.99). :type inertia_weight: Float :param c_1: Learning rate for self-cognition (default: 2). :type c_1: Float or Int :param c_2: Learning rate for social-cognition (default: 2). :type c_2: Float or Int :param ratio_personal: Ratio for self-cognition (default: 0.2). :type ratio_personal: Float :param ratio_global: Ratio for social-cognition (default: 0.8). :type ratio_global: Float
- engine_init()
Initialize the Binary Particle Swarm Optimization, evaluate the first iteration.
- run()
Run the engine.
- get_iteration_number()
Get the temporal iteration number. :returns: out – Iteration number. :rtype: Int
- get_min_cost()
Get the temporal minimum of cost. :returns: out – Minimum of cost. :rtype: Float
- get_best_solution()
Get the temporal best solution. :returns: out – Best solution. :rtype: Array
- get_best_params()
Get the temporal best solution. :returns: out – Best solution. :rtype: Array
- get_total_solutions()
Get the temporal total solutions. :returns: out – All the solutions, size: (noS,loS). :rtype: Array
- get_total_cost()
Get the temporal cost for all the solutions. :returns: out – cost, size: (noS,1). :rtype: Array
BinaryParticleSwarmAlgorithm
- class splayout.BinaryParticleSwarmAlgorithm(noS, loS, cost_function, max_iteration=500, callback_function=None, v_max=6, inertia_weight=0.99, c_1=2, c_2=2, ratio_personal=0.2, ratio_global=0.8)
Bases:
object
Binary Particle Swarm Optimization Algorithm. :param noS: Initial Number of solutions. :type noS: Int :param loS: Length of a single solution. :type loS: Int :param cost_function: Cost function for evaluating a single solution, input: Array, size (loS,), output: Float, lower means better . :type cost_function: func :param max_iteration: Maximum of iterations (default: 500). :type max_iteration: Int :param callback_function: Self-defined callback function that will be called after every iteration (default: None). :type callback_function: func :param v_max: Maximum of particle velocity (default: 6). :type v_max: Float or Int :param inertia_weight: Intertia weight for particles (default: 0.99). :type inertia_weight: Float :param c_1: Learning rate for self-cognition (default: 2). :type c_1: Float or Int :param c_2: Learning rate for social-cognition (default: 2). :type c_2: Float or Int :param ratio_personal: Ratio for self-cognition (default: 0.2). :type ratio_personal: Float :param ratio_global: Ratio for social-cognition (default: 0.8). :type ratio_global: Float
- engine_init()
Initialize the Binary Particle Swarm Optimization, evaluate the first iteration.
- run()
Run the engine.
- get_iteration_number()
Get the temporal iteration number. :returns: out – Iteration number. :rtype: Int
- get_min_cost()
Get the temporal minimum of cost. :returns: out – Minimum of cost. :rtype: Float
- get_best_solution()
Get the temporal best solution. :returns: out – Best solution. :rtype: Array
- get_total_solutions()
Get the temporal total solutions. :returns: out – All the solutions, size: (noS,loS). :rtype: Array
- get_total_cost()
Get the temporal cost for all the solutions. :returns: out – cost, size: (noS,1). :rtype: Array
BinaryGeneticAlgorithm
- class splayout.BinaryGeneticAlgorithm(noS, loS, cost_function, max_iteration=500, callback_function=None, p_crossover=0.9, p_mutation=0.005)
Bases:
object
Binary Genetic Algorithm. :param noS: Initial Number of solutions. :type noS: Int :param loS: Length of a single solution. :type loS: Int :param cost_function: Cost function for evaluating a single solution, input: Array, size (loS,), output: Float, lower means better . :type cost_function: func :param max_iteration: Maximum of iterations (default: 500). :type max_iteration: Int :param callback_function: Self-defined callback function that will be called after every iteration (default: None). :type callback_function: func :param p_crossover: Probability of crossover (default: 0.8). :type p_crossover: Float :param p_mutation: Probability of mutation (default: 0.2). :type p_mutation: Float
- engine_init()
Initialize the Binary Genetic Algorithm, evaluate the first iteration.
- rws()
reference: https://github.com/bigzhao/Binary-Genetic-Algorithm/
- run()
Run the engine.
- get_iteration_number()
Get the temporal iteration number. :returns: out – Iteration number. :rtype: Int
- get_min_cost()
Get the temporal minimum of cost. :returns: out – Minimum of cost. :rtype: Float
- get_best_solution()
Get the temporal best solution. :returns: out – Best solution. :rtype: Array
- get_total_solutions()
Get the temporal total solutions. :returns: out – All the solutions, size: (noS,loS). :rtype: Array
- get_total_cost()
Get the temporal cost for all the solutions. :returns: out – cost, size: (noS,1). :rtype: Array
Pixelated Region for Inverse Design
RectanglePixelsRegion
- class splayout.RectanglePixelsRegion(bottom_left_corner_point, top_right_corner_point, pixel_x_length, pixel_y_length, fdtd_engine, material='SiO2 (Glass) - Palik', z_start=-0.11, z_end=0.11, group_name='p', matrix_mask=None, relaxing_time=0)
Bases:
object
Rectangle pixels region for FDTD simulation. It will create a region with etched blocks that can be updated by a two-dimensional matrix.
- Parameters:
bottom_left_corner_point (Point) – Lower left corner of the region.
top_right_corner_point (Point) – Upper right corner of the region.
pixel_x_length (float) – Length of the pixel(etched block) in axis-x.
pixel_y_length (float) – Length of the pixel(etched block) in axis-y.
fdtd_engine (FDTDSimulation) – The FDTDSimulation object.
material (String) – Material setting for the pixels in Lumerical FDTD (Si = “Si (Silicon) - Palik”, SiO2 = “SiO2 (Glass) - Palik”, default: SiO2).
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).
group_name (String) – Unique name of the pixels for distinguishing different pixel region.
matrix_mask (Array) – Mask array for the matrix in update function (default: None).
relaxing_time (Float) – Relaxing time for eval in Lumerical FDTD (unit: s, default: 0).
- update(matrix)
Update pixel 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.
- Parameters:
matrix (numpy.array) – Array (values:0~1) that represent the pixels in the region.
CirclePixelsRegion
- class splayout.CirclePixelsRegion(bottom_left_corner_point, top_right_corner_point, pixel_radius, fdtd_engine, material='SiO2 (Glass) - Palik', z_start=-0.11, z_end=0.11, group_name='pixels', matrix_mask=None, relaxing_time=0)
Bases:
object
Rectangle pixels region for FDTD simulation. It will create a region with etched blocks that can be updated by a two-dimensional matrix.
- Parameters:
bottom_left_corner_point (Point) – Lower left corner of the region.
top_right_corner_point (Point) – Upper right corner of the region.
pixel_radius (float) – Radius of the pixel(etched block).
fdtd_engine (FDTDSimulation) – The FDTDSimulation object.
material (String) – Material setting for the pixels in Lumerical FDTD (Si = “Si (Silicon) - Palik”, SiO2 = “SiO2 (Glass) - Palik”, default: SiO2).
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).
group_name (String) – Unique name of the pixels for distinguishing different pixel region(default: “pixels”).
matrix_mask (Array) – Mask array for the matrix in update function (default: None).
relaxing_time (Float) – Relaxing time for eval in Lumerical FDTD (unit: s, default: 0).
- update(matrix)
Update pixel 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.
- Parameters:
matrix (numpy.array) – Array (values:0~1) that represent the pixels in the region.
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:
object
2D 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, display=0)
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).
display (Int or Bool) – Whether to show the figure (default: 0).
- plot_field_figure(filename=None, display=0)
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).
display (Int or Bool) – Whether to show the figure (default: 0).
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:
object
3D 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, display=0)
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).
display (Int or Bool) – Whether to show the figure (default: 0).
- plot_field_figure(filename=None, display=0)
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).
display (Int or Bool) – Whether to show the figure (default: 0).
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:
object
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.
- 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, display=0)
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).
display (Int or Bool) – Whether to show the figure (default: 0).
- plot_field_figure(filename=None, display=0)
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).
display (Int or Bool) – Whether to show the figure (default: 0).
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')
Bases:
object
Layered 3D 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.
- 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, display=0)
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).
display (Int or Bool) – Whether to show the figure (default: 0).
- plot_field_figure(filename=None, display=0)
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).
display (Int or Bool) – Whether to show the figure (default: 0).
ScalableToOptRegion3D
- class splayout.ScalableToOptRegion3D(bottom_left_corner_point, top_right_corner_point, fdtd_engine, x_mesh=0.02, y_mesh=0.02, z_mesh=0.02, x_scale=1, y_scale=1, lower_index=1.444, higher_index=3.478, z_start=-0.11, z_end=0.11, rename='ToOptRegion')
Bases:
object
Scalable 3D 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).
x_scale (Float) – The scale size in x-axis (default: 1)
y_scale (Float) – The scale size in y-axis (default: 1)
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
- scaling(original_matrix)
Scaling the original matrix to a scaled matrix.
- Returns:
scaled_matrix – (scaled_x_size, scaled_y_size).
- Return type:
Array.
- descaling(scaled_matrix)
Scaling the scaled matrix to an original-size matrix.
- Returns:
original-size matrix – (x_size, y_size).
- Return type:
Array.
- update(params_matrix)
Update Toopology Optimization Region according to the new matrix.
- 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, display=0)
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).
display (Int or Bool) – Whether to show the figure (default: 0).
- plot_field_figure(filename=None, display=0)
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).
display (Int or Bool) – Whether to show the figure (default: 0).
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:
object
Adjoint 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
- reset_T_monitor_names(T_monitor_names)
Rest fom monitor for deriving FoM.
- Parameters:
T_monitor_names (String or List of String) – Monitor names for deriving FoM.
- reset_forward_source_names(forward_source_names)
Rest source for Forward simulation.
- Parameters:
forward_source_names (String or List of String) – Source names for Forward simulation.
- reset_backward_source_names(backward_source_names)
Rest source for Adjoint simulation.
- Parameters:
backward_source_names (String or List of String) – Source names for Adjoint simulation.
- reset_target_T(target_T)
Rest target FoMs at different frequencies.
- Parameters:
target_T (Array or List of Array) – Target FoMs at different frequencies.
AdjointForTO
- class splayout.AdjointForTO(fdtd_engine, T_monitor_names, target_T, design_region, forward_source_names, backward_source_names, sim_name='Adjoint', y_antisymmetric=0, if_default_fom=1, backward_T_monitor_names=None)
Bases:
object
Adjoint Method for Topology Optimization.
- Parameters:
fdtd_engine (FDTDSimulation) – The FDTDSimulation object.
T_monitor_names (String or List of String) – Monitor names for deriving FoM.
target_T (Array or List of Array) – Target Transmissions at different frequencies.
design_region (TopologyOptRegion2D or TopologyOptRegion3D or ScalableToOptRegion3D) – Design region for shape derivative method.
forward_source_names (String or List of String) – Source names for Forward simulation.
backward_source_names (String or List of String) – Source names for Adjoint simulation.
sim_name (String) – Name of the temporary simulation(default: “Adjoint”).
y_antisymmetric (Bool or Int) – Whether set y-axis antisymmetric in the simulation(default: 0).
if_default_fom (Bool or Int) – `Whether use the default figure of merit(default: 1).
backward_T_monitor_names (String or List of String) – Monitor names for deriving FoM which need to calculate in the backward direction.
- get_total_source_power(source_names)
Calculate the total power of sources. :param forward_source_names: :type forward_source_names: List of String :param Source names for simulation.:
- Returns:
- total_source_power – The total power of sources.
- Return type:
Float
- get_forward_transmission_properties()
Calculate transmission properties of the forward simulation.
- 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 (if_default_fom = 1) or Transmission(if_default_fom = 0).
- 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 – Gradients.
- Return type:
Array
- reset_T_monitor_names(T_monitor_names)
Rest fom monitor for deriving FoM.
- Parameters:
T_monitor_names (String or List of String) – Monitor names for deriving FoM.
- reset_forward_source_names(forward_source_names)
Rest source for Forward simulation.
- Parameters:
forward_source_names (String or List of String) – Source names for Forward simulation.
- reset_backward_source_names(backward_source_names)
Rest source for Adjoint simulation.
- Parameters:
backward_source_names (String or List of String) – Source names for Adjoint simulation.
- reset_target_T(target_T)
Rest target FoMs at different frequencies.
- Parameters:
target_T (Array or List of Array) – Target FoMs at different frequencies.
AdjointForMultiTO
- class splayout.AdjointForMultiTO(fdtd_engine, T_monitor_names, target_T, design_regions, forward_source_names, backward_source_names, sim_name='Adjoint', y_antisymmetric=0, if_default_fom=1, backward_T_monitor_names=None)
Bases:
object
Adjoint Method for Multiple Topology Optimization Regions.
- Parameters:
fdtd_engine (FDTDSimulation) – The FDTDSimulation object.
T_monitor_names (String or List of String) – Monitor names for deriving FoM.
target_T (Array or List of Array) – Target Transmissions at different frequencies.
design_regions (List) – Design regions for optimization.
forward_source_names (String or List of String) – Source names for Forward simulation.
backward_source_names (String or List of String) – Source names for Adjoint simulation.
sim_name (String) – Name of the temporary simulation(default: “Adjoint”).
y_antisymmetric (Bool or Int) – Whether set y-axis antisymmetric in the simulation(default: 0).
if_default_fom (Bool or Int) – `Whether use the default figure of merit(default: 1).
backward_T_monitor_names (String or List of String) – Monitor names for deriving FoM which need to calculate in the backward direction.
- get_total_source_power(source_names)
Calculate the total power of sources. :param forward_source_names: :type forward_source_names: List of String :param Source names for simulation.:
- Returns:
- total_source_power – The total power of sources.
- Return type:
Float
- get_forward_transmission_properties()
Calculate transmission properties of the forward simulation.
- 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 (if_default_fom = 1) or Transmission(if_default_fom = 0).
- 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 – Gradients. Size:Params (if_default_fom = 1). Size:Targets, Params (if_default_fom = 0).
- Return type:
Array
- reset_T_monitor_names(T_monitor_names)
Rest fom monitor for deriving FoM.
- Parameters:
T_monitor_names (String or List of String) – Monitor names for deriving FoM.
- reset_forward_source_names(forward_source_names)
Rest source for Forward simulation.
- Parameters:
forward_source_names (String or List of String) – Source names for Forward simulation.
- reset_backward_source_names(backward_source_names)
Rest source for Adjoint simulation.
- Parameters:
backward_source_names (String or List of String) – Source names for Adjoint simulation.
- reset_target_T(target_T)
Rest target FoMs at different frequencies.
- Parameters:
target_T (Array or List of Array) – Target FoMs at different frequencies.