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.1.tar.gz (10.5 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.1-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pynj-0.1.1.tar.gz
  • Upload date:
  • Size: 10.5 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.1.tar.gz
Algorithm Hash digest
SHA256 28fac30e51f53642e6ece81a6ae3603eb5b36ef6d2c9feef85ba546673b6aa42
MD5 284709bb1e6532ec34d1e2bb84d6d034
BLAKE2b-256 dc202e5ad22d43483a694f349c0daaa54c09c74e628c5d5369b19c6c19f24d62

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pynj-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 12.4 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 22684146c3713a2326a09fc14cda04e3f4814af5f90160977dd51e311a93b961
MD5 f21fe37cad8c009c72ea0c329c73af2f
BLAKE2b-256 5d902d882ad38c7d6cdadaad5a944e79bc42bde2fd03371a4ef3c59a8ffcab96

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