Skip to content

Commit

Permalink
Grammar for lets
Browse files Browse the repository at this point in the history
  • Loading branch information
CLangford2098 committed Sep 5, 2024
1 parent d8854e1 commit fc12df1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
16 changes: 8 additions & 8 deletions docs/tutorials/introductory/optical_systems.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ These attributes define the size of the PSF, the pixel scale of the PSF, and the

Beyond this, the `CartesianOpticalSystem` has an extra attribute `focal_length`, with units of meters.

Now lets create a minimal `AnguarOpticalSystem` to demonstrate how to use these classes.
Now let's create a minimal `AnguarOpticalSystem` to demonstrate how to use these classes.


```python
Expand Down Expand Up @@ -99,7 +99,7 @@ All three of these object are quite similar, and share the same three primary me
2. `.propagate`
3. `.model`

Lets look at them one-by-one.
Let's look at them one-by-one.

## `propagate_mono`

Expand All @@ -109,7 +109,7 @@ Lets look at them one-by-one.
- `offset` is the offset of the source from the center of optical system, in radians
- `return_wf` is a boolean flag that determines whether the wavefront object should be returned, as opposed to the psf array.

Note that the `propagate_mono` method should generally not be used, as its functionality is superceeded by the `propagate` method, but lets look at how it works anyway.
Note that the `propagate_mono` method should generally not be used, as its functionality is superceeded by the `propagate` method, but let's look at how it works anyway.


```python
Expand Down Expand Up @@ -213,7 +213,7 @@ plt.show()
- `return_wf` is a boolean flag that determines whether the `Wavefront` object should be returned, as opposed to the psf array.
- `return_psf` is a boolean flag that determines whether the `PSF` object should be returned, as opposed to the psf array.

Lets see how to ues it.
Let's see how to use it.


```python
Expand Down Expand Up @@ -253,7 +253,7 @@ plt.show()



Now lets see how the amplitudes and phases look.
Now let's see how the amplitudes and phases look.


```python
Expand Down Expand Up @@ -312,7 +312,7 @@ plt.show()



We can also return the `PSF` object too, allowing us to keep track of the pixel scale and perform operations like downsampling. Lets have a look at that now
We can also return the `PSF` object too, allowing us to keep track of the pixel scale and perform operations like downsampling. Let's have a look at that now


```python
Expand All @@ -322,7 +322,7 @@ PSF = optics.propagate(wavelengths, offset, weights, return_psf=True)
# Downsample the PSF to the 'true' pixel scale
true_PSF = PSF.downsample(oversample)

# Lets examine it, and plot it
# Let's examine it, and plot it
print(true_PSF)

# Plot
Expand Down Expand Up @@ -353,7 +353,7 @@ plt.show()
- `return_wf` is a boolean flag that determines whether the `Wavefront` object should be returned, as opposed to the psf array.
- `return_psf` is a boolean flag that determines whether the `PSF` object should be returned, as opposed to the psf array.

Lets see how to ues it, although we will not look at the `return_wf` and `return_psf` flags as they behave identically to the above example.
Let's see how to use it, although we will not look at the `return_wf` and `return_psf` flags as they behave identically to the above example.


```python
Expand Down
6 changes: 3 additions & 3 deletions docs/tutorials/introductory/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ loss, grads = loss_fn(model, data)
# Note that Zodiax will return the gradients in the same structure as
# the model, ie, an optics object! This means we can use all the same
# methods to examine values as we would the normal optics object, so
# lets have a look.
# let's have a look.
print(f"Loss: {loss}\n")
print(f"Coefficient gradients: {grads.aberrations.coefficients}\n")
print(f"Gradients object: {grads}")
Expand Down Expand Up @@ -297,14 +297,14 @@ print(f"Gradients object: {grads}")

## Compiling and Optimisation

Working within the `jax` framework allows us to compile our code to XLA, which can significantly speed up the execution of our code. Lets do this and see how fast our model is able to evaluate! `Zodiax` provides a simple interface that allows us to compile our _whole object_ to XLA using `zdx.filter_jit`, which is very convenient.
Working within the `jax` framework allows us to compile our code to XLA, which can significantly speed up the execution of our code. Let's do this and see how fast our model is able to evaluate! `Zodiax` provides a simple interface that allows us to compile our _whole object_ to XLA using `zdx.filter_jit`, which is very convenient.


