Shapes
Contains functions for creating various shapes as Device objects.
L_grating(width=200, height=None, pitch=100, duty_cycle=0.5, **kwargs)
Create a Device object with an L-shaped grating pattern.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
width
|
int
|
The width of the L-grating. Defaults to 200. |
200
|
height
|
int
|
The height of the L-grating. Defaults to the value of width. |
None
|
pitch
|
int
|
The pitch (period) of the L-shapes. Defaults to 100. |
100
|
duty_cycle
|
float
|
The duty cycle of the L-shapes. Defaults to 0.5. |
0.5
|
**kwargs
|
dict
|
Additional keyword arguments to be passed to the Device constructor. |
{}
|
Returns:
Type | Description |
---|---|
Device
|
A Device object containing the L-shaped grating pattern. |
Source code in prefab/shapes.py
cross(width=200, height=None, arm_width=60, **kwargs)
Create a Device object with a cross shape.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
width
|
int
|
The overall width of the cross. Defaults to 200. |
200
|
height
|
int
|
The overall height of the cross. Defaults to the value of width. |
None
|
arm_width
|
int
|
The width of the cross arms. Defaults to 60. |
60
|
**kwargs
|
dict
|
Additional keyword arguments to be passed to the Device constructor. |
{}
|
Returns:
Type | Description |
---|---|
Device
|
A Device object containing the cross shape. |
Source code in prefab/shapes.py
disk(width=200, height=None, **kwargs)
Create a Device object with an elliptical shape.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
width
|
int
|
The width of the ellipse. Defaults to 200. |
200
|
height
|
int
|
The height of the ellipse. Defaults to the value of width. |
None
|
**kwargs
|
dict
|
Additional keyword arguments to be passed to the Device constructor. |
{}
|
Returns:
Type | Description |
---|---|
Device
|
A Device object containing the elliptical shape. |
Source code in prefab/shapes.py
disk_wavy(width=200, wave_amplitude=10, wave_frequency=10, **kwargs)
Create a Device object with a circular shape with wavy edges.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
width
|
int
|
The overall width and height of the wavy circle. Defaults to 200. |
200
|
wave_amplitude
|
float
|
The amplitude of the waves. Defaults to 10. |
10
|
wave_frequency
|
float
|
The frequency of the waves. Defaults to 10. |
10
|
**kwargs
|
dict
|
Additional keyword arguments to be passed to the Device constructor. |
{}
|
Returns:
Type | Description |
---|---|
Device
|
A Device object containing the wavy circular shape. |
Source code in prefab/shapes.py
disks(rows=5, cols=5, disk_radius=30, spacing=60, **kwargs)
Create a Device object with a grid of uniform disks.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rows
|
int
|
The number of rows in the grid. Defaults to 5. |
5
|
cols
|
int
|
The number of columns in the grid. Defaults to 5. |
5
|
disk_radius
|
int
|
The radius of each disk. Defaults to 30. |
30
|
spacing
|
int
|
The spacing between disk centers. Defaults to 60. |
60
|
**kwargs
|
dict
|
Additional keyword arguments to be passed to the Device constructor. |
{}
|
Returns:
Type | Description |
---|---|
Device
|
A Device object containing a grid of disks. |
Source code in prefab/shapes.py
disks_offset(rows=5, cols=5, disk_radius=30, spacing=30, **kwargs)
Create a Device object with an offset grid of disks.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rows
|
int
|
The number of rows in the grid. Defaults to 5. |
5
|
cols
|
int
|
The number of columns in the grid. Defaults to 5. |
5
|
disk_radius
|
int
|
The radius of each disk. Defaults to 30. |
30
|
spacing
|
int
|
The spacing between disk centers. Defaults to 30. |
30
|
**kwargs
|
dict
|
Additional keyword arguments to be passed to the Device constructor. |
{}
|
Returns:
Type | Description |
---|---|
Device
|
A Device object containing an offset grid of disks. |
Source code in prefab/shapes.py
disks_varying(rows=5, cols=5, min_disk_radius=10, max_disk_radius=30, spacing=30, **kwargs)
Create a Device object with a grid of disks with varying radii.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rows
|
int
|
The number of rows in the grid. Defaults to 5. |
5
|
cols
|
int
|
The number of columns in the grid. Defaults to 5. |
5
|
min_disk_radius
|
int
|
The minimum radius of the disks. Defaults to 10. |
10
|
max_disk_radius
|
int
|
The maximum radius of the disks. Defaults to 30. |
30
|
spacing
|
int
|
The spacing between disk centers. Defaults to 30. |
30
|
**kwargs
|
dict
|
Additional keyword arguments to be passed to the Device constructor. |
{}
|
Returns:
Type | Description |
---|---|
Device
|
A Device object containing a grid of disks with varying radii. |
Source code in prefab/shapes.py
grating(height=200, pitch=120, duty_cycle=0.5, num_gratings=3, **kwargs)
Create a Device object with a grating pattern.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
height
|
int
|
The height of the grating. Defaults to 200. |
200
|
pitch
|
int
|
The pitch (period) of the grating. Defaults to 120. |
120
|
duty_cycle
|
float
|
The duty cycle of the grating. Defaults to 0.5. |
0.5
|
num_gratings
|
int
|
The number of grating periods. Defaults to 3. |
3
|
**kwargs
|
dict
|
Additional keyword arguments to be passed to the Device constructor. |
{}
|
Returns:
Type | Description |
---|---|
Device
|
A Device object containing the grating pattern. |
Source code in prefab/shapes.py
holes(rows=5, cols=5, hole_radius=30, spacing=30, **kwargs)
Create a Device object with a grid of uniform circular holes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rows
|
int
|
The number of rows in the grid. Defaults to 5. |
5
|
cols
|
int
|
The number of columns in the grid. Defaults to 5. |
5
|
hole_radius
|
int
|
The radius of each hole. Defaults to 30. |
30
|
spacing
|
int
|
The spacing between hole centers. Defaults to 30. |
30
|
**kwargs
|
dict
|
Additional keyword arguments to be passed to the Device constructor. |
{}
|
Returns:
Type | Description |
---|---|
Device
|
A Device object containing a grid of circular holes. |
Source code in prefab/shapes.py
holes_offset(rows=5, cols=5, hole_radius=30, spacing=30, **kwargs)
Create a Device object with an offset grid of circular holes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rows
|
int
|
The number of rows in the grid. Defaults to 5. |
5
|
cols
|
int
|
The number of columns in the grid. Defaults to 5. |
5
|
hole_radius
|
int
|
The radius of each hole. Defaults to 30. |
30
|
spacing
|
int
|
The spacing between hole centers. Defaults to 30. |
30
|
**kwargs
|
dict
|
Additional keyword arguments to be passed to the Device constructor. |
{}
|
Returns:
Type | Description |
---|---|
Device
|
A Device object containing an offset grid of circular holes. |
Source code in prefab/shapes.py
holes_varying(rows=5, cols=5, min_hole_radius=10, max_hole_radius=30, spacing=30, **kwargs)
Create a Device object with a grid of circular holes with varying radii.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rows
|
int
|
The number of rows in the grid. Defaults to 5. |
5
|
cols
|
int
|
The number of columns in the grid. Defaults to 5. |
5
|
min_hole_radius
|
int
|
The minimum radius of the holes. Defaults to 10. |
10
|
max_hole_radius
|
int
|
The maximum radius of the holes. Defaults to 30. |
30
|
spacing
|
int
|
The spacing between hole centers. Defaults to 30. |
30
|
**kwargs
|
dict
|
Additional keyword arguments to be passed to the Device constructor. |
{}
|
Returns:
Type | Description |
---|---|
Device
|
A Device object containing a grid of circular holes with varying radii. |
Source code in prefab/shapes.py
offset_grating(height=200, pitch=120, duty_cycle=0.5, num_gratings=3, **kwargs)
Create a Device object with an offset grating pattern (alternating rows).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
height
|
int
|
The height of the grating. Defaults to 200. |
200
|
pitch
|
int
|
The pitch (period) of the grating. Defaults to 120. |
120
|
duty_cycle
|
float
|
The duty cycle of the grating. Defaults to 0.5. |
0.5
|
num_gratings
|
int
|
The number of grating periods. Defaults to 3. |
3
|
**kwargs
|
dict
|
Additional keyword arguments to be passed to the Device constructor. |
{}
|
Returns:
Type | Description |
---|---|
Device
|
A Device object containing the offset grating pattern. |
Source code in prefab/shapes.py
pie(width=200, height=None, arc_angle=270, **kwargs)
Create a Device object with a pie shape.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
width
|
int
|
The width of the pie. Defaults to 200. |
200
|
height
|
int
|
The height of the pie. Defaults to the value of width. |
None
|
arc_angle
|
float
|
The angle of the pie slice in degrees. Defaults to 270. |
270
|
**kwargs
|
dict
|
Additional keyword arguments to be passed to the Device constructor. |
{}
|
Returns:
Type | Description |
---|---|
Device
|
A Device object containing the pie shape. |
Source code in prefab/shapes.py
poly(width=200, num_points=5, **kwargs)
Create a Device object with a regular polygon shape.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
width
|
int
|
The overall width and height of the polygon. Defaults to 200. |
200
|
num_points
|
int
|
The number of sides of the polygon. Defaults to 5. |
5
|
**kwargs
|
dict
|
Additional keyword arguments to be passed to the Device constructor. |
{}
|
Returns:
Type | Description |
---|---|
Device
|
A Device object containing the regular polygon shape. |
Source code in prefab/shapes.py
radial_grating(width=200, grating_skew=0, num_gratings=6, **kwargs)
Create a Device object with a radial grating pattern.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
width
|
int
|
The overall width and height of the radial grating. Defaults to 200. |
200
|
grating_skew
|
int
|
The skew angle of the grating arms. Defaults to 0. |
0
|
num_gratings
|
int
|
The number of grating arms. Defaults to 6. |
6
|
**kwargs
|
dict
|
Additional keyword arguments to be passed to the Device constructor. |
{}
|
Returns:
Type | Description |
---|---|
Device
|
A Device object containing the radial grating pattern. |
Source code in prefab/shapes.py
rectangle(width=200, height=None, **kwargs)
Create a Device object with a rectangular shape.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
width
|
int
|
The width of the rectangle. Defaults to 200. |
200
|
height
|
int
|
The height of the rectangle. Defaults to the value of width. |
None
|
**kwargs
|
dict
|
Additional keyword arguments to be passed to the Device constructor. |
{}
|
Returns:
Type | Description |
---|---|
Device
|
A Device object containing the rectangular shape. |
Source code in prefab/shapes.py
ring(width=200, height=None, border_width=60, **kwargs)
Create a Device object with a ring shape.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
width
|
int
|
The overall width of the ring. Defaults to 200. |
200
|
height
|
int
|
The overall height of the ring. Defaults to the value of width. |
None
|
border_width
|
int
|
The width of the ring border. Defaults to 60. |
60
|
**kwargs
|
dict
|
Additional keyword arguments to be passed to the Device constructor. |
{}
|
Returns:
Type | Description |
---|---|
Device
|
A Device object containing the ring shape. |
Source code in prefab/shapes.py
star(width=200, num_points=5, **kwargs)
Create a Device object with a star shape.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
width
|
int
|
The overall width and height of the star. Defaults to 200. |
200
|
num_points
|
int
|
The number of points on the star. Defaults to 5. |
5
|
**kwargs
|
dict
|
Additional keyword arguments to be passed to the Device constructor. |
{}
|
Returns:
Type | Description |
---|---|
Device
|
A Device object containing the star shape. |
Source code in prefab/shapes.py
target(width=200, height=None, arm_width=60, **kwargs)
Create a Device object with a target shape (cross with center removed).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
width
|
int
|
The overall width of the target. Defaults to 200. |
200
|
height
|
int
|
The overall height of the target. Defaults to the value of width. |
None
|
arm_width
|
int
|
The width of the target arms. Defaults to 60. |
60
|
**kwargs
|
dict
|
Additional keyword arguments to be passed to the Device constructor. |
{}
|
Returns:
Type | Description |
---|---|
Device
|
A Device object containing the target shape. |
Source code in prefab/shapes.py
window(width=200, height=None, border_width=60, **kwargs)
Create a Device object with a window shape (hollow square).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
width
|
int
|
The overall width of the window. Defaults to 200. |
200
|
height
|
int
|
The overall height of the window. Defaults to the value of width. |
None
|
border_width
|
int
|
The width of the window border. Defaults to 60. |
60
|
**kwargs
|
dict
|
Additional keyword arguments to be passed to the Device constructor. |
{}
|
Returns:
Type | Description |
---|---|
Device
|
A Device object containing the window shape. |