Skip to content

feat: Vectorial EM field model support#90

Open
Erichhhhhcat wants to merge 1 commit into
rafael-fuente:mainfrom
Erichhhhhcat:feature/vectorial-em-field
Open

feat: Vectorial EM field model support#90
Erichhhhhcat wants to merge 1 commit into
rafael-fuente:mainfrom
Erichhhhhcat:feature/vectorial-em-field

Conversation

@Erichhhhhcat

Copy link
Copy Markdown

Summary

This PR implements the Vectorial EM field model as requested in issue #69.

Features added:

  1. JonesVector class: Represents polarization states using Jones calculus
  2. JonesMatrix class: For polarization transformations
  3. TransferMatrix class: Transfer matrix method integration
  4. VectorialMonochromaticField class: Main field class with vector representation
  5. Visualization additions: Stokes parameter plotting, polarization state map

/claim #69

Implement vectorial electromagnetic field modeling with the following features:
- JonesVector class for polarization representation (linear, circular, elliptical)
- JonesMatrix class for polarization transformations (polarizers, wave plates, rotators)
- TransferMatrix class for transfer matrix method integration
- VectorialMonochromaticField class supporting full vector field (Ex, Ey, Ez)
- Propagation methods for vectorial fields (angular spectrum, Fresnel, Bluestein)
- Stokes parameters computation and visualization
- Polarization state visualization

Supports integration with existing diffractsim propagation methods.
Erichhhhhcat added a commit to Erichhhhhcat/claude-agent-framework that referenced this pull request Feb 24, 2026
@cerredz

cerredz commented May 16, 2026

Copy link
Copy Markdown

I checked this branch locally. Since #69 is closed and the maintainer said the Algora bounty was accidental, I treated this as validation/helper feedback rather than a bounty claim.

I found a few concrete smoke-test blockers and opened a small helper PR against your branch: Erichhhhhcat#1

Issues found:

  • plot_polarization_map() and plot_field_components() import .util.backend_functions from inside diffractsim.visualization, which fails with ModuleNotFoundError: No module named 'diffractsim.visualization.util'; the import should go through ..util like the existing visualization modules.
  • VectorialMonochromaticField only attaches plot_stokes_parameters; the PR body advertises the polarization map and component plotting helpers, but they are not methods on the field object.
  • Right-circular Jones vectors initialize the field at 2x the requested intensity because the Jones vector is not normalized.
  • set_polarization(JonesVector.vertical()) on the default horizontal field zeroes out both Ex and Ey, so the field intensity becomes 0 instead of rotating polarization while preserving intensity.

Validation on the helper branch:

  • python -m pip install -e .
  • smoke test constructing VectorialMonochromaticField, initializing right-circular polarization, rotating to vertical polarization, and calling plot_polarization_map, plot_field_components, and plot_stokes_parameters with the Agg backend
  • python -m compileall -q diffractsim
  • git diff --check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants