Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
andykee committed Feb 2, 2024
1 parent dfbc20a commit cb5f48b
Show file tree
Hide file tree
Showing 25 changed files with 418 additions and 456 deletions.
4 changes: 2 additions & 2 deletions docs/_img/python/jitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

psf_jitter = lentil.jitter(psf, scale=2, oversample=5)
plt.subplot(121)
plt.imshow(psf, origin='lower')
plt.imshow(psf, cmap='inferno')
plt.title('Input image')
plt.subplot(122)
plt.imshow(psf_jitter, origin='lower')
plt.imshow(psf_jitter, cmap='inferno')
plt.title('Jittery image')
4 changes: 2 additions & 2 deletions docs/_img/python/pixelate.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
psf_pixelate = lentil.detector.pixelate(psf, oversample=5)

plt.subplot(121)
plt.imshow(psf, origin='lower')
plt.imshow(psf, cmap='inferno')
plt.title('Oversampled propagation')

plt.subplot(122)
plt.imshow(psf_pixelate, origin='lower')
plt.imshow(psf_pixelate, cmap='inferno')
plt.title('Native detector sampling')
4 changes: 2 additions & 2 deletions docs/_img/python/smear.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
psf_smear = lentil.smear(psf, distance=5e-5,
pixelscale=5e-6, oversample=5)
plt.subplot(121)
plt.imshow(psf, origin='lower')
plt.imshow(psf, cmap='inferno')
plt.title('Input image')
plt.subplot(122)
plt.imshow(psf_smear, origin='lower')
plt.imshow(psf_smear, cmap='inferno')
plt.title('Smeared image')
4 changes: 2 additions & 2 deletions docs/_img/python/smear_directional.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
psf_smear = lentil.smear(psf, distance=25, angle=30,
oversample=5)
plt.subplot(121)
plt.imshow(psf, origin='lower')
plt.imshow(psf, cmap='inferno')
plt.title('Input image')
plt.subplot(122)
plt.imshow(psf_smear, origin='lower')
plt.imshow(psf_smear, cmap='inferno')
plt.title('Smeared image')
46 changes: 46 additions & 0 deletions docs/_static/matlab/check_pyenv.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
function compat = check_pyenv(py2ok)

if nargin < 1
py2ok = false;
end

rel.R2017b = {'2.7', '3.4', '3.5', '3.6'};
rel.R2018a = {'2.7', '3.5', '3.6'};
rel.R2018b = {'2.7', '3.5', '3.6'};
rel.R2019a = {'2.7', '3.5', '3.6', '3.7'};
rel.R2019b = {'2.7', '3.6', '3.7'};
rel.R2020a = {'2.7', '3.6', '3.7'};
rel.R2020b = {'2.7', '3.6', '3.7', '3.8'};
rel.R2021a = {'2.7', '3.7', '3.8'};
rel.R2021b = {'2.7', '3.7', '3.8', '3.9'};
rel.R2022a = {'2.7', '3.8', '3.9'};
rel.R2022b = {'2.7', '3.8', '3.9', '3.10'};
rel.R2023a = {'3.8', '3.9', '3.10'};

v = ver('MATLAB');
mlver = v.Release(2:7);
mlyear = str2double(mlver(2:5));
mlab = mlver(6);

if mlyear < 2019
pyver = pyversion.Rersion;
elseif mlyear == 2019
if strcmp(mlab, 'a')
pyver = pyversion.Rersion;
else
pyver = pyenv().Version;
end
else
pyver = pyenv().Version;
end

if any(ismember(rel.(mlver), pyver))
compat = true;
else
compat = false;
end

if pyver == '2.7' && py2ok == false
compat = false;
end

12 changes: 1 addition & 11 deletions docs/dev/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,10 @@ Development
This page provides resources for Lentil developers



.. toctree::
:maxdepth: 2

tech_notes/index

.. toctree::
:maxdepth: 3

verification/index

.. toctree::
:maxdepth: 1

