Skip to content

Add optional complex field output to coherent and Huygens PSF models - #118

Open
changlaplace wants to merge 1 commit into
vccimaging:mainfrom
changlaplace:feat/complex-psf-field
Open

Add optional complex field output to coherent and Huygens PSF models#118
changlaplace wants to merge 1 commit into
vccimaging:mainfrom
changlaplace:feat/complex-psf-field

Conversation

@changlaplace

Copy link
Copy Markdown

Motivation

DeepLens currently computes complex fields internally for both coherent PSF models, but only exposes the final intensity PSF. This prevents users from accessing sensor-plane phase information needed for coherent imaging tasks such as field propagation, interference, phase modulation, and custom wave-optics pipelines.

This PR exposes the already-computed sensor-plane field without introducing a new propagation path.

Changes

  • Add return_field=True support to:
    • model="coherent"
    • model="huygens"
  • Reuse the existing sensor_field in psf_pupil_prop().
  • Return an energy-normalized complex field:
    sum(abs(field) ** 2) ≈ 1.
  • Preserve the existing normalized intensity output when return_field=False.
  • Document that global phase depends on the optical-path reference, while relative phase remains meaningful.

Compatibility

return_field defaults to False, so existing calls and intensity outputs remain unchanged. No other PSF models or propagation implementations are modified.

Tests

Added focused coverage verifying that:

  • both coherent models return complex fields with the expected shape;
  • returned fields have unit energy;
  • abs(field) ** 2 matches the corresponding default intensity output;
  • coherent and Huygens intensity distributions are reasonably consistent under the same optical configuration.

@singer-yang

Copy link
Copy Markdown
Collaborator

Thank you! I will review it as soon as I have time!

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