Skip to main content

Time-reversal FDFD solver for photonic nanojet (PNJ) generation

Project description

PyNJ

A time-reversal FDFD solver for generating photonic nanojets (PNJ) with dielectric lenses.

Installation

pip install PyNJ

Quick start

from timereversal import Solver

solver = Solver(
    lambda0=532e-9,   # wavelength in meters
    n_bg=1.0,         # background refractive index
    n_lens=1.5,       # lens refractive index
    Lx=10e-6,         # simulation domain width (m)
    Ly=10e-6,         # simulation domain height (m)
    ppum=20,          # pixels per micrometer
    R_lens=2e-6,      # lens radius (m)
    x0_lens=0.0,      # lens center x (m)
    y0_lens=0.0,      # lens center y (m)
    shape="circle",   # lens shape
)

result = solver.solve(x=0.0, y=3.0)  # target PNJ position in micrometers

Lens shapes

The following shapes are supported via the shape parameter:

Shape Description
"circle" Circular lens
"square" Square lens
"superformula" Gielis superformula shape (parametric)
"triangle" Triangular SVG mask
"triangle_flipped" Flipped triangle
"triangle_rounded" Rounded triangle
"square_concave" Square with concave sides
"square_convex" Square with convex sides
"clepsidra" Hourglass shape
"clepsidra_flipped" Flipped hourglass
"clepsidra_rounded" Rounded hourglass
"hz" Arbitrary SVG mask (Hz mode)

Custom SVG masks can be loaded by passing svg_folder pointing to a directory of .svg files and setting shape to the filename stem.

Result fields

solver.solve() returns a SimulationResult dataclass with:

  • Hz, Ex, Ey — complex field arrays
  • Iz — normalised intensity |Hz|
  • x, y — coordinate axes (meters)
  • x_pnj, y_pnj — snapped PNJ target coordinates
  • entrance, src_line — aperture fields used for the time-reversed source
  • eps_r — permittivity map
  • i_pnj, j_pnj, j_src — grid indices

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pynj-0.1.0.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pynj-0.1.0-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file pynj-0.1.0.tar.gz.

File metadata

  • Download URL: pynj-0.1.0.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for pynj-0.1.0.tar.gz
Algorithm Hash digest
SHA256 01489b0c8cdc9ca6a28f45cea9d810db4db4b74f0ab5b4978133c78ce98e3667
MD5 dc6868d82e6e74328b34f79ef8b1b54e
BLAKE2b-256 db901bf08c3fe4cba7687552a4cf662caf7fad2ba9bb2bac65eab6ce6e2b4153

See more details on using hashes here.

File details

Details for the file pynj-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pynj-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for pynj-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6d3b548119c82e0a71d6db1bbd412e9ef9c2b8fd96dcb5500383359062eaa592
MD5 df045abff8b92d07dd2bbb67fa2a70ec
BLAKE2b-256 16765ddb0a8e9535df5df06f0fa61a14c4f0ba243d61c0ffd88afe7571f97959

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page