Skip to content

Commit

Permalink
make ipynb examples same in docs and examples folder, remove get_wave…
Browse files Browse the repository at this point in the history
…length everywhere
  • Loading branch information
phoebe-p committed Sep 23, 2024
1 parent c692277 commit 823eef4
Show file tree
Hide file tree
Showing 16 changed files with 2,738 additions and 1,189 deletions.
576 changes: 463 additions & 113 deletions examples/HIT_emissivity.ipynb

Large diffs are not rendered by default.

1,456 changes: 1,323 additions & 133 deletions examples/compare_models_3Jsolarcell.ipynb

Large diffs are not rendered by default.

291 changes: 109 additions & 182 deletions examples/compare_models_3Jsolarcell_profile.ipynb

Large diffs are not rendered by default.

151 changes: 86 additions & 65 deletions examples/create_rt_texture.ipynb

Large diffs are not rendered by default.

875 changes: 476 additions & 399 deletions examples/grating_pyramids_OPTOS.ipynb

Large diffs are not rendered by default.

277 changes: 136 additions & 141 deletions examples/rcwa_examples.ipynb

Large diffs are not rendered by default.

203 changes: 109 additions & 94 deletions examples/rcwa_tmm_validation.ipynb

Large diffs are not rendered by default.

63 changes: 31 additions & 32 deletions examples/rt_pyramids.ipynb

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions rayflare/matrix_formalism/multiply_matrices.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from solcore.state import State

from rayflare.structure import Interface, BulkLayer
from rayflare.utilities import get_savepath, get_wavelength
from rayflare.utilities import get_savepath

from rayflare import logger

Expand Down Expand Up @@ -322,8 +322,6 @@ def matrix_multiplication(
)
n_a_in = int(len(angle_vector) / 2)

get_wavelength(options)

num_wl = len(options["wavelength"])

# bulk thickness in m
Expand Down
4 changes: 1 addition & 3 deletions rayflare/matrix_formalism/process_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from rayflare.transfer_matrix_method import TMM
from rayflare.angles import make_angle_vector
from rayflare.matrix_formalism.ideal_cases import lambertian_matrix, mirror_matrix
from rayflare.utilities import get_savepath, get_wavelength
from rayflare.utilities import get_savepath
from rayflare import logger

def process_structure(SC, options, save_location="default", overwrite=False):
Expand All @@ -40,8 +40,6 @@ def process_structure(SC, options, save_location="default", overwrite=False):
if isinstance(options, dict):
options = State(options)

get_wavelength(options)

def determine_only_incidence(sd, j1, oia):
if sd == "front" and j1 == 0 and oia:
only_inc = True
Expand Down
2 changes: 0 additions & 2 deletions rayflare/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ def __init__(self):
self.random_ray_angles = False
self.n_rays = 10000
self.maximum_passes = 0
self.analytical_ray_tracing = False
self.analytical_threshold = 0.99

# TMM options
self.lookuptable_angles = 200
Expand Down
3 changes: 1 addition & 2 deletions rayflare/ray_tracing/rt_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from solcore.state import State
from numba import jit

from rayflare.utilities import get_savepath, get_wavelength
from rayflare.utilities import get_savepath
from rayflare.transfer_matrix_method.lookup_table import make_TMM_lookuptable
from rayflare import logger
from .analytical_rt import analytical_start, dummy_prop_rays
Expand Down Expand Up @@ -185,7 +185,6 @@ def calculate(self, options):
if isinstance(options, dict):
options = State(options)

get_wavelength(options)
wavelengths = options.wavelength
theta = options.theta_in
phi = options.phi_in
Expand Down
5 changes: 1 addition & 4 deletions rayflare/rigorous_coupled_wave_analysis/rcwa.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from solcore.absorption_calculator import OptiStack

from rayflare.angles import make_angle_vector, overall_bin
from rayflare.utilities import get_matrices_or_paths, get_wavelength, process_pol
from rayflare.utilities import get_matrices_or_paths, process_pol

from inkstone import Inkstone

Expand Down Expand Up @@ -937,7 +937,6 @@ def __init__(self, structure, size, options, incidence, transmission):

self.transmission = transmission
self.incidence = incidence
get_wavelength(options)
wavelengths = options.wavelength

geom_list = []
Expand Down Expand Up @@ -1084,7 +1083,6 @@ def calculate(self, options):
if isinstance(options, dict):
options = State(options)

get_wavelength(options)
wl = options.wavelength * 1e9

pol = process_pol(options.pol)
Expand Down Expand Up @@ -1178,7 +1176,6 @@ def calculate_profile(self, options):

parallel_func = {"s4": RCWA_wl_prof, "inkstone": RCWA_wl_prof_inkstone}

get_wavelength(options)
wl = options.wavelength * 1e9

pol = process_pol(options.pol)
Expand Down
2 changes: 0 additions & 2 deletions rayflare/transfer_matrix_method/lookup_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import xarray as xr
import numpy as np
from rayflare.transfer_matrix_method.tmm import tmm_structure
from rayflare.utilities import get_wavelength
import os
from solcore.absorption_calculator import OptiStack

Expand Down Expand Up @@ -59,7 +58,6 @@ def make_TMM_lookuptable(
logging.info("Existing lookup table found")
allres = xr.open_dataset(savepath)
else:
get_wavelength(options)
wavelengths = options["wavelength"]
n_angles = options["lookuptable_angles"]
thetas = np.linspace(0, (np.pi / 2) - 1e-3, n_angles)
Expand Down
3 changes: 1 addition & 2 deletions rayflare/transfer_matrix_method/tmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from solcore.state import State

from rayflare.angles import make_angle_vector, fold_phi
from rayflare.utilities import get_matrices_or_paths, get_wavelength
from rayflare.utilities import get_matrices_or_paths


def TMM(
Expand Down Expand Up @@ -596,7 +596,6 @@ def calculate_profile(layers, dist=None):
if isinstance(options, dict):
options = State(options)

get_wavelength(options)
wavelength = options.wavelength * 1e9
pol = options.pol
angle = options.theta_in
Expand Down
12 changes: 0 additions & 12 deletions rayflare/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ def make_absorption_function(result, structure, options):
from rayflare.ray_tracing import rt_structure
from rayflare.structure import Structure

get_wavelength(options)
# determine the type of structure to figure out how to process the result:

if isinstance(structure, Structure):
Expand Down Expand Up @@ -339,17 +338,6 @@ def get_savepath(save_location, project_name):
return structpath


def get_wavelength(options):
# wavelengths (plural) will be deprecated and should be wavelength (singular) instead,
# but this is to ensure backwards compatibility for the next few versions

if "wavelengths" in options:
options["wavelength"] = options["wavelengths"]
logger.warning(
"The option 'wavelengths' (plural) will be deprecated in the next major version. Please use 'wavelength' (singular) instead. "
"Currently, wavelengths (plural) will override wavelength (singular) if both are specified."
)

def process_pol(input_pol):
if len(input_pol) == 2:
pol = input_pol
Expand Down

0 comments on commit 823eef4

Please sign in to comment.