```python
# First we start by jit-compiling our loss function
jit_loss = zdx.filter_jit(loss_fn)

# Now lets have a look at the performance of the loss function
# Now let's have a look at the performance of the loss function
# Note we need to use the block_until_ready() method to ensure
# the computation is timed correctly, this is because jax uses
# asynchronous computation by default.
Expand Down
18 changes: 9 additions & 9 deletions docs/tutorials/introductory/sources.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ plt.rcParams["image.origin"] = 'lower'
plt.rcParams['figure.dpi'] = 72
```

First lets whip up an optical system that we can use to propagate the sources through.
First let's whip up an optical system that we can use to propagate the sources through.


```python
Expand Down Expand Up @@ -55,7 +55,7 @@ The `Source` and `Spectrum` classes in dLux work in tandem, with all `Source` ob
1. `Spectrum` is a simple array-based spectrum, contating `wavelengths` and `weights`.
2. `PolySpectrum` is a simple polynomial spectrum, containing `wavelengths` and `coefficients`.

In general users will not need to intract with the `Spectrum` objects directly, as they are automatically instatiated when creating a `Source` object. Lets take a look at the various different `Source` classes implemented in dLux.
In general users will not need to intract with the `Spectrum` objects directly, as they are automatically instatiated when creating a `Source` object. Let's take a look at the various different `Source` classes implemented in dLux.

1. `PointSource`
4. `ResolvedSource`
Expand All @@ -66,7 +66,7 @@ In general users will not need to intract with the `Spectrum` objects directly,

They all have a similar interface, having both a `.normalise` and `.model` method. The `.normalise` method takes no inputs and normalises the source and spectrum, which is important during optimisation since the updates during that process can not guarantee that the source remains normalised. The model method has the following signature `.model(optical_system, return_wf=False, return_psf=False)`, mirroring the `OpticalSystem.model` method. The `return_wf` and `return_psf` flags are used to determine what object is returned. If both are `False`, the returned psf is an array, if `return_wf` is `True` the returned psf is a `Wavefront` object, and if `return_psf` is `True` the returned psf is a `PSF` object.

Ands that about all there is to the `Source` objects! So lets jump in and have a look at these classes.
Ands that about all there is to the `Source` objects! So let's jump in and have a look at these classes.

### Initialising the Spectrum

Expand All @@ -80,7 +80,7 @@ The `PointSource` class is very straightforwards with three attributes:
2. `flux` - the flux of the source, in photons.
3. `spectrum` - the spectrum of the source.

Lets create one and model it through an optical system. We will also return the `PSF` object so we can examine both the oversampled and downsampled psfs.
Let's create one and model it through an optical system. We will also return the `PSF` object so we can examine both the oversampled and downsampled psfs.


```python
Expand Down Expand Up @@ -136,7 +136,7 @@ The resolved source operates very similarly to the `PointSource` class, only add
3. `spectrum` - the spectrum of the source.
4. `distribution` - the distribution of the source.

Lets create one and model it through an optical system.
Let's create one and model it through an optical system.


```python
Expand Down Expand Up @@ -189,7 +189,7 @@ The `BinarySource` class parametrises two point sources with 6 parameters:
5. `contrast` - the contrast of the two sources, in photons.
6. `spectrum` - the spectrum of the sources.

We can also pass in an array of `weights` in order to give them _different_ spectra. Lets create one and model it through an optical system.
We can also pass in an array of `weights` in order to give them _different_ spectra. Let's create one and model it through an optical system.


```python
Expand Down Expand Up @@ -247,7 +247,7 @@ The PointResolved source is a combination of the `PointSource` and `ResolvedSour
3. `spectrum` - the spectrum of the source.
4. `distribution` - the distribution of the resolved source.

Lets create one and model it through an optical system.
Let's create one and model it through an optical system.


```python
Expand Down Expand Up @@ -298,7 +298,7 @@ The `PointSources` class is very similar to the `PointSource` class, simple expa
2. `flux` - the fluxes of the sources, in photons.
3. `spectrum` - the spectrum of the sources.

Lets create one and model it through an optical system.
Let's create one and model it through an optical system.


```python
Expand Down Expand Up @@ -340,7 +340,7 @@ plt.show()

## Scene

The `Scene` class is a simple container class for `Source` objects, allowing for multiple sources to be modelled simultaneously. It behaves similarly to optical systems in dLux, taking in a list of `Source` objects that are stored in a dictionary. Lets model a series of the sources we just created through an optical system.
The `Scene` class is a simple container class for `Source` objects, allowing for multiple sources to be modelled simultaneously. It behaves similarly to optical systems in dLux, taking in a list of `Source` objects that are stored in a dictionary. Let's model a series of the sources we just created through an optical system.


```python
Expand Down

0 comments on commit fc12df1

Please sign in to comment.