Skip to content

Commit

Permalink
v2.0.0 major updates
Browse files Browse the repository at this point in the history
- **Speed improvements for all ray-tracing calculations**, by using numba jit (just-in-time) compilation of heavily-used
  functions, and more efficient lookup of TMM values for integrated ray-tracing/TMM calculations.
- **New analytical method for ray-tracing**, which is much faster than full ray-tracing and can be used with full
  accuracy for surfaces where the number of ray interactions is known exactly in advance (e.g. upright pyramids with
  opening angles between 45 and 54 degrees). Note that the calculation of absorption profiles in interface layers
  is not yet implemented for this method (though this is on the roadmap, as there is no fundamental reason this
  cannot be done). Absorption in bulk layers is calculated as usual if the analytical method is used. This option
  can be toggled on per surface in an rt_structure object.
- Refactored rt code into three separate files: rt_common (for function used for both ARRM and rt_structure calculations), rt_structure and rt_matrix.
- **Phong scattering**: a new option for the ray-tracer, which allows additional non-specular scattering. The continuum
  between perfectly specular and Lambertian scattering can be controlled with the Phong exponent.
- **Rigorous treatment of polarization in ray-tracing** (no changes to treatment of polarization in TMM and RCWA calculations).
- Option to set a maximum number of bulk passes for the ray-tracer using the maximum_passes option
- More detailed output from ray-tracing calculations, and re-organization of returns.
- Move to uv for install in GitHub actions instead of pip (faster)
- Schedule weekly test run on GitHub actions
- fix issues with examples in documentation
- new examples for new functionality
- lens_hyperhemisphere_rt parallelised over angles
- faster matrix multiplication for ARRM using einsum (thanks to Johnson Wong @arsonwong)
- default number of lookuptable angles changed from 300 to 200
- remove ability to set options.wavelengths (plural) instead of options.wavelength (next major version release deprecation)
- fix issue in TMM with zero thickness incoherent layers 
- move to state (options.option) rather than dictionary (options["option"]) notation in multiple files
- new process_pol function to process strings or list into (s, p) format
- new tests for new functionality
  • Loading branch information
phoebe-p authored Sep 23, 2024
1 parent fd08085 commit 7aad988
Show file tree
Hide file tree
Showing 106 changed files with 25,419 additions and 4,653 deletions.
51 changes: 22 additions & 29 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ on:

pull_request:

# everyday at 3 am UTC
# schedule:
# - cron: '0 3 * * *'
# weekly
schedule:
- cron: '3 7 * * 4'

jobs:
testing:
Expand Down Expand Up @@ -35,15 +35,16 @@ jobs:
sudo apt install -y python3-tk libboost-all-dev libopenblas-dev libfftw3-dev libsuitesparse-dev
# Do not need to do this if not installing S4
# - name: Install system dependencies in MacOS
# if: matrix.os == 'macos-latest'
# run: |
# brew install fftw suite-sparse openblas lapack boost
- name: Install system dependencies in MacOS
if: matrix.os == 'macos-latest'
run: |
brew install fftw suite-sparse openblas lapack boost
- name: Install python dependencies
run: |
python -m pip install --upgrade setuptools wheel pip
pip install .
python -m pip install uv
uv pip install --system .
uv pip install --system numpy wheel setuptools
- name: Install S4 in Linux
if: matrix.os == 'ubuntu-latest'
Expand All @@ -55,34 +56,26 @@ jobs:
rm -rf S4
# Not working as of March 2024. Cannot find cholmod.h header file. Reason unclear.
# - name: Install S4 in MacOS
# if: matrix.os == 'macos-latest'
# run: |
# git clone https://github.com/phoebe-p/S4
# cd S4
# make S4_pyext --file="Makefile.mac_intel"
# cd ..
# rm -rf S4

- name: Install on Linux and MacOS
if: matrix.os != 'windows-latest'
run: pip install .

- name: Install on Windows
if: matrix.os == 'windows-latest'
- name: Install S4 in MacOS
if: matrix.os == 'macos-latest'
run: |
pip install .
shell: powershell
git clone https://github.com/phoebe-p/S4
cd S4
make S4_pyext --file="Makefile.m1"
cd ..
rm -rf S4
- name: Test with pytest
env:
NUMBA_DISABLE_JIT: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12' && '1' || '0' }}
run: |
pip install pytest-cov pytest-rerunfailures
uv pip install --system pytest-cov pytest-rerunfailures
pytest --cov-report= --cov=rayflare tests/ --reruns 5
- name: Codecov
if: matrix.os == 'ubuntu-latest'
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: |
pip install codecov
uv pip install --system codecov
codecov
4 changes: 4 additions & 0 deletions docs/Analytic/analytic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ Analytical calculations

Analytic calculations relating to diffraction (i.e. not using S4).

###################################
Individual function documentation:
###################################

.. automodule:: rayflare.analytic.diffraction
:members:
:undoc-members:
Expand Down
Loading

0 comments on commit 7aad988

Please sign in to comment.