Correlating Shack-Hartmann WFS¶
Initialize a Correlating Shack-Hartmann Wavefront Sensor (WFS).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
nSubap
|
float
|
Number of subapertures across the pupil diameter. |
required |
telescope
|
Telescope
|
Telescope object to which the WFS is attached. |
required |
src
|
Source
|
Source object (SUN). |
required |
lightRatio
|
float
|
Threshold ratio to select valid subapertures based on flux. |
required |
plate_scale
|
float
|
Plate scale of the WFS in [arcsec/px]. |
required |
fieldOfView
|
float
|
Field of view of the WFS in [arcsec]. |
required |
guardPx
|
int
|
Number of pixels between subapertures. |
required |
fft_fieldOfView_oversampling
|
float
|
Extra FoV in [arcsec] that is taken for the FFT computation, in order to reduce wrapping effects. |
0
|
use_brightest
|
int
|
Picks the n brightest pixels as threshold for center-of-gravity spot detection. |
9
|
threshold_convolution
|
float
|
Cut-off threshold for Gaussian convolution. |
0.05
|
unit_in_rad
|
bool
|
Return slopes in radians if True, pixels otherwise. |
False
|
noiseFlag
|
bool
|
If True, the detector includes noise using the kwargs params/default config. By default, False. |
False
|
logger
|
Logger
|
Logger for WFS diagnostics. |
None
|
**kwargs
|
dict
|
Additional keyword arguments. fullWellCapacity : int, optional Detector parameter. Full Well Capacity of pixels [e-]. Default, 60ke- nBits : int, optional Detector parameter. Bit depth for quantization. Default is 12, shall be >= 8 quantumEfficiency : float, optional Detector parameter. Quantum efficiency (0-1). Default is 0.64. shotNoise : bool, optional Detector parameter. Shot noise flag. Default 1. darkCurrent : float, optional Detector parameter. Dark current [e-]. Default 250e-/px/s. readoutNoise : float, optional Detector parameter. Readout noise [e-]. Default 60e-. gain : float, optional Detector parameter. Gain of the detector. Default is 1. quantization_conversion : float, optional. Detector parameter. Conversion gain to discretize the measurement [e-/px]. Default 70.5e-/DN. sensorType : str, optional Detector parameter. Sensor type ('CCD', 'CMOS', 'EMCCD'). Default is 'CCD'. darkCalibration : int, optional Detector parameter. Number of frames to calibrate the dark. Default 20. randomState : int, optional Detector parameter. Seed for the random number generator. Default is None. integrationTime : float, optional Detector parameter. Integration time for the detector [s]. Default is the sampling time. |
{}
|
Source code in SAOS/CorrelatingShackHartmann.py
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 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 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 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | |
fft_fieldOfView_oversampling
instance-attribute
¶
npix_lenslet
instance-attribute
¶
cam
instance-attribute
¶
cam = Detector(
nPix=camera_size,
samplingTime=samplingTime,
fullWellCapacity=camera_params["fullWellCapacity"],
nBits=camera_params["nBits"],
quantumEfficiency=camera_params["quantumEfficiency"],
shotNoise=camera_params["shotNoise"],
darkCurrent=camera_params["darkCurrent"],
readoutNoise=camera_params["readoutNoise"],
gain=camera_params["gain"],
quantization_conversion=camera_params[
"quantization_conversion"
],
sensorType=camera_params["sensorType"],
darkCalibration=camera_params["darkCalibration"],
noiseFlag=noiseFlag,
logger=logger,
**camera_kwargs,
)
cube_flux
instance-attribute
¶
phasor
instance-attribute
¶
phasor_tiled
instance-attribute
¶
phasor_expanded
instance-attribute
¶
phasor_expanded_tiled
instance-attribute
¶
norm_flux_map
instance-attribute
¶
norm_flux_map = (
lightRatio
* pupil_reflectivity_resized
* samplingTime
* (D / (nSubap * npix_lenslet)) ** 2
)
photon_per_subaperture_2D
instance-attribute
¶
valid_subapertures_1D
instance-attribute
¶
valid_slopes_maps
instance-attribute
¶
calib_unit ¶
Calib the unit of the sensor if the user specifies radians instead of pixels.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
telescope
|
Telescope
|
The telescope object providing phase and pupil info. |
required |
src
|
Source
|
Source object for flux and wavelength reference. |
required |
Returns:
| Type | Description |
|---|---|
None
|
|
Source code in SAOS/CorrelatingShackHartmann.py
initialize_wfs ¶
Initialize the Shack-Hartmann WFS by measuring reference slopes and determining slope units.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
telescope
|
Telescope
|
The telescope object providing phase and pupil info. |
required |
src
|
Source
|
Source object for flux and wavelength reference. |
required |
Returns:
| Type | Description |
|---|---|
None
|
|
Source code in SAOS/CorrelatingShackHartmann.py
cross_correlate ¶
Cross-correlate subaperture images with a pseudoref image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subaps
|
ndarray
|
Subaperture images. |
required |
pseudoref
|
ndarray
|
Pseudoref image. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Cross-correlation result. |
Source code in SAOS/CorrelatingShackHartmann.py
centroid ¶
Compute center of gravity for subaperture spots.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image
|
Tensor
|
Subaperture image cube. |
required |
use_brightest
|
float
|
Minimum intensity to include in centroid. |
9
|
Returns:
| Type | Description |
|---|---|
ndarray
|
X and Y centroids per subaperture. |
Source code in SAOS/CorrelatingShackHartmann.py
initialize_flux ¶
Initialize per-subaperture flux distribution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
src
|
Source
|
Light source object. |
required |
norm_flux_map
|
ndarray
|
Normalized flux across telescope pupil. |
required |
Returns:
| Type | Description |
|---|---|
None
|
|
Source code in SAOS/CorrelatingShackHartmann.py
get_psf ¶
Get the electromagnetic field per subaperture based on input phase.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
phase
|
ndarray
|
List of Wavefront phase in radians per subdirection |
required |
fwhm
|
float
|
Full width at half maximum for the PSF in [px]. |
required |
npix_sun
|
float
|
Number of pixels in the sun image [px] |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Complex field per subaperture. |
Source code in SAOS/CorrelatingShackHartmann.py
458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 | |
compute_images ¶
Compute correlated subaperture images using convolution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
psf
|
Tensor
|
PSF of the subapertures. |
required |
subDirs_sun
|
ndarray
|
Sun subdirectories used as object. |
required |
new_px
|
int
|
New size in pixels for the sun subdirectories. |
required |
Returns:
| Type | Description |
|---|---|
Tensor
|
Convoluted images. |
Source code in SAOS/CorrelatingShackHartmann.py
merges_images ¶
Merge sun patches into a single frame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sun_patches
|
Tensor
|
The convoluted sun patches per subaperture. |
required |
src
|
Source
|
The solar source object. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
The merged full-field images. |
Source code in SAOS/CorrelatingShackHartmann.py
create_full_frame ¶
Combine subaperture images into full detector frame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subaps
|
ndarray
|
Subaperture spot images. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Reconstructed full sensor image. |
Source code in SAOS/CorrelatingShackHartmann.py
get_subaps ¶
Extract individual lenslet spot images from full detector image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
noisy_frame
|
ndarray
|
2D detector frame. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Subaperture cubes [nSubaps, width, height]. |
Source code in SAOS/CorrelatingShackHartmann.py
gradient_2D ¶
Compute X and Y gradients of a phase screen.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
arr
|
ndarray
|
2D array of phase values. |
required |
Returns:
| Type | Description |
|---|---|
tuple
|
Gradient in X and Y. |
Source code in SAOS/CorrelatingShackHartmann.py
lenslet_propagation_geometric ¶
Compute geometric propagation through lenslets.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
arr
|
ndarray
|
Input phase screen. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Concatenated slope vector. |
Source code in SAOS/CorrelatingShackHartmann.py
wfs_integrate ¶
Integrate the full detector image and compute valid slopes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ideal_frame
|
ndarray
|
Full-frame ideal image. |
required |
subaps
|
ndarray
|
Spot images per subaperture. |
required |
nPhoton
|
int
|
Number of incident photons |
required |
pseudoref
|
Tensor
|
Subaperture used as pseudo-reference for the correlations, if None one subaperture is picked |
None
|
Returns:
| Type | Description |
|---|---|
tuple
|
Slopes 1D, slopes 2D, and final noisy image. |
Source code in SAOS/CorrelatingShackHartmann.py
wfs_measure ¶
Measure slopes from a wavefront phase using the SH-WFS.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
phase_in
|
ndarray
|
Phase map input [radians]. |
required |
src
|
Source
|
Source object. |
required |
pseudoref
|
Tensor
|
Pseudo-reference image used for the correlations, if None the method picks one. |
None
|
reference_slopes
|
ndarray
|
Reference for the WF sensor, if None, geometric references are used. |
None
|
Returns:
| Type | Description |
|---|---|
tuple
|
Slopes 1D, slopes 2D, and detector image. |