Skip to content

Commit

Permalink
feat(lib): implement Fresnel coefficients (#103)
Browse files Browse the repository at this point in the history
* feat(lib): implement Fresnel and UTD coefficients

* chore(docs): add some docstring

* fix(docs): typo

* feat(lib): better Fresnel integrals impl.

* fix(docs): rst syntax

* fix(docs): escaping '+' ?

* fix(docs): oops

* feat(lib): implement Fresnel coef.

* fix(docs): no :python: role :-(

* chore(tests): added more tests for transition function F

* chore(deps): bump jax to 0.4.32 for `jax.scipy.special.fresnel`

See jax-ml/jax#22843

* chore(lib): remove `differt.em.special` module

* chore(lib): do not enforce complex dtype

* wip

* chore(lib): add antenna module

* wip: radiation pattern

* chore(ci): antenna dipole

* wip: antenna stuff

* wip testing antennas

* fix(docs): typo

* fixes

* oops

* fix(docs): typo

* fmt and fixes

* chore(fmt): imports

* fix(lib): use `dict.setdefault` to allow overwriting shading

* wip: docs

* wip: example

* wip: docs

* fix(docs): bib ref.

* chore(docs): more example to function's docstring

* feat(lib): add utility to get sp-components

* chore(docs): re-order text

* chore(tests): add integration tests

* fix(deps): add ref to deps

* chore(tests): remove debugging NaNs

* fix(lib): `t` was not correctly typed

* chore(tests): mark integration tests as slow

* fix(docs): typo in docstring and more tests

* wip: sp directions

* fix(lib): remove `normalize` arg

* fix(docs): tmp

* fix(docs): fresnel example

* feat(lib): adding ITU materials

* wip: docs

* fix(tests): explicit dtype

* fix: remove file and update motivation

* fix(docs): typo

* fix(docs): quotes and alignment

* chore(docs): up

* chore(lib): postpone UTD for a feature PR

* chore(tests): add s and p rotation matrix (wip)

* wip: testing sp-rotation matrix

* wip: transition matrices

* chore(docs): finally include coverage map example

* chore(docs): cleanup
  • Loading branch information
jeertmans authored Jan 10, 2025
1 parent dadd31a commit b6e808c
Show file tree
Hide file tree
Showing 50 changed files with 24,689 additions and 20,836 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
uses: dtolnay/rust-toolchain@stable

- name: Run tests
run: uv run --python ${{ matrix.pyversion }} --frozen --no-dev --extra tests pytest
run: uv run --python ${{ matrix.pyversion }} --frozen --no-dev --extra tests-extended pytest

- name: Upload to codecov.io
uses: codecov/codecov-action@v5
Expand Down
2 changes: 1 addition & 1 deletion differt-core/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[build-system]
build-backend = "maturin"
requires = ["maturin>=1.3,<2.0"]
requires = ["maturin>=1.6,<2"]

[project]
authors = [
Expand Down
5 changes: 5 additions & 0 deletions differt/src/differt/conftest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import sys
from typing import Any

import chex
import jax
import jax.numpy as jnp
import matplotlib.pyplot as plt
Expand All @@ -14,6 +15,10 @@
collect_ignore_glob = ["*", "**/*"]


def pytest_configure() -> None:
chex.set_n_cpu_devices(8)


@pytest.fixture(autouse=True)
def add_doctest_modules(doctest_namespace: dict[str, Any]) -> None:
doctest_namespace["go"] = go
Expand Down
57 changes: 49 additions & 8 deletions differt/src/differt/em/__init__.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,59 @@
"""Electromagnetic fields utilities."""
"""Electromagnetic (EM) fields utilities."""

__all__ = (
"Antenna",
"BaseAntenna",
"Dipole",
"F",
"HWDipolePattern",
"InteractionType",
"L_i",
"Material",
"RadiationPattern",
"ShortDipole",
"ShortDipolePattern",
"c",
"diffraction_coefficients",
"epsilon_0",
"erf",
"erfc",
"fresnel",
"fresnel_coefficients",
"lengths_to_delays",
"materials",
"mu_0",
"path_delays",
"pointing_vector",
"reflection_coefficients",
"refraction_coefficients",
"refractive_indices",
"sp_directions",
"sp_rotation_matrix",
"transition_matrices",
"z_0",
)

from ._constants import c, epsilon_0, mu_0
from ._special import erf, erfc, fresnel
from ._utd import F
from ._utils import lengths_to_delays, path_delays
from ._antenna import (
Antenna,
BaseAntenna,
Dipole,
HWDipolePattern,
RadiationPattern,
ShortDipole,
ShortDipolePattern,
pointing_vector,
)
from ._constants import c, epsilon_0, mu_0, z_0
from ._fresnel import (
fresnel_coefficients,
reflection_coefficients,
refraction_coefficients,
refractive_indices,
)
from ._interaction_type import InteractionType
from ._material import Material, materials
from ._utd import F, L_i, diffraction_coefficients
from ._utils import (
lengths_to_delays,
path_delays,
sp_directions,
sp_rotation_matrix,
transition_matrices,
)
Loading

0 comments on commit b6e808c

Please sign in to comment.