Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
da2bfe3
Migrate to uv: add pyproject.toml, uv.lock, Makefile and CI updates, …
lbolla Jan 11, 2026
44577d0
ci: rerun workflows
lbolla Jan 11, 2026
e370a97
Merge remote-tracking branch 'origin/master' into feature/uv-migration
lbolla Jan 11, 2026
0facb27
ci: relax requires-python to >=3.10 and add 3.12 CI check
lbolla Jan 11, 2026
446df7f
chore: drop generated requirements files and update CI/Makefile for uv
lbolla Jan 11, 2026
ecb9e10
chore: remove legacy packaging (setup.py, setup.cfg, MANIFEST.in); mo…
lbolla Jan 11, 2026
4874f18
ci: install dev extras in uv venv so linters/tools are available
lbolla Jan 11, 2026
df3fffb
chore: remove legacy requirements references and update README to use uv
lbolla Jan 12, 2026
6dd12fc
chore: remove legacy requirements files
lbolla Jan 12, 2026
9b4faf9
chore: update .gitignore to ignore venvs, caches, egg-info and lockfile
lbolla Jan 12, 2026
3906845
chore: remove legacy setup.py and setup.cfg (moved to pyproject.toml)
lbolla Jan 12, 2026
ce11930
chore: remove tox.ini (uv manages test envs)
lbolla Jan 12, 2026
285ded5
chore: flake8 - ignore E501, E741, E203
lbolla Jan 12, 2026
a91a0a3
chore: uv migration — update configs and add .flake8; install dev extras
lbolla Jan 12, 2026
94981e0
ci: install dev extras into uv venv robustly for flake8
lbolla Jan 12, 2026
b25e5c2
ci: bootstrap pip in uv venv and robustly install dev extras
lbolla Jan 12, 2026
6aff54e
ci: ensure flake8 installed in uv venv as explicit fallback
lbolla Jan 12, 2026
831867f
ci: ensure mypy installed in uv venv
lbolla Jan 12, 2026
34c059b
ci: install all dev extras from pyproject (.[dev]) and keep explicit …
lbolla Jan 12, 2026
7203219
CI: install runtime deps from pyproject.toml into uv venv before tests
lbolla Jan 12, 2026
bb9f67d
CI: install runtime deps from pyproject (pip install .) inside uv venv
lbolla Jan 12, 2026
1dd1217
CI: test matrix include 3.10-3.12 (per request); note pyproject requi…
lbolla Jan 12, 2026
d743af1
chore: cleanup
lbolla Jan 12, 2026
90d0007
chore: add uv.lock and EMpy/version.py (reproducible env + version file)
lbolla Jan 12, 2026
6cff121
CI: rely on uv.lock + uv sync for deps; remove explicit pip installs
lbolla Jan 12, 2026
814b6b4
chore: fix deps
lbolla Jan 12, 2026
a833361
ci: simplify uv workflow
lbolla Jan 12, 2026
fb17c6f
ci: simplify release with uv
lbolla Jan 12, 2026
ad59d0d
ci: fix release
lbolla Jan 12, 2026
a1d724c
ci: uv-based pypi publishing
lbolla Jan 12, 2026
b256a6e
Release and publish in one workflow
lbolla Jan 17, 2026
06dd405
chore: run black, updated depencies, cleaned up Makefile
lbolla Jan 17, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[flake8]
max-line-length = 130
ignore = E203,E741,E501,W503,W292
35 changes: 35 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Release and Publish

on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Release on GitHub
uses: softprops/action-gh-release@v2
publish:
runs-on: ubuntu-latest
environment:
name: pypi
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v6

- name: Install uv and set the Python version
uses: astral-sh/setup-uv@v7
with:
python-version: '3.12'

- name: Build
run: uv build

- name: Publish
run: uv publish
36 changes: 0 additions & 36 deletions .github/workflows/pypi.yml

This file was deleted.

37 changes: 16 additions & 21 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# This workflow will install Python dependencies, run tests, and lint with a single version of Python
# For more information, see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python application

