Skip to content

Commit

Permalink
update tests, docs, bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
phoebe-p committed Nov 19, 2023
1 parent fcf410e commit d961a8c
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 52 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
- name: Test with pytest
run: |
pip install pytest-cov pytest-rerunfailures
pytest --cov-report= --cov=rayflare tests/ --reruns 3
pytest --cov-report= --cov=rayflare tests/ --reruns 5
- name: Codecov
if: matrix.os == 'ubuntu-latest'
Expand Down
2 changes: 1 addition & 1 deletion docs/Installation/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ To do a normal installation from PyPI (using :literal:`pip`):
pip install setuptools wheel numba
pip install rayflare
This will install install the most recent version uploaded to PyPI (currently 1.2.0), which is not necessarily the most
This will install install the most recent version uploaded to PyPI (currently 1.2.1), which is not necessarily the most
up to date version.

To install RayFlare from source (GitHub):
Expand Down
7 changes: 5 additions & 2 deletions docs/Options/user_options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ rule, values with units of distance (wavelength, depth spacing) are in m while a
General options/options for matrix framework
---------------------------------------------

- **wavelengths**: wavelengths at which to carry out calculations (in m)
- **wavelength**: wavelengths at which to carry out calculations (in m)
- **theta_in**: polar angle of incident light (in radians)
- **phi_in**: azimuthal angle of incident light (in radians). If you are using the angular redistribution matrix framework,
you can also set this to 'all' to spread the incident light evenly over all the azimuthal bins
Expand All @@ -34,9 +34,12 @@ Options used only by RCWA (S4)
---------------------------------------------

- **A_per_order**: whether or not to calculate absorption per diffraction order (Boolean)
- **S4_options**: options which are passed to S4. See S4 documentation for details
- **S4_options**: options which are passed to S4. See S4 documentation for details. Note that these are
not used by Inkstone.
- **orders**: the number of Fourier orders to retain. The actual number of orders used may be different, depending on
the lattice truncation rule used.
- **RCWA_method**: 'Inkstone' or 'S4'. If 'Inkstone', the Inkstone RCWA implementation is used. If 'S4', the S4 RCWA implementation is used.
The default is S4. Note that this is not case-sensitive.


Options used only by the ray-tracer
Expand Down
12 changes: 12 additions & 0 deletions docs/news.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@ To update to the latest version of RayFlare, run the following command in your t
pip install rayflare --upgrade
Version 1.2.1 released (2023-11-19)
------------------------------------
**Highlights:**

- New RCWA method ([Inkstone](https://github.com/alexysong/inkstone) now intergrated with RayFlare.
This is an all-Python program which is therefore easy to install (unlike S4). This means all core u
functionality of RayFlare is now available without the need to compile anything on your computer.
Users can toggle between S4 and Inkstone by setting the ``RCWA_method`` option.
- Calculations with unpolarized light using RCWA should be faster now.
- The ``wavelengths`` user options is now called ``wavelength``, for compatibility with Solcore.
``wavelengths`` still works, but will be deprecated in future.

Version 1.2.0 released (2023-03-21)
------------------------------------

Expand Down
44 changes: 0 additions & 44 deletions rayflare/rigorous_coupled_wave_analysis/rcwa.py
Original file line number Diff line number Diff line change
Expand Up @@ -1321,50 +1321,6 @@ def get_fourier_epsilon(

return xs, ys, a_r, a_i

def get_fourier_epsilon_inkstone(
self, layer_index, wavelength, options, extent=None, n_points=200, plot=True
):
"""
Get the Fourier-decomposed epsilon scanning across x-y points for some layer in the structure for the number
of order specified in the options for the structure. Can also plot this automatically.
:param layer_index: index of the layer in which to get epsilon. layer 0 is the incidence medium, layer 1 is the first layer in the stack, etc.
:param wavelength: wavelength (in nm) at which to get epsilon
:param options: dictionary or State object containing user options
:param extent: range of x/y values in format [[x_min, x_max], [y_min, y_max]]. Default is 'None', will choose a reasonable area based \
on the unit cell size by default
:param n_points: number of points to scan across in the x and y directions
:param plot: plot the results (True or False, default True)
:return: xs, ys, a_r, a_i. The x points, y points, and the real and imaginary parts of the dielectric function.
"""

wl_ind = np.argmin(np.abs(self.current_wavelengths * 1e9 - wavelength))

S = self.make_S(options, wl_ind)

xs, ys, epsilon, mu = S.ReconstructLayer(f"layer_{layer_index + 1}", n_points, n_points)

# assume material is isotropic! top left entry of dielectric tensor
a_r = np.real(epsilon)[:, :, 0, 0]
a_i = np.imag(epsilon)[:, :, 0, 0]

if plot:
fig, axs = plt.subplots(1, 2, figsize=(7, 2.6))
im1 = axs[0].pcolormesh(xs, ys, a_r.T, cmap="magma")
fig.colorbar(im1, ax=axs[0])
axs[0].set_xlabel("x (nm)")
axs[0].set_ylabel("y (nm)")
axs[0].set_aspect(aspect=1)

im2 = axs[1].pcolormesh(xs, ys, a_i.T, cmap="magma")
fig.colorbar(im2, ax=axs[1])
axs[1].set_xlabel("x (nm)")
axs[1].set_ylabel("y (nm)")
axs[1].set_aspect(aspect=1)
plt.show()

return xs, ys, a_r, a_i

def get_fields(
self, layer_index, wavelength, options, extent=None, depth=1e-10, n_points=200, plot=True
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def gen_data_files(*dirs):

setup(
name="rayflare",
version="1.2.0",
version="1.2.1",
description="Python-based integrated optical modelling",
long_description=long_description,
long_description_content_typgie="text/markdown",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_errors.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import numpy as np
from pytest import raises, mark
from pytest import raises

def pol_error():
from rayflare.rigorous_coupled_wave_analysis.rcwa import process_pol
Expand Down
2 changes: 0 additions & 2 deletions tests/test_textures.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,6 @@ def test_hemisphere_cap_surface():

front, _ = hemisphere_surface(Lx, 101, Lx / 3, offset, 0, 1)

o_t_array = np.empty((4, 40))

normals = front.N
# radius of sphere with an offset:
# radius is Lx/3
Expand Down

0 comments on commit d961a8c

Please sign in to comment.