Skip to content

Fixed NaNs in visualization of surface fields and adopted PyVista#190

Merged
vvahidd merged 9 commits into
gdsfactory:mainfrom
EpsilonForge:new_viz
Jul 14, 2026
Merged

Fixed NaNs in visualization of surface fields and adopted PyVista#190
vvahidd merged 9 commits into
gdsfactory:mainfrom
EpsilonForge:new_viz

Conversation

@mdmaas

@mdmaas mdmaas commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

This PR fixes visualization of surface fields, that were previously attempting to interpolate to a regular grid -- which resulted in NaNs (see Surface Currents plot at https://gdsfactory.github.io/gsim/nbs/palace_cpw_fields/).

Other plot types are also improved by replacing Matplotlib with PyVista and relying on native interpolation routines.

Screenshot from 2026-07-08 18-08-27 Screenshot from 2026-07-08 18-08-41 Screenshot from 2026-07-08 18-08-17

mdmaas added 2 commits July 6, 2026 18:20
…ield viz

- Add palace-toolkit as an optional dependency in pyproject.toml
- Create gsim.palace.runtime with resolve_palace_binary() that delegates to
  palacetoolkit when installed, with tiered PALACE_BIN/PATH fallback
- Wire resolver into PalaceSim.run_local (use_apptainer=False branch) with
  automatic LD_LIBRARY_PATH injection for bundled binaries
- Create gsim.palace.fields with NaN-free plot_boundary_field, plot_volume_slice,
  plot_volume_contours, load_boundary_field_data, build_selector_context
- Refactor gsim.viz: remove dead-code duplicates, clean up
- Update nbs/palace_cpw_fields.ipynb to use new NaN-free API throughout
- Add tests/palace/test_fields.py and tests/palace/test_runtime.py
- Update CHANGELOG.md with v0.0.17 entry
mdmaas added 5 commits July 9, 2026 13:50
- F401: Add missing field-viz symbols to __all__
- cp1252: Replace Unicode arrows with ASCII in fields.py
- E501: Wrap long lines in fields.py
- RUF002: Replace en-dashes with hyphens in docstrings
- RUF034: Simplify useless if-else in base.py
- S603/PLW1510: Add check=False to subprocess.run in runtime.py
- interrogate: Add docstrings for 100% coverage
- jupytext: Sync paired notebook files
- F821: Remove dead else branch referencing undefined exe_candidate in base.py
- F401: Add missing field-viz symbols to __all__ in __init__.py
- ARG001: Prefix unused fake_load_fields args with underscore
- PT019: Convert fixture params to @pytest.mark.usefixtures decorators
- S603: Suppress subprocess.run false positive in runtime.py
- RUF002: Replace en-dashes with hyphens in fields.py docstrings
- RUF034: Simplify useless if-else in base.py
- E501: Wrap long lines in fields.py
- cp1252: Replace Unicode arrows with ASCII in fields.py
- ty: Fix RunResult and MonkeyPatch.delitem type errors in tests
- interrogate: Add docstrings for 100% coverage
- jupytext: Sync paired notebook files
@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 65.56886% with 115 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.27%. Comparing base (1cf9e69) to head (f0e4b0f).
⚠️ Report is 12 commits behind head on main.

Files with missing lines Patch % Lines
src/gsim/palace/fields.py 68.99% 61 Missing and 19 partials ⚠️
src/gsim/palace/base.py 25.00% 17 Missing and 4 partials ⚠️
src/gsim/palace/runtime.py 69.56% 11 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #190      +/-   ##
==========================================
+ Coverage   60.73%   63.27%   +2.54%     
==========================================
  Files          65       67       +2     
  Lines        9665     9757      +92     
  Branches     1946     1970      +24     
==========================================
+ Hits         5870     6174     +304     
+ Misses       3131     2900     -231     
- Partials      664      683      +19     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mdmaas

mdmaas commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

Ok, tests seems to be passing now.

@vvahidd -- in the end I kept only palacetoolkit-palace-cpu which are linux binary wheels for palace, not the still small but larger Palace-Toolkit package which was causing dependency issues specially on Windows.

@vvahidd
vvahidd merged commit 2072246 into gdsfactory:main Jul 14, 2026
13 of 14 checks passed
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.

2 participants