Unified Layers¤
UnifiedLayer
dLux.layers.unified_layers.UnifiedLayer
¤
Bases: OpticalLayer, DetectorLayer
Base class for unified layers that can be applied to either wavefronts or PSFs.
UML

Source code in dLux/layers/unified_layers.py
14 15 16 17 18 19 20 | |
Rotate
dLux.layers.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. |
method |
str
|
The interpolation method. |
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 dLux/layers/unified_layers.py
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 | |
__call__(target)
¤
Applies the rotation to the input.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
Wavefront | PSF
|
The input to rotate. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
target |
Wavefront | PSF
|
The rotated input. |
Source code in dLux/layers/unified_layers.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | |
__init__(angle, method='linear', complex=False)
¤
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
angle
|
(float, radians)
|
The angle by which to rotate the input in the clockwise direction. |
required |
method
|
str = "linear"
|
The interpolation method. |
'linear'
|
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 dLux/layers/unified_layers.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | |
Flip
dLux.layers.unified_layers.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, i.e. axis 0 is the y-axis, and axis 1 is the x-axis.
UML

Attributes:
| Name | Type | Description |
|---|---|---|
axes |
tuple[int, ...] | int
|
The axes to flip the input about. This class uses the 'ij' indexing convention, i.e. axis 0 is the y-axis, and axis 1 is the x-axis. |
Source code in dLux/layers/unified_layers.py
134 135 136 137 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 | |
__call__(target)
¤
Flips the input about the specified axes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
Wavefront | PSF
|
The input to flip. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
target |
Wavefront | PSF
|
The flipped input. |
Source code in dLux/layers/unified_layers.py
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | |
__init__(axes)
¤
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
axes
|
tuple[int, ...] | int
|
The axes to flip the input about. This class uses the 'ij' indexing convention, i.e. axis 0 is the y-axis, and axis 1 is the x-axis. |
required |
Source code in dLux/layers/unified_layers.py
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | |
Resize
dLux.layers.unified_layers.Resize
¤
Bases: UnifiedLayer
Resizes either a wavefront or PSF by 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 dLux/layers/unified_layers.py
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 63 64 | |
__call__(target)
¤
Resizes the input.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
Wavefront | PSF
|
The input to resize. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
target |
Wavefront | PSF
|
The resized input. |
Source code in dLux/layers/unified_layers.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | |
__init__(npixels)
¤
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
npixels
|
int
|
The desired output size. |
required |
Source code in dLux/layers/unified_layers.py
40 41 42 43 44 45 46 47 48 | |
Lambda
dLux.layers.unified_layers.Lambda
¤
Bases: UnifiedLayer
A no-op layer that returns the input unchanged. This can be useful for debugging or as a placeholder in a pipeline.
UML

Source code in dLux/layers/unified_layers.py
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | |
__call__(target)
¤
Returns the input unchanged.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
Wavefront | PSF
|
The input to return. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
target |
Wavefront | PSF
|
The input, unchanged. |
Source code in dLux/layers/unified_layers.py
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | |