Shapes
Contains functions for creating various shapes as Device objects.
L_grating(height=200, pitch=100, duty_cycle=0.5, **kwargs)
Create a Device object with an L-shaped grating pattern.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
height |
int
|
The height and width of the L-grating. Defaults to 200. |
200
|
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
box(width=200, **kwargs)
Create a Device object with a square box shape.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
width |
int
|
The width and height of the square box. Defaults to 200. |
200
|
**kwargs |
dict
|
Additional keyword arguments to be passed to the Device constructor. |
{}
|
Returns:
Type | Description |
---|---|
Device
|
A Device object containing the square box shape. |
Source code in prefab/shapes.py
circle(width=200, **kwargs)
Create a Device object with a circular shape.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
width |
int
|
The width and height of the circle. Defaults to 200. |
200
|
**kwargs |
dict
|
Additional keyword arguments to be passed to the Device constructor. |
{}
|
Returns:
Type | Description |
---|---|
Device
|
A Device object containing the circular shape. |
Source code in prefab/shapes.py
circle_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
circles(rows=5, cols=5, radius=30, spacing=60, **kwargs)
Create a Device object with a grid of uniform circles.
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
|
radius |
int
|
The radius of each circle. Defaults to 30. |
30
|
spacing |
int
|
The spacing between circle 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 circles. |
Source code in prefab/shapes.py
circles_offset(rows=5, cols=5, radius=30, spacing=30, **kwargs)
Create a Device object with an offset grid of circles.
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
|
radius |
int
|
The radius of each circle. Defaults to 30. |
30
|
spacing |
int
|
The spacing between circle 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 circles. |
Source code in prefab/shapes.py
circles_varying(rows=5, cols=5, min_radius=10, max_radius=30, spacing=30, **kwargs)
Create a Device object with a grid of circles 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_radius |
int
|
The minimum radius of the circles. Defaults to 10. |
10
|
max_radius |
int
|
The maximum radius of the circles. Defaults to 30. |
30
|
spacing |
int
|
The spacing between circle 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 circles with varying radii. |
Source code in prefab/shapes.py
cross(width=200, arm_width=60, **kwargs)
Create a Device object with a cross shape.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
width |
int
|
The overall width and height of the cross. Defaults to 200. |
200
|
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
ellipse(width=200, height=100, **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 100. |
100
|
**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
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, 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
|
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, 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
|
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_radius=10, max_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_radius |
int
|
The minimum radius of the holes. Defaults to 10. |
10
|
max_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, arc_angle=270, **kwargs)
Create a Device object with a pie shape.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
width |
int
|
The width and height of the pie. Defaults to 200. |
200
|
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=100, **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 100. |
100
|
**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, border_width=60, **kwargs)
Create a Device object with a ring shape.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
width |
int
|
The overall width and height of the ring. Defaults to 200. |
200
|
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, 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 and height of the target. Defaults to 200. |
200
|
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, border_width=60, **kwargs)
Create a Device object with a window shape (hollow square).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
width |
int
|
The overall width and height of the window. Defaults to 200. |
200
|
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. |