Skip to content

Commit

Permalink
Adding more introductory tutorials
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisDesdoigts committed Sep 23, 2023
1 parent 0e8f66e commit 82968a5
Show file tree
Hide file tree
Showing 36 changed files with 693 additions and 202 deletions.
3 changes: 3 additions & 0 deletions docs/API/core/optical_systems.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Optical Systems

???+ info "OpticalSystem"
::: dLux.optical_systems.OpticalSystem

???+ info "AngularOpticalSystem"
::: dLux.optical_systems.AngularOpticalSystem

Expand Down
63 changes: 0 additions & 63 deletions docs/API/layers/aberrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,66 +5,3 @@

???+ info "ZernikeBasis"
::: dLux.layers.aberrations.ZernikeBasis

<!-- # Aberrations: aberrations.py
This module contains the classes that define the behaviour of Aberration Layers in dLux.
There are two public classes:
- `Zernike`
- `ZernikeBasis`
These classes are designed to generate Zernike polynomials dynamically. Typically, users should not need to interact with these classes directly, but rather through the `Aperture` classes.
The Zernike class hold a single Zernike polynomial. It has one main method, `.calculate(coordinates, nsides)` that takes in a set of coordinates and calculates the Zernike polynomial on those coordinates.
The ZernikeBasis class holds a set of Zernike polynomials. It has one main method, `.calculate_basis(coordinates, nsides)` that takes in a set of coordinates and calculates the Zernike polynomial basis on those coordinates.
??? info "Zernike Basis API"
:::dLux.aberrations.ZernikeBasis
??? info "Zernike API"
:::dLux.aberrations.Zernike
Let's construct a Zernike Basis:
```python
import dLux as dl
import jax.numpy as np
zernike_basis = dl.ZernikeBasis(np.arange(1, 7))
```
```python
> ZernikeBasis(
> zernikes=[
> Zernike(j=1, n=0, m=0, name='Piston', _k=f32[1], _c=f32[1]),
> Zernike(j=2, n=1, m=1, name='Tilt X', _k=f32[1], _c=f32[1]),
> Zernike(j=3, n=1, m=-1, name='Tilt Y', _k=f32[2], _c=f32[2]),
> Zernike(j=4, n=2, m=0, name='Defocus', _k=f32[2], _c=f32[2]),
> Zernike(j=5, n=2, m=-2, name='Astig X', _k=f32[3], _c=f32[3]),
> Zernike(j=6, n=2, m=2, name='Astig Y', _k=f32[1], _c=f32[1])
> ]
> )
```
??? abstract "Plotting code"
```python
import matplotlib.pyplot as plt
npix = 256
coords = dl.utils.pixel_coords(npix, 2/npix)
basis = zernike_basis.calculate_basis(coords)
plt.figure(figsize=(15, 8))
for i in range(len(basis)):
plt.subplot(2, 3, i+1)
plt.title(f"{zernike_basis.noll_indices[i].name}")
plt.imshow(basis[i])
plt.colorbar()
plt.tight_layout()
plt.savefig("assets/zernike.png")
```
![zernike](../assets/zernike.png) -->
61 changes: 1 addition & 60 deletions docs/API/layers/detector_layers.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,63 +13,4 @@
::: dLux.layers.detector_layers.AddConstant

???+ info "Downsample"
::: dLux.layers.detector_layers.Downsample

<!-- # Detector Layers: `detector_layers.py`
This module contains the classes that define the behaviour of detector layers in ∂Lux.
There are six public classes:
- `ApplyPixelResponse`
- `ApplyJitter`
- `ApplySaturation`
- `AddConstant`
- `IntegerDownsample`
- `RotateDetector`
These classes operate on `Image` classes. They have one main method: `.__call__(image)`, which takes in a ∂Lux `Image` class and applies the detector layer to it.
These classes are relatively simple, so let's quickly move through them.
### `ApplyPixelResponse`
Applies a pixel response array to the input image via a multiplication.
??? info "ApplyPixelResponse API"
:::dLux.detector_layers.ApplyPixelResponse
### `ApplyJitter`
Convolves the image with a Gaussian kernel parameterised by the standard deviation (`sigma`).
??? info "ApplyJitter API"
:::dLux.detector_layers.ApplyJitter
### `ApplySaturation`
Applies a simple saturation model to the input image, by clipping any values above `saturation`.
??? info "ApplySaturation API"
:::dLux.detector_layers.ApplySaturation
### `AddConstant`
Add a constant to the output image. This is typically used to model the mean value of the detector noise.
??? info "AddConstant API"
:::dLux.detector_layers.AddConstant
### `IntegerDownsample`
Downsamples an input image by an integer number of pixels via a summation. The number of pixels in the input image must be integer divisible by `kernel_size`.
??? info "IntegerDownsample API"
:::dLux.detector_layers.IntegerDownsample
### `RotateDetector`
Applies a rotation to the image using interpolation methods.
??? info "RotateDetector API"
:::dLux.detector_layers.RotateDetector -->
::: dLux.layers.detector_layers.Downsample
19 changes: 11 additions & 8 deletions docs/API/layers/optical_layers.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
# Optical Layers

