Unified Layers
Rotate
Bases: UnifiedLayer
Rotates either a wavefront or PSF by a given angle. This is done using interpolation methods. The 'complex' input only has an effect if the input is a wavefront.
UML
Attributes:
Name | Type | Description |
---|---|---|
angle |
(float, radians)
|
The angle by which to rotate the input in the clockwise direction. |
order |
int
|
The order of the interpolation to use. Must be 0 or 1. |
complex |
bool
|
Should the rotation be performed on the 'complex' (real, imaginary), as opposed to the default 'phasor' (amplitude, phase) arrays. Only applies if the input is a wavefront. |
Source code in src/dLux/layers/unified_layers.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
|
__init__(angle, order=1, complex=False)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
angle
|
(float, radians)
|
The angle by which to rotate the input in the clockwise direction. |
required |
order
|
int = 1
|
The order of the interpolation to use. Must be 0 or 1. |
1
|
complex
|
bool = False
|
Should the rotation be performed on the 'complex' (real, imaginary), as opposed to the default 'phasor' (amplitude, phase) arrays. Only applies if the input is a wavefront. |
False
|
Source code in src/dLux/layers/unified_layers.py
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
|
apply(input)
Applies the rotation to the input.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
input
|
Union[Wavefront, PSF]
|
The input to rotate. |
required |
Returns:
Name | Type | Description |
---|---|---|
input |
Union[Wavefront, PSF]
|
The rotated input. |
Source code in src/dLux/layers/unified_layers.py
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
|
Flip
Bases: UnifiedLayer
Flips either a wavefront or PSF about the input axes. Can be either an int or a tuple of ints. This class uses the 'ij' indexing convention, ie axis 0 is the y-axis, and axis 1 is the x-axis.
UML
Attributes:
Name | Type | Description |
---|---|---|
axes |
Union[tuple, int]
|
The axes to flip the input about. This class uses the 'ij' indexing convention, ie axis 0 is the y-axis, and axis 1 is the x-axis. |
Source code in src/dLux/layers/unified_layers.py
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 |
|
__init__(axes)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
axes
|
Union[tuple, int]
|
The axes to flip the input about. This class uses the 'ij' indexing convention, ie axis 0 is the y-axis, and axis 1 is the x-axis. |
required |
Source code in src/dLux/layers/unified_layers.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
|
apply(input)
Flips the input about the input axes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
input
|
Union[Wavefront, PSF]
|
The input to flip. |
required |
Returns:
Name | Type | Description |
---|---|---|
input |
Union[Wavefront, PSF]
|
The flipped input. |
Source code in src/dLux/layers/unified_layers.py
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 |
|
Resize
Bases: UnifiedLayer
Resizes either a wavefront or PSF by either padding or cropping. Note this class only supports padding and cropping of even sizes to even sizes, and odd sizes to odd sizes to ensure all operations are paraxial.
UML
Attributes:
Name | Type | Description |
---|---|---|
npixels |
int
|
The desired output size. |
Source code in src/dLux/layers/unified_layers.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
|
__init__(npixels)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
npixels
|
tuple
|
The desired output size. |
required |
Source code in src/dLux/layers/unified_layers.py
36 37 38 39 40 41 42 43 44 |
|
apply(input)
Resizes the input.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
input
|
Union[Wavefront, PSF]
|
The input to resize. |
required |
Returns:
Name | Type | Description |
---|---|---|
input |
Union[Wavefront, PSF]
|
The resized input. |
Source code in src/dLux/layers/unified_layers.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
|