on:
Expand All @@ -17,29 +14,27 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
python-version: ["3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6

- name: Install uv and set the Python version
uses: astral-sh/setup-uv@v7
with:
python-version: "${{ matrix.python-version }}"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 mypy pytest
pip install -r requirements.txt
pip install --editable .
python-version: ${{ matrix.python-version }}

- name: Install the project
run: uv sync --locked --all-extras --dev

- name: Lint with flake8
run: |
flake8 EMpy tests examples scripts
run: uv run flake8 EMpy tests examples scripts

- name: Lint with pyflakes
run: |
pyflakes EMpy tests examples scripts
run: uv run pyflakes EMpy tests examples scripts

- name: Lint with mypy
run: |
mypy EMpy tests examples scripts
run: uv run mypy EMpy tests examples scripts

- name: Run tests
run: |
pytest
run: uv run pytest
15 changes: 0 additions & 15 deletions .github/workflows/release.yml

This file was deleted.

15 changes: 6 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
*.pyc
*.egg-info/
*.egg
.eggs/
.tox/
.vscode/
dist
*.egg-info
.mypy_cache
.venv
.vscode
build
.idea
.DS_Store
dist
__pycache__
44 changes: 32 additions & 12 deletions EMpy/RCWA.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
one, only stable for low diffraction orders and thin layers.

"""

__author__ = "Lorenzo Bolla"

import numpy as np
Expand Down Expand Up @@ -95,7 +96,6 @@ def dispersion_relation_extraordinary(kx, ky, k, nO, nE, c):


class RCWA:

"""Class to handle the RCWA solvers.

NOTE
Expand Down Expand Up @@ -168,7 +168,6 @@ def get_pitch(self):


class IsotropicRCWA(RCWA):

"""Isotropic RCWA solver."""

def solve(self, wls):
Expand Down Expand Up @@ -215,7 +214,11 @@ def solve(self, wls):
DE3 = np.zeros_like(DE1)

dirk1 = np.array(
[np.sin(alpha) * np.cos(delta), np.sin(alpha) * np.sin(delta), np.cos(alpha)]
[
np.sin(alpha) * np.cos(delta),
np.sin(alpha) * np.sin(delta),
np.cos(alpha),
]
)

# usefull matrices
Expand Down Expand Up @@ -323,7 +326,9 @@ def solve(self, wls):
# H_S_reduced = np.dot(Ky, Ky) + np.dot(Kx, linsolve(E, np.dot(Kx, E11))) - E11
H_S_reduced = (
(ky / k) ** 2 * I
+ kx[:, np.newaxis] / k * linsolve(E, kx[:, np.newaxis] / k * E11)
+ kx[:, np.newaxis]
/ k
* linsolve(E, kx[:, np.newaxis] / k * E11)
- E11
)

Expand Down Expand Up @@ -448,7 +453,6 @@ def __str__(self):


class AnisotropicRCWA(RCWA):

"""Anisotropic RCWA solver."""

def solve(self, wls):
Expand Down Expand Up @@ -487,14 +491,20 @@ def solve(self, wls):
# grating on the xy plane
K = 2 * pi / LAMBDA * np.array([np.sin(phi), 0.0, np.cos(phi)], dtype=complex)
dirk1 = np.array(
[np.sin(alpha) * np.cos(delta), np.sin(alpha) * np.sin(delta), np.cos(alpha)]
[
np.sin(alpha) * np.cos(delta),
np.sin(alpha) * np.sin(delta),
np.cos(alpha),
]
)

# D polarization vector
u = np.array(
[
np.cos(psi) * np.cos(alpha) * np.cos(delta) - np.sin(psi) * np.sin(delta),
np.cos(psi) * np.cos(alpha) * np.sin(delta) + np.sin(psi) * np.cos(delta),
np.cos(psi) * np.cos(alpha) * np.cos(delta)
- np.sin(psi) * np.sin(delta),
np.cos(psi) * np.cos(alpha) * np.sin(delta)
+ np.sin(psi) * np.cos(delta),
-np.cos(psi) * np.sin(alpha),
]
)
Expand Down Expand Up @@ -814,7 +824,11 @@ def solve(self, wls):
denom = (k1[2] - np.dot(u, k1) * u[2]).real
DEO1[:, iwl] = (
-(
(np.absolute(ROx) ** 2 + np.absolute(ROy) ** 2 + np.absolute(ROz) ** 2)
(
np.absolute(ROx) ** 2
+ np.absolute(ROy) ** 2
+ np.absolute(ROz) ** 2
)
* np.conj(kO1i[2, :])
- (ROx * kO1i[0, :] + ROy * kO1i[1, :] + ROz * kO1i[2, :])
* np.conj(ROz)
Expand All @@ -823,7 +837,11 @@ def solve(self, wls):
)
DEE1[:, iwl] = (
-(
(np.absolute(REx) ** 2 + np.absolute(REy) ** 2 + np.absolute(REz) ** 2)
(
np.absolute(REx) ** 2
+ np.absolute(REy) ** 2
+ np.absolute(REz) ** 2
)
* np.conj(kE1i[2, :])
- (REx * kE1i[0, :] + REy * kE1i[1, :] + REz * kE1i[2, :])
* np.conj(REz)
Expand All @@ -833,12 +851,14 @@ def solve(self, wls):
DEO3[:, iwl] = (
(np.absolute(TOx) ** 2 + np.absolute(TOy) ** 2 + np.absolute(TOz) ** 2)
* np.conj(kO3i[2, :])
- (TOx * kO3i[0, :] + TOy * kO3i[1, :] + TOz * kO3i[2, :]) * np.conj(TOz)
- (TOx * kO3i[0, :] + TOy * kO3i[1, :] + TOz * kO3i[2, :])
* np.conj(TOz)
).real / denom
DEE3[:, iwl] = (
(np.absolute(TEx) ** 2 + np.absolute(TEy) ** 2 + np.absolute(TEz) ** 2)
* np.conj(kE3i[2, :])
- (TEx * kE3i[0, :] + TEy * kE3i[1, :] + TEz * kE3i[2, :]) * np.conj(TEz)
- (TEx * kE3i[0, :] + TEy * kE3i[1, :] + TEz * kE3i[2, :])
* np.conj(TEz)
).real / denom

# save the results
Expand Down
1 change: 1 addition & 0 deletions EMpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
It is based on U{numpy<http://numpy.scipy.org>} and U{scipy<http://www.scipy.org>}.

"""

__all__ = [
"constants",
"devices",
Expand Down
Loading