???+ info "MFT"
::: dLux.layers.propagators.MFT
???+ info "TransmissiveLayer"
::: dLux.layers.optical_layers.TransmissiveLayer

???+ info "FFT"
::: dLux.layers.propagators.FFT
???+ info "AberratedLayer"
::: dLux.layers.optical_layers.AberratedLayer

???+ info "ShiftedMFT"
::: dLux.layers.propagators.ShiftedMFT
???+ info "BasisLayer"
::: dLux.layers.optical_layers.BasisLayer

???+ info "FarFieldFresnel"
::: dLux.layers.propagators.FarFieldFresnel
???+ info "Tilt"
::: dLux.layers.optical_layers.Tilt

???+ info "Normalise"
::: dLux.layers.optical_layers.Normalise
60 changes: 8 additions & 52 deletions docs/API/layers/propagators.md
Original file line number Diff line number Diff line change
@@ -1,57 +1,13 @@
# Propagators

???+ info "ApplyPixelResponse"
::: dLux.layers.detector_layers.ApplyPixelResponse
???+ info "MFT"
::: dLux.layers.propagators.MFT

???+ info "ApplyJitter"
::: dLux.layers.detector_layers.ApplyJitter
???+ info "FFT"
::: dLux.layers.propagators.FFT

???+ info "ApplySaturation"
::: dLux.layers.detector_layers.ApplySaturation
???+ info "ShiftedMFT"
::: dLux.layers.propagators.ShiftedMFT

???+ info "AddConstant"
::: dLux.layers.detector_layers.AddConstant

???+ info "Downsample"
::: dLux.layers.detector_layers.Downsample

<!-- # Propagators: `propagators.py`
This module contains the classes that define the behaviour of propagator layers in ∂Lux.
These classes do not implement the propagation functionality themselves, but instead store the parameters of the propagation and call inbuilt methods of the `Wavefront` class; thus, its API is essentially a mirror of those methods.
There are four public classes:
- `MFT`
- `FFT`
- `ShiftedMFT`
- `FarFieldFresnel`
### `MFT(npixels, pixel_scale, focal_length=None, inverse=False)`
Performs a Matrix Fourier Transform (MFT) on the wavefront, propagating from Pupil to Focal plane. If `focal_length` is `None`, `pixel_scale` is assumed to be in angular units (radians), otherwise it is assumed to be in Cartesian units (metres).
??? info "MFT API"
::: dLux.propagators.MFT
### `FFT(pad, focal_length=None, inverse=False)`
Performs a Fast Fourier Transform (FFT) on the wavefront, propagating from Pupil to Focal plane. If `focal_length` is `None`, the output units will angular (radians), otherwise cartesian (metres).
??? info "FFT API"
::: dLux.propagators.FFT
### `shiftedMFT(npixels, pixel_scale, shift, focal_length=None, pixel=True, inverse=False)`
Performs a Matrix Fourier Transform (MFT) on the wavefront, propagating from Pupil to Focal plane. If `focal_length` is `None`, `pixel_scale` is assumed to be in angular units (radians), otherwise it is assumed to be in Cartesian units (metres). The `shift` parameter is used to shift the center of the output plane, which is treated in units of pixels by default, otherwise it is treated in the units of `pixel_scale`.
??? info "Shifted MFT API"
::: dLux.propagators.ShiftedMFT
### `FarFieldFresnel(npixels, pixel_scale, focal_length, focal_shift, shift, pixel=True)`
Performs a Fresnel propagation on the wavefront, propagating from Pupil to Focal plane. The `focal_shift` parameter represents the distance from the focal plane at which the PSF is modelled. The `shift` parameter is used to shift the center of the output plane, which is treated in units of pixels by default, otherwise it is treated in the units of `pixel_scale`.
??? info "Far Field Fresnel API"
::: dLux.propagators.FarFieldFresnel -->
???+ info "FarFieldFresnel"
::: dLux.layers.propagators.FarFieldFresnel
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 82968a5

Please sign in to comment.