Skip to content

feat: callable API, energy_decay runner, viz refactors#17

Merged
vvahidd merged 10 commits into
mainfrom
feat/callable-api-and-refactors
Feb 18, 2026
Merged

feat: callable API, energy_decay runner, viz refactors#17
vvahidd merged 10 commits into
mainfrom
feat/callable-api-and-refactors

Conversation

@vvahidd

@vvahidd vvahidd commented Feb 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Callable API for MEEP modelsGeometry, ModeSource, Domain, FDTD now have __call__(**kwargs) enabling fluent configuration: sim.source(port="o1", wavelength=1.55) instead of field-by-field assignment
  • energy_decay stopping mode — Added to StoppingConfig and cloud runner script using mp.stop_when_energy_decayed() with a _make_time_cap() callable for OR-logic time caps
  • Shared helper extraction — Deduplicated Delaunay triangulation into viz/_mesh_helpers.py and layer classification into stack/_layer_utils.py (used by both PyVista/Open3D renderers and extractor/visualization)
  • Three.js backend removed — Deleted render3d_threejs.py + viewer.html; Open3D+Plotly gets view buttons (Iso/Top/Front/Right) and orthographic projection
  • Trimmed gsim.common exports — Public API reduced to essentials (Geometry, GeometryModel, LayerStack, Prism, ValidationResult)
  • Notebooks updatedmeep_ybranch converted to callable style; new meep_ring_coupler notebook added
  • meep-overview.md updated — Documents all architectural changes

Test plan

  • uv run pytest tests/meep/test_simulation.py tests/meep/test_meep_models.py -v — 141 pass
  • uv run pytest tests/ -v — 198 pass (1 pre-existing version assertion failure)
  • All pre-commit hooks pass (ruff format, ruff check, codespell, prettier)

- Add __call__(**kwargs) to Geometry, ModeSource, Domain, FDTD for
  fluent updates: sim.source(port="o1", wavelength=1.55)
- Add energy_decay stopping mode to StoppingConfig and cloud runner
  using mp.stop_when_energy_decayed() with _make_time_cap() callable
- Extract shared helpers: stack/_layer_utils.py (layer classification),
  viz/_mesh_helpers.py (Delaunay triangulation, batch prism geometry)
- Remove Three.js backend (render3d_threejs.py + viewer.html)
- Add view buttons (Iso/Top/Front/Right) to Open3D+Plotly 3D viewer
- Trim gsim.common public exports to essentials
- Update notebooks to callable style, add meep_ring_coupler notebook
- Update meep-overview.md with all architectural changes
… 95% threshold

Rename mode string "decay" → "field_decay" for clarity, switch default
from energy_decay to field_decay to match MEEP tutorial conventions,
and set decay_by default to 0.05 (95% decay).
@vvahidd
vvahidd marked this pull request as draft February 17, 2026 11:53
@vvahidd
vvahidd marked this pull request as ready for review February 17, 2026 11:54
stop_after(time) was ambiguous — unclear it meant "after sources die."
Renamed to stop_after_sources(time) for clarity.

Added wall_time_max field + stop_after_walltime(seconds) method as an
orthogonal wall-clock safety net. The runner appends _make_wall_time_cap()
to until_after_sources in all 4 stopping mode branches when enabled.
Logs a warning when the wall-clock limit likely triggered.
MEEP eigenmode coefficients are wrong when source and monitor overlap
at the same position (standard FDTD soft-source behavior). Match the
gplugins approach: offset source inward by 0.1um, source-port monitor
by 0.3um (0.2um past source), non-source monitors by 0.1um.

Also includes: refactor gcloud.py to use RunResult dataclass with
structured sim-data-{job_name}/ directories, update palace module
run() signatures, add meep_straight and meep_sbend notebooks, remove
stale meep-overview.md.
Use a matrix strategy to run each notebook on its own runner
simultaneously instead of sequentially. A list-notebooks job
discovers all .ipynb files, then run-notebook fans out in parallel
with fail-fast: false. The build job collects all artifacts via
merge-multiple before building docs.
@vvahidd
vvahidd merged commit de441f0 into main Feb 18, 2026
@vvahidd
vvahidd deleted the feat/callable-api-and-refactors branch February 18, 2026 11:39
vvahidd added a commit that referenced this pull request Feb 18, 2026
The write_config() cell was removed from palace notebooks in PR #17
but run() still required config.json to exist. Now run() automatically
generates config.json if it hasn't been written yet.
vvahidd added a commit that referenced this pull request Feb 18, 2026
* fix: remove bver dependency from dev recipe

The bver install script fails in CI because the GitHub release is
unavailable, breaking all notebook doc builds. bver is only needed
for version bumping, not dev environment setup.

* fix: auto-call write_config() in DrivenSim.run()

The write_config() cell was removed from palace notebooks in PR #17
but run() still required config.json to exist. Now run() automatically
generates config.json if it hasn't been written yet.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant