Skip to content

Commit

Permalink
Fixes to BasisLayer for apertures, removing python 3.9 from test matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisDesdoigts committed Sep 19, 2023
1 parent 29f75d1 commit 7dda828
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]
python-version: ["3.10", "3.11"]

steps:
- name: checkout
Expand Down
25 changes: 15 additions & 10 deletions dLux/layers/optical_layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,16 +228,21 @@ def __init__(
"""
super().__init__(**kwargs)

self.basis = np.asarray(basis, dtype=float)
if coefficients is None:
self.coefficients = np.zeros(self.basis.shape[:-2])
else:
self.coefficients = np.asarray(coefficients, dtype=float)
if self.basis.shape[:-2] != self.coefficients.shape:
raise ValueError(
"The number of basis vectors must be equal to "
"the number of coefficients."
)
if basis is not None:
basis = np.asarray(basis, dtype=float)
if coefficients is None:
coefficients = np.zeros(basis.shape[:-2])
else:
coefficients = np.asarray(coefficients, dtype=float)
if basis.shape[:-2] != coefficients.shape:
raise ValueError(
"The number of basis vectors must be equal to "
"the number of coefficients."
)

self.basis = basis
self.coefficients = coefficients

self.as_phase = bool(as_phase)

def eval_basis(self: OpticalLayer) -> Array:
Expand Down

0 comments on commit 7dda828

Please sign in to comment.