Simulation description¶
structures¶
structures contains the main struct object, structure generators and helper functions related to the generation of structure geometries.
structure definition class struct¶
- class pyGDM2.structures.struct(step, geometry, material, n1=None, n2=None, normalization='auto', n3=None, spacing=5000.0, auto_shift_structure=False, check_geometry_consistency=True, warn=True, verbose=True)¶
structure container
Defines a nanostructure to perform a GDM simulation on. This includes the geometry and the material-specific dielectric function(s) for each meshpoint
Note: This class works only with the new pure-python interface!
- Parameters:
step (float) – stepsize used for discretization
geometry (list of tuples) – list of coordinates of the meshpoints of the geometry. Several structure generators are provided in the module structures
material (instance of materials class or list of such) – use material classes provided by the materials module. If a single instance is provided, the according material will be used for the entire structure
normalization (str, default: 'auto') – set mesh-type. Either ‘auto’ (default), ‘cube’, or ‘hex’, or alternatively the numeric mesh normalization factor (float).
auto_shift_structure (bool, default: False) – whether to shift the structure to positive z values if structure or parts of it are below 0
check_geometry_consistency (bool, default: True) – whether to test geometry for consistency. If yes, inconsistent meshpoints will be removed and a warning will be produced
warn (bool, default: True) – show warnings if detection fails
verbose (int, default: 1) – 0: print nothing, 1: print some runtime info
- __init__(step, geometry, material, n1=None, n2=None, normalization='auto', n3=None, spacing=5000.0, auto_shift_structure=False, check_geometry_consistency=True, warn=True, verbose=True)¶
Initialization
- setDtype(dtypef, dtypec)¶
set dtype of arrays
- setWavelength(wavelength)¶
set wavelength and evaluate environment / structure properties
Structure generators¶
- pyGDM2.structures.rect_wire(step, L, H, W, mesh='cube', ORIENTATION=1)¶
Generate rectangular wire with long axis along X on X/Y plane
- Parameters:
step (float) – stepsize in nw
L (int) – Length, Height and Width as Nr. of steps
H (int) – Length, Height and Width as Nr. of steps
W (int) – Length, Height and Width as Nr. of steps
mesh (string, default: 'cube') – meshing type. ‘cube’ or ‘hex’
ORIENTATION (int, default: 1) – For hex. meshing only. ‘1’ or ‘2’. Orientation of Hexagons.
- Returns:
list of 3d coordinates in tuples (x,y,z)
- Return type:
list of tuples
- pyGDM2.structures.rect_dimer(step, L, H, W, G, mesh='cube', ORIENTATION=1)¶
Generate rectangular wire dimer with long axis along X on X/Y plane
Using rectwire model for generation of the two dimer particles.
Note : Using an even number gap will result in non-symmetric position with respect to (X=0,Y=0)
- Parameters:
step (float) – stepsize in nw
L (int) – Length, Height and Width as Nr. of steps
H (int) – Length, Height and Width as Nr. of steps
W (int) – Length, Height and Width as Nr. of steps
G (int (zero or positive)) – Gap between dimers, in Nr. of steps
mesh (string, default: 'cube') – meshing type. ‘cube’ or ‘hex’
ORIENTATION (int, default: 1) – For hex. meshing only. ‘1’ or ‘2’. Orientation of Hexagons.
- Returns:
list of 3d coordinates in tuples (x,y,z)
- Return type:
list of tuples
- pyGDM2.structures.prism(step, NSIDE, H, truncate_ratio=0.0, mesh='cube', ORIENTATION=1)¶
Generate prism on X/Y plane
- Parameters:
step (float) – stepsize in nw
NSIDE (int) – sidelength of regular prism (in nrs of dipoles)
H (int) – height of prism (in nrs of dipoles)
truncate_ratio (float) – truncate edges. give the ratio of total sidelength to remove. value between 0 [no truncation] and 1 [truncate at sidelength center]
mesh (string, default: 'cube') – meshing type. ‘cube’ or ‘hex’
ORIENTATION (int, default: 1) – For hex. meshing only. ‘1’ or ‘2’. Orientation of Hexagons.
- Returns:
list of 3d coordinates in tuples (x,y,z)
- Return type:
list of tuples
- pyGDM2.structures.rhombus(step, L, H, alpha=90.0, mesh='cube', ORIENTATION=1)¶
Generate planar rhombus structure on X/Y plane
- Parameters:
step (float) – stepsize in nw
L (int) – sidelength of regular prism (in nrs of dipoles)
H (int) – height of prism (in nrs of dipoles)
alpha (float, default: 90) – top/bottom angle of rhombus (in degrees)
mesh (string, default: 'cube') – meshing type. ‘cube’ or ‘hex’
ORIENTATION (int, default: 1) – For hex. meshing only. ‘1’ or ‘2’. Orientation of Hexagons.
- Returns:
list of 3d coordinates in tuples (x,y,z)
- Return type:
list of tuples
- pyGDM2.structures.hexagon(step, NSIDE, H, rotate=0.0, mesh='cube', ORIENTATION=1)¶
Generate regular hexagon on X/Y plane
- Parameters:
step (float) – stepsize in nw
NSIDE (int) – sidelength of regular hexagon (in nrs of dipoles)
H (int) – height of hexagon (in nrs of dipoles)
rotate (float, default: 0) – rotation angle (in degrees)
mesh (string, default: 'cube') – meshing type. ‘cube’ or ‘hex’
ORIENTATION (int, default: 1) – For hex. meshing only. ‘1’ or ‘2’. Orientation of Hexagons.
- Returns:
list of 3d coordinates in tuples (x,y,z)
- Return type:
list of tuples
- pyGDM2.structures.double_hexagon(step, NSIDE1, NSIDE2, DX, DY, H, rotate=0.0, mesh='cube', ORIENTATION=1)¶
Generate regular hexagon on X/Y plane
- Parameters:
step (float) – stepsize in nw
NSIDE1 (int) – sidelength of hexagon1 (in nrs of dipoles)
NSIDE2 (int) – sidelength of hexagon2 (in nrs of dipoles)
DX (int) – X-offset of hexagon2 (in nrs of dipoles)
DY (int) – Y-offset of hexagon2 (in nrs of dipoles)
H (int) – height of hexagon (in nrs of dipoles)
rotate (float, default: 0) – rotation angle (in degrees)
mesh (string, default: 'cube') – meshing type. ‘cube’ or ‘hex’
ORIENTATION (int, default: 1) – For hex. meshing only. ‘1’ or ‘2’. Orientation of Hexagons.
- Returns:
list of 3d coordinates in tuples (x,y,z)
- Return type:
list of tuples
- pyGDM2.structures.diabolo(step, nside_upper, nside_lower, length, width, H, dir_prisms='in', mesh='cube', ORIENTATION=1)¶
generate diabolo structure on X/Y plane
- Parameters:
step (float) – stepsize in nw
nside_upper (int) – sidelength of upper regular prism (in nrs of dipoles)
nside_lower (int) – sidelength of upper regular prism (in nrs of dipoles)
length (int) – length of bridge between prisms (in nrs of dipoles)
width (int) – width of bridge between prisms (in nrs of dipoles)
H (int) – height of prism (in nrs of dipoles)
dir_prisms (str, default="in") – “in” or “out”. Direction of prism tips, inwards or outwards.
mesh (string, default: 'cube') – meshing type. ‘cube’ or ‘hex’
ORIENTATION (int, default: 1) – For hex. meshing only. ‘1’ or ‘2’. Orientation of Hexagons.
- Returns:
list of 3d coordinates in tuples (x,y,z)
- Return type:
list of tuples
- pyGDM2.structures.polygon(step, config_dict, H, mesh='cube', ORIENTATION=1, plot_testing=False, verbose=False)¶
Generate polygonal, planar structure on X/Y plane
Can take a list of polygons, they can be either added or removed. The order of adding / removing polygons is important!
Requires module shapely.
- Parameters:
step (float) – stepsize in nm
config_dict (dict or list of dict) –
- every dictionary describes one polygon and contains the keywords:
N (mandatory): number of eges
S (mandatory): side length in units of step
offset: optional offset. tuple (X, Y). default: (0,0)
aspect: optional aspect ratio (X/Y). default: 1
alpha: optional rotation angle (in degrees). default: 0
- mode: optional. either ‘add’ or ‘remove’. Will either add the
polygon to the collection or remove it. default: ‘add’
H (int) – height of planar structure in units of steps
mesh (string, default: 'cube') – meshing type. ‘cube’ or ‘hex’
ORIENTATION (int, default: 1) – For hex. meshing only. ‘1’ or ‘2’. Orientation of Hexagons.
plot_testing (bool, default: False) – plot polygon outlines using matplotlib’s pyplot
verbose (bool, default: False) – print timing info
- Returns:
list of 3d coordinates in tuples (x,y,z)
- Return type:
list of tuples
- pyGDM2.structures.sphere(step, R, mesh='cube', ORIENTATION=1)¶
Generate sphere with radius R on X/Y plane
- Parameters:
step (float) – stepsize in nw
R (float) – radius of sphere (in nrs of dipoles). Not limited to integer numbers.
mesh (string, default: 'cube') – meshing type. ‘cube’ or ‘hex’
ORIENTATION (int, default: 1) – For hex. meshing only. ‘1’ or ‘2’. Orientation of Hexagons.
- Returns:
list of 3d coordinates in tuples (x,y,z)
- Return type:
list of tuples
- pyGDM2.structures.spheroid(step, R1, R2, R3, mesh='cube', ORIENTATION=1)¶
Generate spheroid with radii R1, R2, R3 along X, Y, Z axis
if R3>R2=R1 –> prolate spheroid
if R3<R2=R1 –> oblate spheroid
if R3=R2=R1 –> sphere
contributed by C. Majorel.
- Parameters:
step (float) – stepsize in nm
R1 (float) – radius along X axis (in nrs of steps). Not limited to integer numbers.
R2 (float) – radius along Y axis (in nrs of steps). Not limited to integer numbers.
R3 (float) – radiu along Z axis (in nrs of steps). Not limited to integer numbers.
mesh (string, default: 'cube') – meshing type. ‘cube’ or ‘hex’
ORIENTATION (int, default: 1) – For hex. meshing only. ‘1’ or ‘2’. Orientation of Hexagons.
- Returns:
list of 3d coordinates in tuples (x,y,z)
- Return type:
list of tuples
- pyGDM2.structures.nanodisc(step, R, H, ELONGATED=0, mesh='cube', ORIENTATION=1)¶
Generate round nanodisc in X/Y plane. Height H, Radius R.
- Parameters:
step (float) – stepsize in nw
R (float) – radius of circular crosssection (in nrs of dipoles). Not limited to integer numbers.
H (int) – Height of Structure (in nrs of dipoles).
ELONGATED (int, default: 0) – add optional elongation “bridge” between half-circles (in nrs of steps)
mesh (string, default: 'cube') – meshing type. ‘cube’ or ‘hex’
ORIENTATION (int, default: 1) – For hex. meshing only. ‘1’ or ‘2’. Orientation of Hexagons.
- Returns:
list of 3d coordinates in tuples (x,y,z)
- Return type:
list of tuples
- pyGDM2.structures.ellipse(step, R1, R2, H, mesh='cube', ORIENTATION=1)¶
Generate ellipse shape with constant height. radii R1, R2 along X, Y axis
- Parameters:
step (float) – stepsize in nm
R1 (float) – radius along X axis (in nrs of steps). Not limited to integer numbers.
R2 (float) – radius along Y axis (in nrs of steps). Not limited to integer numbers.
H (int) – height (Z axis) (in nrs of steps)
mesh (string, default: 'cube') – meshing type. ‘cube’ or ‘hex’
ORIENTATION (int, default: 1) – For hex. meshing only. ‘1’ or ‘2’. Orientation of Hexagons.
- Returns:
list of 3d coordinates in tuples (x,y,z)
- Return type:
list of tuples
- pyGDM2.structures.nanorod(step, L, R, caps='flat', mesh='cube', ORIENTATION=1)¶
Generate round nanorod with axis along X on X/Y plane
- Parameters:
step (float) – stepsize in nw
L (int) – length of rod (in nrs of dipoles).
R (float) – radius of circular crosssection (in nrs of dipoles). Not limited to integer numbers.
caps (str, default: 'flat') – ‘flat’: flat caps, ‘round’: semispherical caps
mesh (string, default: 'cube') – meshing type. ‘cube’ or ‘hex’
ORIENTATION (int, default: 1) – For hex. meshing only. ‘1’ or ‘2’. Orientation of Hexagons.
- Returns:
list of 3d coordinates in tuples (x,y,z)
- Return type:
list of tuples
- pyGDM2.structures.lshape_rect(step, L, W, H, DELTA, mesh='cube', ORIENTATION=1)¶
Generate symmetric L-shaped nanoantenna in X/Y plane formed by two rectangular elements.
- Parameters:
step (float) – stepsize in nw
L (int) – length,width,height of each rod (in nrs of dipoles)
W (int) – length,width,height of each rod (in nrs of dipoles)
H (int) – length,width,height of each rod (in nrs of dipoles)
DELTA (int (odd number)) – Gap width - only odd numbers work for symmetry reasons! (in nr of dipoles)
mesh (string, default: 'cube') – meshing type. ‘cube’ or ‘hex’
ORIENTATION (int, default: 1) – For hex. meshing only. ‘1’ or ‘2’. Orientation of Hexagons.
- Returns:
list of 3d coordinates in tuples (x,y,z)
- Return type:
list of tuples
- pyGDM2.structures.lshape_rect_nonsym(step, L1, W1, L2, W2, H, DELTA, mesh='cube', ORIENTATION=1)¶
Generate symmetric L-shaped nanoantenna in X/Y plane formed by two rectangular elements.
- Parameters:
step (float) – stepsize in nw
L (int) – length,width,height of each rod (in nrs of dipoles)
W (int) – length,width,height of each rod (in nrs of dipoles)
H (int) – length,width,height of each rod (in nrs of dipoles)
DELTA (int (odd number)) – Gap width - only odd numbers work for symmetry reasons! (in nr of dipoles)
mesh (string, default: 'cube') – meshing type. ‘cube’ or ‘hex’
ORIENTATION (int, default: 1) – For hex. meshing only. ‘1’ or ‘2’. Orientation of Hexagons.
- Returns:
list of 3d coordinates in tuples (x,y,z)
- Return type:
list of tuples
- pyGDM2.structures.lshape_round(step, L, W, H, DELTA, RAD, mesh='cube', ORIENTATION=1)¶
Generate symmetric L-shaped nanoantenna in X/Y plane formed by two rectangular elements.
- Parameters:
step (float) – stepsize in nm
L (int) – length,width,height of each rod (in nrs of dipoles)
W (int) – length,width,height of each rod (in nrs of dipoles)
H (int) – length,width,height of each rod (in nrs of dipoles)
DELTA (int (odd number)) – Gap width - only odd numbers work for symmetry reasons! (in nr of dipoles)
RAD (float) – radius of curvature in steps (nr of dipoles)
mesh (string, default: 'cube') – meshing type. ‘cube’ or ‘hex’
ORIENTATION (int, default: 1) – For hex. meshing only. ‘1’ or ‘2’. Orientation of Hexagons.
- Returns:
list of 3d coordinates in tuples (x,y,z)
- Return type:
list of tuples
- pyGDM2.structures.split_ring(step, R, W, H, G=-1, alphaG=0.0, mesh='cube', ORIENTATION=1)¶
Generate splitring structure on X/Y plane
If G (gap) is set: close the resonator up to “gap” (G=)
- Parameters:
step (float) – stepsize in nw
R (int,int,int) – Dimensions: Radius, linewidth and height of structure (in nr. of dipoles)
W (int,int,int) – Dimensions: Radius, linewidth and height of structure (in nr. of dipoles)
H (int,int,int) – Dimensions: Radius, linewidth and height of structure (in nr. of dipoles)
G ((optional) int, default: -1) – Gap width in numbers of steps. If G == -1, alphaG is taken instead
alphaG ((optional) float, default: 0) – Gap width as angle in degrees. Allowed angles: Between 0 and 180. ‘0’: entirely closed
mesh (string, default: 'cube') – meshing type. ‘cube’ or ‘hex’
ORIENTATION (int, default: 1) – For hex. meshing only. ‘1’ or ‘2’. Orientation of Hexagons.
- Returns:
list of 3d coordinates in tuples (x,y,z)
- Return type:
list of tuples
- pyGDM2.structures.rect_split_ring(step, L1, L2, H, W, G=False, mesh='cube', ORIENTATION=1)¶
Generate rectangular splitring structure on X/Y plane
If G (gap) is set: close the resonator up to “gap” (G=)
- Parameters:
step (float) – stepsize in nw
L1 (int) – Length (L1:X,L2:Y), Height and Width in Nr. of steps
L2 (int) – Length (L1:X,L2:Y), Height and Width in Nr. of steps
H (int) – Length (L1:X,L2:Y), Height and Width in Nr. of steps
W (int) – Length (L1:X,L2:Y), Height and Width in Nr. of steps
G ((optional) int, default: False) –
- Gap of a closed splitring.
If False: totally open splitring, If ‘0’: entirely closed
mesh (string, default: 'cube') – meshing type. ‘cube’ or ‘hex’
ORIENTATION (int, default: 1) – For hex. meshing only. ‘1’ or ‘2’. Orientation of Hexagons.
- Returns:
list of 3d coordinates in tuples (x,y,z)
- Return type:
list of tuples
Mesher¶
- pyGDM2.structures._meshCubic(XRANGE, YRANGE, ZRANGE, condition, Z_offset=0.5)¶
mesh on a cubic grid
Mesh a 3d structure on a cubic grid within given spacial limits using a boolean selection function
- Parameters:
XRANGE (tuple) – tuple of 2 ints (x0, x1): Indices of x-coordinates on mesh
YRANGE (tuple) – tuple of 2 ints (y0, y1): Indices of y-coordinates on mesh
ZRANGE (tuple) – tuple of 2 ints (z0, z1): Indices of z-coordinates on mesh
condition (function) – function of mesh-coord.-indices, whether to place a meshpoint or not: ‘func(xi,yi,zi)’, must returns a Boolean
Z_offset (float, default: 0.5) – additional z-offset, to avoid placing dipoles at z=0
- Returns:
list of 3d coordinate-index tuples
- Return type:
list of tuples
- pyGDM2.structures._meshHexagonalCompact(XRANGE, YRANGE, ZRANGE, condition, ORIENTATION=1, Z_offset=0.5, auto_expand_range=True)¶
mesh on a hexagonal compact grid
- Parameters:
XRANGE (tuple) – tuple of 2 ints (x0, x1): Indices of x-coordinates on mesh
YRANGE (tuple) – tuple of 2 ints (y0, y1): Indices of y-coordinates on mesh
ZRANGE (tuple) – tuple of 2 ints (z0, z1): Indices of z-coordinates on mesh
condition (function) – function of mesh-coord.-indices, whether to place a meshpoint or not: ‘func(xi,yi,zi)’, must returns a Boolean
ORIENTATION (int, default: 1) – For hex. meshing only. ‘1’ or ‘2’. Orientation of Hexagons.
Z_offset (float, default: 0.5) – additional z-offset, to avoid placing dipoles at z=0
auto_expand_range (bool, default: True) – automatically expand meshing range in order to account for denser than cubic meshing
- Returns:
list of 3d coordinate-index tuples
- Return type:
list of tuples
Other functions¶
- pyGDM2.structures.image_to_struct(img_name, nm_per_pixel, stepsize, H, threshold=100, useDarkPixel=True, returnImage=False, center_structure=True, mesh='cube', ORIENTATION=1)¶
Convert an image to a planar structure
Might be useful with SEM images
- Parameters:
img_name (string or numpy array) – path to image-file or numpy array containing image. Array values should range from 0 to 255.
nm_per_pixel (float) – number of nanometers corresponding to one pixel in image
stepsize (float) – target stepsize
H (int) – Height of final structure in numbers of stepsize
threshold (float, (default: 100)) – threshold value between [0, 255] to declare a pixel as structure all brighter pixels will be used
useDarkPixel (bool, default: True) – if False, use bright pixels as structure (below threshold), instead of the dark ones
returnImage (bool, default: False) – if True, returns a 2D numpy array corresponding to the image AND the structure
center_structure (bool, default: True) – whether to automatically center structure
mesh (string, default: 'cube') – meshing type. ‘cube’ or ‘hex’
ORIENTATION (int, default: 1) – For hexagonal meshing only. ‘1’ or ‘2’. Orientation of Hexagons.
- Returns:
struct (list of tuples) – list of 3d coordinates in tuples (x,y,z)
if returnImage==True – returns tuple: (img_array, struct)
- pyGDM2.structures.struct_to_image(STRUCT, RGB=True, minimum_size=-1, center_struct='half', projection='XY')¶
generate image-compatible array from structure geometry
- Parameters:
struct (list of tuple or
core.simulation
) – list of coordinate tuples or instance ofcore.simulation
RGB (bool, default: True) – If True, generates an RGB array. If False, generate a 2D array with simply 0 and 1 as entries (0: no material, 1: material)
minimum_size (int, default: -1) – minimum canvas size in pixels. -1: use structure extensions. absolute position will be lost! If >0: enlarge canvas and center structure if structure extensions smaller than image.
center_struct (str, default: 'half') – Has no effect if minimum_size==-1. how to place structure in canvas. ‘half’: origin (0,0) is at half x/y. ‘auto’: center structure relative to image. absolute position will be lost!
projection (str, default: "XY") – 2D plane for projection. One of [‘XY’, ‘XZ’, ‘YZ’]
- Returns:
np.array for image conisting of rgb tuples for each pixel.
Plot e.g. using matplotlib’s imshow.
Save to bitmap or png file e.g. using scipy.misc.imsave.
- pyGDM2.structures.get_normalization(mesh)¶
Provide normalization factor for mesh type
- Parameters:
mesh (string) – mesh used for structure generator
- Returns:
normalization – normalization factor corresponding to mesh
- Return type:
float
- pyGDM2.structures.center_struct(STRUCT, which_axis=['x', 'y'], returnOffsets=False)¶
Center a structure on the x/y plane around (0,0)
- Parameters:
STRUCT (list of tuples, or struct-object or simulation-class) – list of (x,y,z) coordinate tuples, as generated by the functions of the structure module; or struct or simulation object (which includes the geometry information)
which_axis (list of str, default: ['x', 'y']) – on which axis to center the structure.
returnOffsets (bool, default: False) – if True, return tuple of applied (X,Y)-offset together with structure
- Returns:
list of 3d coordinates as tuples (x,y,z); or struct or – simulation object with adapted geometry.
- optionally (Offset-tuple as second return value)
- pyGDM2.structures.rotate_XY(STRUCT, ALPHA)¶
Rotate a structure around the z axis
see
rotate()
for full documentation
materials¶
materials is a collection of classes defining the dispersion of materials.
fromFile class¶
- class pyGDM2.materials.fromFile(refindex_file, unit_wl='micron', interpolate_order=1, name=None)¶
tabulated dispersion
Use tabulated data provided from textfile for the complex material refractive index
- Parameters:
refindex_file (str) –
path to text-file with the tabulated refractive index (3 whitespace separated columns: #1 wavelength, #2 real(n), #3 imag(n))
alternatively: numpy nd array with dispersion. ndarray dim must be: (Nwl, 3)
Data can be obtained e.g. from https://refractiveindex.info/ using the “Full database record” export function.
unit_wl (str, default: 'micron') – Units of the wavelength in file, one of [‘micron’, ‘nm’]
interpolate_order (int, default: 1) – interpolation order for data (1: linear, 2: square, 3: cubic) “1” uses numpy.interp, “2” and “3” require scipy (using scipy.interpolate.interp1d)
name (str, default: None) – optional name attribute for material class. By default use filename.
- __init__(refindex_file, unit_wl='micron', interpolate_order=1, name=None)¶
Use tabulated dispersion
- epsilon(wavelength)¶
Tabulated interpolated dielectric function
constant dielectric function material
- Parameters:
wavelength (real) – wavelength at which to evaluate dielectric function (in nm)
Predefined materials¶
- class pyGDM2.materials.dummy(n=2 + 0j)¶
constant refractive index
Material with spectrally constant refractive index
- Parameters:
n (complex, default: (2.0 + 0.0j)) – complex refractive index of constant material (returned dielectric function will be n**2)
- class pyGDM2.materials.gold(interpolate_order=1)¶
gold permittivity
Complex dielectric function of gold from: P. B. Johnson and R. W. Christy. Optical Constants of the Noble Metals, Phys. Rev. B 6, 4370-4379 (1972)
- Parameters:
interpolate_order (int, default: 1) – interpolation order for data (1: linear, 2: square, 3: cubic) “1” uses numpy, “2” and “3” require scipy (scipy.interpolate.interp1d)
- class pyGDM2.materials.silver(interpolate_order=1)¶
silver permittivity
Complex dielectric function of silver from: P. B. Johnson and R. W. Christy. Optical Constants of the Noble Metals, Phys. Rev. B 6, 4370-4379 (1972)
- Parameters:
interpolate_order (int, default: 1) – interpolation order for data (1: linear, 2: square, 3: cubic) “1” uses numpy, “2” and “3” require scipy (scipy.interpolate.interp1d)
- class pyGDM2.materials.alu(interpolate_order=1)¶
aluminium permittivity
Complex dielectric function of aluminium from: A. D. Rakić, A. B. Djurišic, J. M. Elazar, and M. L. Majewski. Optical properties of metallic films for vertical-cavity optoelectronic devices, Appl. Opt. 37, 5271-5283 (1998)
- Parameters:
interpolate_order (int, default: 1) – interpolation order for data (1: linear, 2: square, 3: cubic) “1” uses numpy, “2” and “3” require scipy (scipy.interpolate.interp1d)
- class pyGDM2.materials.silicon(interpolate_order=1)¶
silicon permittivity
Complex dielectric function of silicon from: Edwards, D. F. in Handbook of Optical Constants of Solids (ed. Palik, E. D.) 547–569 (Academic Press, 1997).
- Parameters:
interpolate_order (int, default: 1) – interpolation order for data (1: linear, 2: square, 3: cubic) “1” uses numpy, “2” and “3” require scipy (scipy.interpolate.interp1d)
- class pyGDM2.materials.sio2(interpolate_order=1)¶
SiO2 permittivity
Contributed by C. Majorel
- Complex dielectric function for SiO2 from:
- range 210nm –> 6700nm :
I. H. Malitson. Interspecimen comparison of the refractive index of fused silica, J. Opt. Soc. Am. 55, 1205-1208 (1965)
- range 7000nm –> 50000nm :
S. Popova, T. Tolstykh, V. Vorobev. Optical characteristics of amorphous quartz in the 1400–200 cm-1 region, Opt. Spectrosc. 33, 444–445 (1972)
- Parameters:
interpolate_order (int, default: 1) – interpolation order for data (1: linear, 2: square, 3: cubic) “1” uses numpy, “2” and “3” require scipy (scipy.interpolate.interp1d)
- class pyGDM2.materials.tio2(orientation='avg')¶
TiO2 permittivity
model for visible and NIR range (~500nm - ~1500nm) from https://refractiveindex.info/?shelf=main&book=TiO2&page=Devore-o
Thanks to Dr. Frank Mersch (Kronos International) for help
- Parameters:
orientation (str, default: 'avg') –
‘avg’ (or ‘mean’): average of n_o and n_e: n = (2*n_o + n_e) / 3
’n_o’ : ordinary axis permittivity
’n_e’ : extra-ordinary axis permittivity
’tensor’: x,y: ordinary axes; z: extraordinary axis
- class pyGDM2.materials.hyperdopedConstantDielectric(n, N_dop, factor_gamma=0.1, act_eff=1.0, carrier='electron')¶
hyperdoped material with constant ref.index + dopant plasmon resonance
- Parameters:
n (complex) – constant complex refractive index
N_dop (float) – Dopant density (cm^-3)
factor_gamma (float. default: 0.1) – ratio damping term and plasmon frequency. The default of 0.1 is chosen arbitrarily, resulting in some reasonably broad resonances. The correct value must be obtained experimentally.
carrier (string, default: 'electron') – carrier type. ‘electron’ or ‘hole’
act_eff (float) – Activation efficiency of dopants, value between 0 and 1. (0=0%, 1=100% activated dopants; the latter being the default behavior)
Notes
For details about the theory and for a discussion on how to choose a value for the damping term, see:
[1] C. Majorel et al. “Theory of plasmonic properties of hyper-doped silicon nanostructures”. Optics Communications 453, 124336 (2019). URL https://doi.org/10.1016/j.optcom.2019.124336
- class pyGDM2.materials.hyperdopedFromFile(refindex_file, Ndop, k_mass, damping, unit_wl='micron', interpolate_order=1, name=None)¶
Add doping-induced plasmon response to tabulated dielectric permittivity
- Parameters:
refindex_file (str) – path to text-file with the tabulated refractive index (3 whitespace separated columns: #1 wavelength, #2 real(n), #3 imag(n)) Data can be obtained e.g. from https://refractiveindex.info/ using the “Full database record” export function.
Ndop (float) – Dopant density (cm^-3)
damping (float) – damping term (s^-1). See [1] for a discussion on how to choose the damping.
k_mass (float) – ratio between the mass of the electron and the effective mass in the material
unit_wl (str, default: 'micron') – Units of the wavelength in file, one of [‘micron’, ‘nm’]
interpolate_order (int, default: 1) – interpolation order for data (1: linear, 2: square, 3: cubic) “1” uses numpy.interp, “2” and “3” require scipy (using scipy.interpolate.interp1d)
name (str, default: None) – optional name attribute for material class. By default use filename.
Notes
For details about the theory and for a discussion on how to choose a value for the damping term, see:
[1] C. Majorel et al. “Theory of plasmonic properties of hyper-doped silicon nanostructures”. Optics Communications 453, 124336 (2019). URL https://doi.org/10.1016/j.optcom.2019.124336
- class pyGDM2.materials.hyperdopedSilicon(N_dop, factor_gamma=0.1, act_eff=1.0, carrier='electron')¶
hyperdoped silicon with plasmon resonance
Complex dielectric function of silicon (<1770nm) from: Edwards, D. F. in Handbook of Optical Constants of Solids (ed. Palik, E. D.) 547–569 (Academic Press, 1997).
and range 1770nm –> 22220 nm :
- Parameters:
N_dop (float) – Dopant density (cm^-3)
factor_gamma (float, default: 0.1) – ratio damping term and plasmon frequency. The default of 0.1 is an arbitrary resulting in some reasonably broad resonances. The correct value must be obtained experimentally.
carrier (string, default: 'electron') – carrier type. ‘electron’ or ‘hole’
act_eff (float , default: 1) – Activation efficiency of dopants, value between 0 and 1. (0=0%, 1=100% activated dopants; the latter being the default behavior)
Notes
See also: [1] D. Chandler-Horowitz and P. M. Amirtharaj. “High-accuracy, midinfrared refractive index values of silicon”. J. Appl. Phys. 97, 123526 (2005). URL https://doi.org/10.1063/1.1923612
[2] C. Majorel et al. “Theory of plasmonic properties of hyper-doped silicon nanostructures”. Optics Communications 453, 124336 (2019). URL https://doi.org/10.1016/j.optcom.2019.124336
fields¶
fields contains the main efield object and field-generator functions for frequently used fundamental fields.
Incident electro-magnetic field class efield¶
- class pyGDM2.fields.efield(field_generator, wavelengths, kwargs)¶
incident electromagnetic field container class
Defines an incident electric field including information about wavelengths, polarizations, focal spot or whatever optional parameter is supported by the used field generator.
- Parameters:
field_generator (callable) –
- field generator function. Mandatory arguments are
struct (instance of
structures.struct
)wavelength (list of wavelengths)
wavelengths (list) – list of wavelengths (wavelengths in nm)
kwargs (list of dict or dict) –
possible additional keyword arguments, passed to field_generator. Either dict or list of dicts.
If list of dicts, each entry must correspond exactly to one parameters-set for field-generator.
If dict, maybe contain lists for configurations of the parameters. In that case, all possible parameter-permutations will be generated.
Examples
>>> kwargs = dict(theta = [0.0,45,90]) [{'theta': 0.0}, {'theta': 45.0}, {'theta': 90.0}]
is equivalent to:
>>> kwargs = [dict(theta=0.0), dict(theta=45.0), dict(theta=90.0)] [{'theta': 0.0}, {'theta': 45.0}, {'theta': 90.0}]
- __init__(field_generator, wavelengths, kwargs)¶
initialize field container
- setDtype(dtypef, dtypec)¶
set dtype of arrays
field generators¶
- pyGDM2.fields.plane_wave(pos, env_dict, wavelength, inc_angle=180, inc_plane='xz', theta=None, E_s=0.0, E_p=1.0, phase_Es=0.0, phase=0.0, returnField='E')¶
generalized incident planewave
supports oblique angles, arbitrary polarization states, 2 interfaces. Default config gives incident plane wave from top (z), linear polarized along x, with amplitude 1
Original code by Ch. Girard, python implementation by C. Majorel
- Parameters:
pos (np.array) – list of 3-tuple coordinates to evaluate field at: [[x1,y1,z1], [x2,y2,z2], … ]
env_dict (dict) – Must be compatible with sim.dyads.getConfigDictG typed numba dict. description of environment. Must contain [‘eps1’, ‘eps2’, ‘eps3’, ‘spacing’].
wavelength (float) – Wavelength in nm
inc_angle (float, default: 180) –
- incident angle with respect to e_z, in degrees. Default is inc from top.
0deg = along Z (from neg to pos Z)
90deg = along X [‘xz’], along Y [‘yz’] (from pos to neg)
180deg = along Z (from pos to neg Z)
270deg = along X [‘xz’], along Y [‘yz’] (from neg to pos)
inc_plane (str, default: 'xz') – plane of incidence, one of [‘xz’, ‘yz’]
theta (float, default: None) – alternative specification for a linear polarization angle. If given, this will override E_s and E_p as well as their respective phases. In degrees. At normal incidence: 0deg = OX, 90deg = OY. If `inc_plane`==’xz’: 0deg –> p-polarization; 90deg –> s-polarization (inverse for `inc_plane`==’yz’)
- E_s, E_pfloat, default: 0.0, 1.0
Apmplitudes of s-polarized and p-polarized plane wave components. At 0 / 180 degrees incident angle (normal incindence), ‘p’ is polarized along x, ‘s’ along y. Then, at 90deg ‘p’ is along z.
- phase_Esfloat, default: 0.0
additional phase for E_s component (in rad). Can be used to generate elliptic polarization. For instance, left circular polarization (LCP) can be obtained with: E_s=np.sqrt(0.5), E_p=np.sqrt(0.5), phase_Es=-np.pi/2. RCP: phase_Es=+np.pi/2.
- phasefloat, default: 0.0
additional absolute phase for entire plane wave (in rad).
- returnFieldstr, default: ‘E’
if ‘E’: returns electric field; if ‘B’ or ‘H’: magnetic field
- Returns:
E0 (B0) – list of (complex) 3-tuples: [(Ex1, Ey1, Ez1), …]
- Return type:
Complex E-(B-)Field at each dipole position as
- pyGDM2.fields.gaussian(pos, env_dict, wavelength, theta=None, polarization_state=None, xSpot=0.0, ySpot=0.0, zSpot=0.0, NA=-1.0, spotsize=-1.0, kSign=-1.0, paraxial=False, phase=0.0, E0=1 + 0j, returnField='E')¶
Simple, normal incident (along Z) focused Gaussian Beam Field
For more advanced options, use fields from focused_beams module.
obligatory “einKwargs” are one of ‘theta’ or ‘polarization_state’ and one of ‘NA’ or ‘spotsize’
- polarization is defined by one of the two kwargs:
- theta: linear polarization angle in degrees, theta=0 –> along X.
Amplitude = 1 for both, E and B
- polarization_state. tuple (E0x, E0y, Dphi, phi): manually
define x and y amplitudes, phase difference and absolute phase of plane wave.
- Parameters:
pos (np.array) – list of 3-tuple coordinates to evaluate field at: [[x1,y1,z1], [x2,y2,z2], … ]
env_dict (dict) – Must be compatible with sim.dyads.getConfigDictG typed numba dict. description of environment. Must contain [‘eps1’, ‘eps2’, ‘eps3’, ‘spacing’].
wavelength (float) – Wavelength in nm
theta (float, default: None) – either ‘theta’ or ‘polarization_state’ must be given. linear polarization angle in degrees, 0deg = 0X direction
polarization_state (4-tuple of float, default: None) –
- either ‘theta’ or ‘polarization_state’ must be given.
polarization state with field amplitudes and phases, tuple of 4 float: (E0x, E0y, Dphi, Aphi): E0X amplitde, E0Y amplitde, phase difference between X and Y components (in rad), absolute phase of plane wave (in rad). The field is then calculated as E = (E0x, E0y*exp(i*Dphi*z), 0)*exp(i*Aphi*z). Note that this means the handedness depends on the propagation direction (kSign)!
- Dphi :
positive: left hand rotating polarization
negative: right hand rotating polarization
example: left circular pol. with (kSign=-1, E0x=1, E0y=1, Dphi=np.pi/2., phi=0)
- xSpot,ySpot,zSpotfloat, default: 0,0,0
x/y/z coordinates of focal point
- NAfloat
Numerical aperture to calculate beamwaist
- spotsizefloat (optional)
Gaussian beamwaist (overrides “NA”)
- kSignfloat, default: -1
Direction of Beam. -1: top to Bottom, 1 Bottom to top
- paraxialbool, default: False
Use paraxial Gaussian beam: No longitudinal fields. If “False”, longitudinal components are obtained using Maxwell equation div(E)=0 as condition
- phasefloat, default: 0
additional phase of the beam, in degrees
- E0complex or function, default: complex(1,0)
Either complex value or function of r=(x, y) (normalized to units of waist!). In case of a function, it needs to return the complex amplitude at the given position relative to beam axis (pos. in units of waist).
- returnFieldstr, default: ‘E’
if ‘E’: returns electric field; if ‘B’ or ‘H’: magnetic field
- Returns:
E0
- Return type:
Complex E-Field at each dipole position
Notes
- paraxial correction :
see: Novotny & Hecht. “Principles of nano-optics”. Cambridge University Press (2006)
- pyGDM2.fields.dipole_electric(pos, env_dict, wavelength, x0, y0, z0, mx, my, mz, returnField='E', R_farfield_approx=-1)¶
field emitted by an electric dipole at (x0,y0,z0) with complex amplitude (mx,my,mz)
mandatory kwargs along with wavelength are: x0, y0, z0, mx, my, mz
To take into account a dielectric interface, dipole_electric uses a mirror-charge approximation in the (quasistatic) near-field and an asymptotic approximation for the far-field. Can handle only a single interface (hence cases with n1 != n2 = n3).
- Parameters:
pos (np.array) – list of 3-tuple coordinates to evaluate field at: [[x1,y1,z1], [x2,y2,z2], … ]
env_dict (dict) – Must be compatible with sim.dyads.getConfigDictG typed numba dict. description of environment. Must contain either “eps_env” or [“eps1”, “eps2”].
wavelength (float) – Wavelength in nm
x0 (float) – x/y/z coordinates of electric dipole position
y0 (float) – x/y/z coordinates of electric dipole position
z0 (float) – x/y/z coordinates of electric dipole position
mx (float) – x/y/z amplitude of elec. dipole vector
my (float) – x/y/z amplitude of elec. dipole vector
mz (float) – x/y/z amplitude of elec. dipole vector
returnField (str, default: 'E') – if ‘E’: returns electric field; if ‘B’ or ‘H’: magnetic field
R_farfield_approx (float, default: -1) – optional emitter-observer distance (in nm) starting from which an asymptotic farfield approximation will be used (to be used with caution!). -1: Do not use far-field approximation.
- Returns:
E0/H0
- Return type:
Complex field at each position ( (Ex,Ey,Ez)-tuples )
Notes
for free-space propagators, see e.g. G. S. Agarwal, Phys. Rev. A, 11(230), (1975), Eqs. (4.5)/(4.6)
- pyGDM2.fields.dipole_magnetic(pos, env_dict, wavelength, x0, y0, z0, mx, my, mz, returnField='E', R_farfield_approx=-1)¶
field emitted by a magnetic dipole at (x0,y0,z0) with complex amplitude (mx,my,mz)
mandatory kwargs along with wavelength are: x0, y0, z0, mx, my, mz
To take into account a dielectric interface, dipole_magnetic uses a mirror-charge approximation in the (quasistatic) near-field and an asymptotic approximation for the far-field. Can handle only a single interface (hence cases with n1 != n2 = n3).
- Parameters:
pos (np.array) – list of 3-tuple coordinates to evaluate field at: [[x1,y1,z1], [x2,y2,z2], … ]
env_dict (dict) – Must be compatible with sim.dyads.getConfigDictG typed numba dict. description of environment. Must contain either “eps_env” or [“eps1”, “eps2”].
wavelength (float) – Wavelength in nm
x0 (float) – x/y/z coordinates of electric dipole position
y0 (float) – x/y/z coordinates of electric dipole position
z0 (float) – x/y/z coordinates of electric dipole position
mx (float) – x/y/z amplitude of elec. dipole vector
my (float) – x/y/z amplitude of elec. dipole vector
mz (float) – x/y/z amplitude of elec. dipole vector
returnField (str, default: 'E') – if ‘E’: returns electric field; if ‘B’ or ‘H’: magnetic field
R_farfield_approx (float, default: -1) – optional emitter-observer distance (in nm) starting from which an asymptotic farfield approximation will be used (to be used with caution!). -1: Do not use far-field approximation.
- Returns:
E0/H0
- Return type:
Complex field at each position ( (Ex,Ey,Ez)-tuples )
Notes
for free-space propagators, see e.g. G. S. Agarwal, Phys. Rev. A, 11(230), (1975), Eqs. (4.5)/(4.6)
- pyGDM2.fields.fast_electron(pos, env_dict, wavelength, electron_kinetic_energy, x0, y0, kSign=-1, avoid_div_lim_distance=10.0, returnField='E')¶
Electric field created by a fast electron moving along (OZ)
The electron beam crosses the (OXY) plane in (x0, y0)
- Parameters:
pos (np.array) – list of 3-tuple coordinates to evaluate field at: [[x1,y1,z1], [x2,y2,z2], … ]
env_dict (dict) – Must be compatible with sim.dyads.getConfigDictG typed numba dict. description of environment. Must contain either “eps_env” or [“eps1”, “eps2”].
wavelength (float) – Wavelength in nm
electron_kinetic_energy (float) – electron kinetic energy (keV)
x0 (float) – position of the electron beam (nm)
y0 (float) – position of the electron beam (nm)
kSign (int, default: -1) – sign of wavenumber. +1: electron propagation from bottom to top (towards increasing z) -1: electron propagation from top to bottom (towards smaller z, default) either kSign or k0 must be given.
avoid_div_lim_distance (float, default: 10.0) – set a min. distance (in nm) between the location where the E-field is computed and the electron trajectory to avoid divergence
returnField (str, default: 'E') – if ‘E’: returns electric field; if ‘B’: magnetic field
- Returns:
E0 (B0) – list of (complex) 3-tuples: [(Ex1, Ey1, Ez1), …]
- Return type:
Complex E-(B-)Field at each dipole position as
vector beams¶
- pyGDM2.fields.HermiteGauss00(pos, env_dict, wavelength, theta=0, polarization_state=None, xSpot=0.0, ySpot=0.0, zSpot=0.0, kSign=-1.0, NA=0.5, f=100, w0=1, phase=0.0, normalize=False, returnField='E', N_cpu=-1)¶
Hermite Gaussian mode (0,0)
after Novotny & Hecht p62 - Eq. (3.66) extended to transmission through an interface (G. Colas des Francs)
- Parameters:
pos (np.array) – list of 3-tuple coordinates to evaluate field at: [[x1,y1,z1], [x2,y2,z2], … ]
env_dict (dict) – Must be compatible with sim.dyads.getConfigDictG typed numba dict. description of environment. Must contain [‘eps1’, ‘eps2’, ‘eps3’, ‘spacing’].
wavelength (float) – Wavelength in nm
theta (float, optional) – linear polarization angle in degrees, 0deg = 0X direction. either ‘theta’ or ‘polarization_state’ must be given. The default is 0 (x polarization).
polarization_state (4-tuple of float, optional) –
either ‘theta’ or ‘polarization_state’ must be given. polarization state with field amplitudes and phases, tuple of 4 float: (E0x, E0y, Dphi, Aphi): E0X amplitde, E0Y amplitde, phase difference between X and Y components (in rad), absolute phase of plane wave (in rad). The field is then calculated as E = (E0x, E0y*exp(i*Dphi*z), 0)*exp(i*Aphi*z).
- Dphi :
positive: left hand rotating polarization
negative: right hand rotating polarization
example: left circular pol. with (E0x=1, E0y=1, Dphi=np.pi/2., phi=0)
The default is None.
xSpot (float, optional) – position of beam focus in nm. The default is 0,0,0
ySpot (float, optional) – position of beam focus in nm. The default is 0,0,0
zSpot (float, optional) – position of beam focus in nm. The default is 0,0,0
kSign (float, optional) – Direction of Beam. -1: top to Bottom, 1 Bottom to top. The default is -1
NA (float, optional) – lens numerical aperture. The default is 0.5.
f (float, optional) – lens focal distance (in mm). The default is 100.
w0 (float, optional) – beam waist before focalisation (in mm). The default is 1.
phase (float, optional) – additional phase (degrees). The default is 0.
normalize (bool, optional) – Normalize field amplitude at focus. If False, field is normalized before the focus. The default is False.
returnField (str, optional) – ‘B’ or ‘E’. The default is ‘E’.
N_cpu (int, optional) – numbers of CPUs to use for beam evaluation. The default is -1 (all CPUs).
- pyGDM2.fields.HermiteGauss10(pos, env_dict, wavelength, theta=0, polarization_state=None, xSpot=0.0, ySpot=0.0, zSpot=0.0, kSign=-1.0, NA=0.5, f=100, w0=1, phase=0.0, normalize=False, returnField='E', N_cpu=-1)¶
Hermite Gaussian mode (1,0)
after Novotny & Hecht p62 - Eq. (3.66) extended to transmission through an interface (G. Colas des Francs)
- Parameters:
pos (np.array) – list of 3-tuple coordinates to evaluate field at: [[x1,y1,z1], [x2,y2,z2], … ]
env_dict (dict) – Must be compatible with sim.dyads.getConfigDictG typed numba dict. description of environment. Must contain [‘eps1’, ‘eps2’, ‘eps3’, ‘spacing’].
wavelength (float) – Wavelength in nm
theta (float, optional) – linear polarization angle in degrees, 0deg = 0X direction. either ‘theta’ or ‘polarization_state’ must be given. The default is 0 (x polarization).
polarization_state (4-tuple of float, optional) –
either ‘theta’ or ‘polarization_state’ must be given. polarization state with field amplitudes and phases, tuple of 4 float: (E0x, E0y, Dphi, Aphi): E0X amplitde, E0Y amplitde, phase difference between X and Y components (in rad), absolute phase of plane wave (in rad). The field is then calculated as E = (E0x, E0y*exp(i*Dphi*z), 0)*exp(i*Aphi*z).
- Dphi :
positive: left hand rotating polarization
negative: right hand rotating polarization
example: left circular pol. with (E0x=1, E0y=1, Dphi=np.pi/2., phi=0)
The default is None.
xSpot (float, optional) – position of beam focus in nm. The default is 0,0,0
ySpot (float, optional) – position of beam focus in nm. The default is 0,0,0
zSpot (float, optional) – position of beam focus in nm. The default is 0,0,0
kSign (float, optional) – Direction of Beam. -1: top to Bottom, 1 Bottom to top. The default is -1
NA (float, optional) – lens numerical aperture. The default is 0.5.
f (float, optional) – lens focal distance (in mm). The default is 100.
w0 (float, optional) – beam waist before focalisation (in mm). The default is 1.
phase (float, optional) – additional phase (degrees). The default is 0.
normalize (bool, optional) – Normalize field amplitude at focus. If False, field is normalized before the focus. The default is False.
returnField (str, optional) – ‘B’ or ‘E’. The default is ‘E’.
N_cpu (int, optional) – numbers of CPUs to use for beam evaluation. The default is -1 (all CPUs).
- pyGDM2.fields.HermiteGauss01(pos, env_dict, wavelength, theta=0, polarization_state=None, xSpot=0.0, ySpot=0.0, zSpot=0.0, kSign=-1.0, NA=0.5, f=100, w0=1, phase=0.0, normalize=False, returnField='E', N_cpu=-1)¶
Gaussian mode (0,1)
after Novotny & Hecht p62 - Eq. (3.66) extended to transmission through an interface (G. Colas des Francs)
- Parameters:
pos (np.array) – list of 3-tuple coordinates to evaluate field at: [[x1,y1,z1], [x2,y2,z2], … ]
env_dict (dict) – Must be compatible with sim.dyads.getConfigDictG typed numba dict. description of environment. Must contain [‘eps1’, ‘eps2’, ‘eps3’, ‘spacing’].
wavelength (float) – Wavelength in nm
theta (float, optional) – linear polarization angle in degrees, 0deg = 0X direction. either ‘theta’ or ‘polarization_state’ must be given. The default is 0 (x polarization).
polarization_state (4-tuple of float, optional) –
either ‘theta’ or ‘polarization_state’ must be given. polarization state with field amplitudes and phases, tuple of 4 float: (E0x, E0y, Dphi, Aphi): E0X amplitde, E0Y amplitde, phase difference between X and Y components (in rad), absolute phase of plane wave (in rad). The field is then calculated as E = (E0x, E0y*exp(i*Dphi*z), 0)*exp(i*Aphi*z).
- Dphi :
positive: left hand rotating polarization
negative: right hand rotating polarization
example: left circular pol. with (E0x=1, E0y=1, Dphi=np.pi/2., phi=0)
The default is None.
xSpot (float, optional) – position of beam focus in nm. The default is 0,0,0
ySpot (float, optional) – position of beam focus in nm. The default is 0,0,0
zSpot (float, optional) – position of beam focus in nm. The default is 0,0,0
kSign (float, optional) – Direction of Beam. -1: top to Bottom, 1 Bottom to top. The default is -1
NA (float, optional) – lens numerical aperture. The default is 0.5.
f (float, optional) – lens focal distance (in mm). The default is 100.
w0 (float, optional) – beam waist before focalisation (in mm). The default is 1.
phase (float, optional) – additional phase (degrees). The default is 0.
normalize (bool, optional) – Normalize field amplitude at focus. If False, field is normalized before the focus. The default is False.
returnField (str, optional) – ‘B’ or ‘E’. The default is ‘E’.
N_cpu (int, optional) – numbers of CPUs to use for beam evaluation. The default is -1 (all CPUs).
- pyGDM2.fields.Radial_pol_doughnut(pos, env_dict, wavelength, polarization_direction=1.0, xSpot=0.0, ySpot=0.0, zSpot=0.0, kSign=-1.0, NA=0.5, f=100, w0=1, phase=0.0, normalize=False, returnField='E', N_cpu=-1)¶
Radially polarized doughnut mode focused beam
after Novotny & Hecht p67 - Eq. (3.70) extended to transmission through an interface (G. Colas des Francs)
- Parameters:
pos (np.array) – list of 3-tuple coordinates to evaluate field at: [[x1,y1,z1], [x2,y2,z2], … ]
env_dict (dict) – Must be compatible with sim.dyads.getConfigDictG typed numba dict. description of environment. Must contain [‘eps1’, ‘eps2’, ‘eps3’, ‘spacing’].
wavelength (float) – Wavelength in nm
polarization_direction (float, optional) – Either 1 or -1. Direction of the azimuthal polarization. Equivalent to a phase of pi. The default is 1.
xSpot (float, optional) – position of beam focus in nm. The default is 0,0,0
ySpot (float, optional) – position of beam focus in nm. The default is 0,0,0
zSpot (float, optional) – position of beam focus in nm. The default is 0,0,0
kSign (float, optional) – Direction of Beam. -1: top to Bottom, 1 Bottom to top. The default is -1
NA (float, optional) – lens numerical aperture. The default is 0.5.
f (float, optional) – lens focal distance (in mm). The default is 100.
w0 (float, optional) – beam waist before focalisation (in mm). The default is 1.
phase (float, optional) – additional phase (degrees). The default is 0.
returnField (str, optional) – ‘B’ or ‘E’. The default is ‘E’.
normalize (bool, optional) – Normalize field amplitude at focus. If False, field is normalized before the focus. The default is False.
N_cpu (int, optional) – numbers of CPUs to use for beam evaluation. The default is -1 (all CPUs).
- pyGDM2.fields.Azimuth_pol_doughnut(pos, env_dict, wavelength, polarization_direction=1.0, xSpot=0.0, ySpot=0.0, zSpot=0.0, kSign=-1.0, NA=0.5, f=100, w0=1, phase=0.0, normalize=False, returnField='E', N_cpu=-1)¶
Azimuthally polarized doughnut
After Novotny & Hecht p.67 - Eq. (3.70) Extended to include transmission through an interface (G. Colas des Francs)
- Parameters:
pos (np.array) –
- list of 3-tuple coordinates to evaluate field at:
[[x1,y1,z1], [x2,y2,z2], … ]
env_dict (dict) – Must be compatible with sim.dyads.getConfigDictG typed numba dict. description of environment. Must contain [‘eps1’, ‘eps2’, ‘eps3’, ‘spacing’].
wavelength (float) – Wavelength in nm
polarization_direction (float, optional) – Either 1 or -1. Direction of the azimuthal polarization. Equivalent to a phase of pi. The default is 1.
xSpot (float, optional) – position of beam focus in nm. The default is 0,0,0
ySpot (float, optional) – position of beam focus in nm. The default is 0,0,0
zSpot (float, optional) – position of beam focus in nm. The default is 0,0,0
kSign (float, optional) – Direction of Beam. -1: top to Bottom, 1 Bottom to top. The default is -1
NA (float, optional) – lens numerical aperture. The default is 0.5.
f (float, optional) – lens focal distance (in mm). The default is 100.
w0 (float, optional) – beam waist before focalisation (in mm). The default is 1.
phase (float, optional) – additional phase (degrees). The default is 0.
normalize (bool, optional) – Normalize field amplitude at focus. If False, field is normalized before the focus. The default is False.
returnField (str, optional) – ‘B’ or ‘E’. The default is ‘E’.
N_cpu (int, optional) – numbers of CPUs to use for beam evaluation. The default is -1 (all CPUs).
deprecated generators¶
- pyGDM2.fields.planewave(pos, env_dict, wavelength, theta=None, polarization_state=None, kSign=-1, returnField='E', deprecationwarning=True, **kwargs)¶
Normally incident (along Z) planewave in homogeneous environment
DEPRECATED - Use
plane_wave()
instead.- polarization is defined by one of the two kwargs:
- theta: linear polarization angle in degrees, theta=0 –> along X.
Amplitude = 1 for both, E and B
- polarization state. tuple (E0x, E0y, Dphi, phi): manually
define x and y amplitudes, phase difference and absolute phase of plane wave.
- Parameters:
pos (np.array) – list of 3-tuple coordinates to evaluate field at: [[x1,y1,z1], [x2,y2,z2], … ]
env_dict (dict) – Must be compatible with sim.dyads.getConfigDictG typed numba dict. description of environment. Must contain either “eps_env” or [“eps2”].
wavelength (float) – Wavelength in nm
theta (float, default: None) – either ‘theta’ or ‘polarization_state’ must be given. linear polarization angle in degrees, 0deg = 0X direction.
polarization_state (4-tuple of float, default: None) –
either ‘theta’ or ‘polarization_state’ must be given. polarization state with field amplitudes and phases, tuple of 4 float: (E0x, E0y, Dphi, Aphi): E0X amplitde, E0Y amplitde, phase difference between X and Y components (in rad), absolute phase of plane wave (in rad). The field is then calculated as E = (E0x, E0y*exp(i*Dphi*z), 0)*exp(i*Aphi*z). Note that this means the handedness depends on the propagation direction (kSign)!
- Dphi :
positive: left hand rotating polarization
negative: right hand rotating polarization
example: left circular pol. with (1, 1, np.pi/2., 0) and kSign=-1
kSign (int, default: -1) – sign of wavenumber. +1: propagation from bottom to top (towards increasing z) -1: propagation from top to bottom (towards smaller z, default) either kSign or k0 must be given.
returnField (str, default: 'E') – if ‘E’: returns electric field; if ‘B’ or ‘H’: magnetic field
deprecationwarning (bool, default: True) – whether or not to emit a deprecation warning
- Returns:
E0 (B0) – list of (complex) 3-tuples: [(Ex1, Ey1, Ez1), …]
- Return type:
Complex E-(B-)Field at each dipole position as
- pyGDM2.fields.focused_planewave(pos, env_dict, wavelength, theta=None, polarization_state=None, xSpot=0.0, ySpot=0.0, NA=-1.0, spotsize=-1.0, kSign=-1, phase=0.0, consider_substrate_reflection=False, returnField='E')¶
Normally incident (along Z) planewave with gaussian intensity profile
DEPRECATED - Use
gaussian()
instead.focused at (x0,y0)
- polarization is defined by one of the two kwargs:
- theta: linear polarization angle in degrees, theta=0 –> along X.
Amplitude = 1 for both, E and B
- polarization state. tuple (E0x, E0y, Dphi, phi): manually
define x and y amplitudes, phase difference and absolute phase of plane wave.
- Parameters:
pos (np.array) – list of 3-tuple coordinates to evaluate field at: [[x1,y1,z1], [x2,y2,z2], … ]
env_dict (dict) – Must be compatible with sim.dyads.getConfigDictG typed numba dict. description of environment. Must contain either “eps_env” or [“eps2”].
wavelength (float) – Wavelength in nm
theta (float, default: None) – either ‘theta’ or ‘polarization_state’ must be given. linear polarization angle in degrees, 0deg = 0X direction
polarization_state (4-tuple of float, default: None) –
either ‘theta’ or ‘polarization_state’ must be given. polarization state with field amplitudes and phases, tuple of 4 float: (E0x, E0y, Dphi, Aphi): E0X amplitde, E0Y amplitde, phase difference between X and Y components (in rad), absolute phase of plane wave (in rad). The field is then calculated as E = (E0x, E0y*exp(i*Dphi*z), 0)*exp(i*Aphi*z).
- Dphi :
positive: left hand rotating polarization
negative: right hand rotating polarization
example: left circular pol. with (E0x=1, E0y=1, Dphi=np.pi/2., phi=0)
xSpot (float, float, default: 0, 0) – focal spot position (in nm)
ySpot (float, float, default: 0, 0) – focal spot position (in nm)
kSign (int, default: -1) – sign of wavenumber. +1: propagation from bottom to top (towards increasing z) -1: propagation from top to bottom (towards smaller z, default)
phase (float, default: 0) – additional phase of the beam, in degrees
consider_substrate_reflection (bool, default: False) – Whether to consider the reflection / transmission coefficient at the substrate for adjusting the field amplitude
returnField (str, default: 'E') – if ‘E’: returns electric field; if ‘B’: magnetic field
- Returns:
E0 (B0) – list of (complex) 3-tuples: [(Ex1, Ey1, Ez1), …]
- Return type:
Complex E-(B-)Field at each dipole position as
- pyGDM2.fields.evanescent_planewave(pos, env_dict, wavelength, theta_inc=0, polar='p', inc_plane='xz', returnField='E')¶
oblique incident planewave, only linear polarization
DEPRECATED - Use
plane_wave()
instead.Oblique incidence (from bottom to top) through n1/n2/n3 layer interfaces. May be used to simulate evanescent fields in the total internal reflection configuration. Linear polarization. Amplitude = 1 for both, E and B.
Original fortran code by Ch. Girard, python implementation by C. Majorel
- Parameters:
pos (np.array) – list of 3-tuple coordinates to evaluate field at: [[x1,y1,z1], [x2,y2,z2], … ]
env_dict (dict) – Must be compatible with sim.dyads.getConfigDictG typed numba dict. description of environment. Must contain [‘eps1’, ‘eps2’, ‘eps3’, ‘spacing’].
wavelength (float) – Wavelength in nm
theta_inc (float, default: 0) –
- incident angle in the XZ plane with respect to e_z, in degrees.
0deg = along Z (from neg to pos Z)
90deg = along X (from pos to neg X)
180deg = along Z (from pos to neg Z)
270deg = along X (from neg to pos X)
polar (str, default: 'p') – incident linear polarization. Either ‘s’ or ‘p’. At 0 / 180 degrees incident angle (normal incindence), ‘p’ is polarized along x, ‘s’ along y. Then, at 90deg ‘p’ is along z.
inc_plane (str, default: 'xz') – plane of incidence, one of [‘xz’, ‘yz’]
returnField (str, default: 'E') – if ‘E’: returns electric field; if ‘B’ or ‘H’: magnetic field
- Returns:
E0 (B0) – list of (complex) 3-tuples: [(Ex1, Ey1, Ez1), …]
- Return type:
Complex E-(B-)Field at each dipole position as
Environment - set of Green’s Dyads¶
The simulation environment and type of simulation is described by a dyads-class, containing the Green’s tensors used for field-propagation. pyGDM offers so far non-retarded sets of Green’s dyads for 3D and 2D simulations with up to three homogeneous layers.
The dyads classes must follow the reference implementation:
- pyGDM2.propagators.DyadsBaseClass(dtype='f')¶
Bases: object
Green’s tensors container class - pure-python API
Defines the frame of a linear GDM simulation via the Green’s tensors, self-terms and material-polarizability relations.
- Parameters:
dtype ((optional) str, default: ‘f’) – precision (‘f’: float/single/32bit or ‘d’: double/64bit)
3D - 1-2-3 layer non-retarded surface dyads¶
- pyGDM2.propagators.DyadsQuasistatic123(n1=None, n2=None, n3=None, spacing=5000, radiative_correction=True)¶
Bases: object
Green’s tensors container class - pure-python API
Defines the frame of a linear GDM simulation via the Green’s tensors, self-terms and material-polarizability relations.
- Parameters:
dtype ((optional) str, default: ‘f’) – precision (‘f’: float/single/32bit or ‘d’: double/64bit)
2D - 1-2-3 layer non-retarded surface dyads¶
- pyGDM2.propagators.propagators_2D.DyadsQuasistatic2D123(n1=None, n2=None, n3=None, spacing=5000, ky0=None, ignore_incident_field_error=False)¶
Bases: object
Green’s tensors container class - pure-python API
Defines the frame of a linear GDM simulation via the Green’s tensors, self-terms and material-polarizability relations.
- Parameters:
dtype ((optional) str, default: ‘f’) – precision (‘f’: float/single/32bit or ‘d’: double/64bit)
3D - periodic dyads (homogeneous environment)¶
These propagators are preliminary and not fully tested
- pyGDM2.propagators.propagators_periodic.DyadsQuasistaticPeriodic123(n1=None, n2=None, n3=None, spacing=5000, u=array([0, 0, 0]), v=array([0, 0, 0]), cutoff_u=10, cutoff_v=10, radiative_correction=False, n_cpu=-1)¶
Bases: object
Green’s tensors container class - pure-python API
Defines the frame of a linear GDM simulation via the Green’s tensors, self-terms and material-polarizability relations.
- Parameters:
dtype ((optional) str, default: ‘f’) – precision (‘f’: float/single/32bit or ‘d’: double/64bit)