install
publishing
changes
verification/index
83 changes: 0 additions & 83 deletions docs/dev/tech_notes/dft_sampling.rst

This file was deleted.

11 changes: 0 additions & 11 deletions docs/dev/tech_notes/index.rst

This file was deleted.

17 changes: 0 additions & 17 deletions docs/dev/tech_notes/prop_algorithm.rst

This file was deleted.

65 changes: 65 additions & 0 deletions docs/examples/bandpass_resampling.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
.. _examples.bandpass_resampling:

****************************
Bandpass and flux resampling
****************************

Resampling a bandpass
---------------------


Bandpass represented by arrays:

.. code:: python
wave = np.array([...])
bandpass = np.array([...])
wave_sampling = 5e-9 # wavelength sampling interval
start, stop = wave[0], wave[-1]
num = int(round(sto-start) / wave_sampling*1e9)
resampled_wave = np.linspace(start, stop, num)
resampled_bandpass = np.interp(resampled_wave, wave, bandpass)
Bandpass represented by a :class:`~lentil.radiometry.Spectrum` object:

.. code:: python
bandpass = lentil.Spectrum(...)
wave_sampling = 5e-9 # wavelength sampling interval
trim_tol = 1e-2 # relative tolerance used to clip off nearly zero ends
bandpass.trim(trim_tol)
start, stop = flux.wave[0], flux.wave[-1]
num = int(round(sto-start) / wave_sampling*1e9)
resampled_wave = np.linspace(start, stop, num)
resampled_bandpass = bandpass.sample(wave, waveunit=bandpass.waveunit)
Resampling and rebinning flux
-----------------------------
In this example, the flux is binned (instead of simply sampled) to preserve
its integrated power.

.. code:: python
flux = lentil.Spectrum(...)
wave_sampling = 5e-9 # wavelength sampling interval
trim_tol = 1e-2 # relative tolerance used to clip off nearly zero ends
flux.trim(ftrim_tol)
start, stop = flux.wave[0], flux.wave[-1]
num = int(round(sto-start) / wave_sampling*1e9)
wave = np.linspace(start, stop, num)
binned_flux = flux.bin(wave, waveunit=flux.waveunit)
28 changes: 22 additions & 6 deletions docs/examples/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,6 @@ Focal plane modeling

.. grid:: 3

.. grid-item-card::
:margin: 2 2 0 0

Including a detector model

.. grid-item-card::
:link: bayer
:link-type: doc
Expand Down Expand Up @@ -150,8 +145,29 @@ Advanced usage
radiometry
matlab_interface



.. _examples.patterns:

Useful patterns
===============

.. grid:: 3

.. grid-item-card::
:link: bandpass_resampling
:link-type: doc
:margin: 2 2 0 0

.. image:: /_static/img/spectrum_bin.png
:width: 175px
:align: center

Bandpass and flux resampling


.. toctree::
:caption: Useful patterns
:hidden:

bandpass_resampling

4 changes: 0 additions & 4 deletions docs/examples/matlab_interface.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ including it in a to-level subdirectory:
│ ├── detector_qe.csv
│ └── pupil_mask.npy
├── matlab/
│ ├── mat2ndarray.m
│ ├── ndarray2mat.m
│ └── tiny.m
├── docs/
├── scripts/
Expand All @@ -105,5 +103,3 @@ including it in a to-level subdirectory:
└── setup.py
Note the inclusion of ``mat2ndarray.m`` and ``ndarray2mat`` to handle
:ref:`data conversion between NumPy and MATLAB<numpy-matlab>`
4 changes: 2 additions & 2 deletions docs/user/advanced/extend.rst
Original file line number Diff line number Diff line change
Expand Up @@ -118,5 +118,5 @@ parent method's return type to preserve compatibility within Lentil.

.. _user.advanced.extend.tiltinterface:

Using TiltInterface
-------------------
.. Using TiltInterface
.. -------------------
Loading

0 comments on commit cb5f48b

Please sign in to comment.