4.1.1.1. diffractio.add_ons package

4.1.1.1.1. Submodules

4.1.1.1.2. diffractio.add_ons.angular_lens module

This module is related to FOCO project: development of Extended of Focus (EDOF) lenses

Articles and books:

  • K Uno and I. Shimizu “Dual Focus Diffractive Optical Element with Extended Depth of Focus” * OPTICAL REVIEW Vol. 21, No. 5 (2014) 668–675
    1. Sabathyan, M. Golbandi “Petal-like zone plate: long depth bifocal diffractive lens and star-like beam generator” Journal of the Optical Society of America A, 35(7) 1243 (20018)
class diffractio.add_ons.angular_lens.Angular_lens(x=None, y=None, wavelength=None, info='')[source]

Bases: diffractio.scalar_fields_XY.Scalar_field_XY

Generates examples for star lenses

angular_general(r0, radius, g, f_ini, f_end, num_periods=2, binarize=False, angle=0.0, mask=True)[source]
Transparent lens, from f_ini to f_end
focal=f_ini+(f_end-f_ini)*theta/(2*sp.pi)
Parameters:
  • r0 (float, float) – (x0,y0) - center of lens
  • radius (float, float) – radius of lens mask
  • g (function) – periodic function 2*pi in range (-1,1)
  • f_ini (float) – focal length of lens
  • f_end (float) – focal length of lens
  • num_periods (int) – num loops in a lens
  • angle (float) – angle of axis in radians
  • mask (bool) – if True, mask with size radius

Example

lens(r0=(0 * um, 0 * um), radius=(100 * um, 200 * um), focal=(5 * mm, 10 * mm), angle=0 * degrees, mask=True)

axilens(r0, radius, f_mean, f_incr, binarize=False, angle=0.0, mask=True)[source]
compute_beam_width(u_xy, z0, num_processors=16, has_draw=True, verbose=False)[source]

computes beam width for scalar_field_XY. Uses Rayleigh-Sommerfeld Approach

Parameters:
  • u_xy (scalar_field_XY) – field (u0*t) at a z=0 plane
  • z0 (numpy_array) – position z0
  • num_processors (int) – num processors for computation
  • has_draw (bool) – if True draws
  • verbose (bool) – if True returns data
daisy_lens(r0, radius, f_ini, f_end, num_periods=2, binarize=False, angle=0.0, mask=True)[source]
Transparent lens, from f_ini to f_end
focal=f_ini+(f_end-f_ini)*theta/(2*sp.pi)
Parameters:
  • r0 (float, float) – (x0,y0) - center of lens
  • radius (float, float) – radius of lens mask
  • f_ini (float) – focal length of lens
  • f_end (float) – focal length of lens
  • num_periods (int) – num loops in a lens
  • angle (float) – angle of axis in radians
  • mask (bool) – if True, mask with size radius

Example

lens(r0=(0 * um, 0 * um), radius=(100 * um, 200 * um), focal=(5 * mm, 10 * mm), angle=0 * degrees, mask=True)

dartboard_lens(r0, diameter, focal_min, focal_max, num_focals=4, num_sectors=4, has_random_focals=True, angle=0.0)[source]
dartboard_lens_weighted(r0, diameter, focals, num_sectors=4, has_random_focals=True)[source]
dual_focus_lens(r0, radius, f_ini, f_end, num_periods=2, binarize=False, angle=0.0, mask=True)[source]
lotus_lens(r0, radius, f_ini, f_end, num_periods=2, binarize=False, angle=0.0, mask=True)[source]
petal_lens(r0, radius, focal, N, alpha, binarize=False, angle=0.0, mask=True)[source]

Lens according to Sabatyan and Golbandi

References

  1. Sabathyan, M. Golbandi “Petal-like zone plate: long depth bifocal diffractive lens and star-like beam generator” Journal of the Optical Society of America A, 35(7) 1243 (20018)
Parameters:
  • r0 (float, float) – (x0,y0) - center of lens
  • radius (float, float) – radius of lens mask
  • focal (float) – focal length
  • N (float) – petal frequency
  • alpha (float) – focal length of lens
  • angle (float) – angle of axis in radians
  • mask (bool) – if True, mask with size radius

Example

lens(r0=(0 * um, 0 * um), radius=(100 * um, 200 * um), focal=(5 * mm, 10 * mm), angle=0 * degrees, mask=True)

trifocus_lens(r0, radius, f_mean, f_incr, num_periods, binarize=False, angle=0.0, power=3, mask=True)[source]

Lens with 3 focuses, defined as sin(N theta)**3

References

Luis Miguel Sanchez Brea

Parameters:
  • r0 (float, float) – (x0,y0) - center of lens
  • radius (float, float) – radius of lens mask
  • f_mean (float) – focal length
  • f_incr (float) – incr focal
  • binarize (bool) – binarizes
  • num_periods (int) – number of petals
  • angle (float) – angle of axis in radians
  • power (int) – odd number
  • mask (bool) – if True, mask with size radius

Example

lens(r0=(0 * um, 0 * um), radius=(100 * um, 200 * um), focal=(5 * mm, 10 * mm), angle=0 * degrees, mask=True)

diffractio.add_ons.angular_lens.focal_distribution_cubic(num_zones, focal, df, lambda1, lambda2, has_drawing=False)[source]
diffractio.add_ons.angular_lens.triangle_periodic(theta)[source]

4.1.1.1.3. diffractio.add_ons.gerchberg_saxton module

diffractio.add_ons.gerchberg_saxton.GS_Fresnel_algorithm(source, target, z, num_steps=5, has_draw=False)[source]

# TODO:

diffractio.add_ons.gerchberg_saxton.GS_Fresnel_algorithm_backup(source, target, z, is_binary, num_steps=5, has_draw=False)[source]

# TODO:

diffractio.add_ons.gerchberg_saxton.GS_algorithm(source, target, num_steps=11)[source]

# TODO:

diffractio.add_ons.gerchberg_saxton.Wyrowski_algorithm(source, target, num_steps=11)[source]

# TODO

diffractio.add_ons.gerchberg_saxton.compute_error(I_result, I_target)[source]

Computer the error as the average difference of the absolute value between of the intensity at target and the intensity at the result.

Parameters:
  • I_result (numpy.array) – intensity produced by the algorithms
  • I_target (numpy.array) – intentisty at target
  • is_balanced (bool) – If True, perform the comparison using a proportion parameter to avoid different intensity levels
Returns:

Mean difference between result and target.

Return type:

error

diffractio.add_ons.gerchberg_saxton.make_binary(mask)[source]

# TODO:

diffractio.add_ons.gerchberg_saxton.verify_mask(x, y, wavelength, filename, z, has_mask, is_phase, is_binary, has_draw=False, has_axis=False, is_logarithm=True)[source]

# TODO:

4.1.1.1.4. Module contents