Fields¶

class
lumopt.utilities.fields.
Fields
(x, y, z, wl, E, D, eps, H)¶ Container for the raw fields from a field monitor. Several interpolation objects are created internally to evaluate the fields at any point in space. Use the auxiliary :method:lumopt.lumerical_methods.lumerical_scripts.get_fields to create this object.

scale
(dimension, factors)¶ Scales the E, D and H field arrays along the specified dimension using the provided weighting factors.
Parameters:  dimension – 0 (xaxis), 1 (yaxis), 2 (zaxis), (3) frequency and (4) vector component.
 factors – list or vector of weighting factors of the same size as the target field dimension.

Gradient Fields¶

class
lumopt.utilities.gradients.
GradientFields
(forward_fields, adjoint_fields)¶ Combines the forward and adjoint fields (collected by the constructor) to generate the integral used to compute the partial derivatives of the figure of merit (FOM) with respect to the shape parameters.

boundary_perturbation_integrand
()¶ Generates the integral kernel in equation 5.28 of Owen Miller’s thesis used to approximate the partial derivatives of the FOM with respect to the optimization parameters.

Others¶
Copyright chriskeraly Copyright (c) 2019 Lumerical Inc.

lumopt.utilities.load_lumerical_scripts.
load_from_lsf
(script_file_name)¶ Loads the provided scritp as a string and strips out all comments.
Parameters: script_file_name – string specifying a file name.

class
lumopt.utilities.simulation.
Simulation
(workingDir, use_var_fdtd, hide_fdtd_cad)¶ Object to manage the FDTD CAD.
Parameters:  workingDir – working directory for the CAD session.
 hide_fdtd_cad – if true, runs the FDTD CAD in the background.
Launches FDTD CAD and stores a handle.

run
(name, iter)¶ Saves simulation file and runs the simulation.
Copyright chriskeraly Copyright (c) 2019 Lumerical Inc.

class
lumopt.utilities.plotter.
Plotter
(movie=True, plot_history=True)¶ Orchestrates the generation of plots during the optimization.
Parameters: movie – Indicates if the evolution of parameters should be recorded as a movie  :param plot_history Indicates if we should plot the history of the parameters and gradients. Should
 be set to False for large (e.g. >100) numbers of parameters

class
lumopt.utilities.plotter.
SnapShots
(*args, extra_args=None, **kwargs)¶ Grabs the image information from the figure and saves it as a movie frame.

finish
()¶ Finish any processing for writing the movie.

grab_frame
(**fig_kwargs)¶ All keyword arguments in fig_kwargs are passed on to the ‘savefig’ command that saves the figure.

setup
(fig, dpi, frame_prefix)¶ Perform setup for writing the movie file.
 fig : matplotlib.figure.Figure
 The figure to grab the rendered frames from.
 outfile : str
 The filename of the resulting movie file.
 dpi : number, optional
 The dpi of the output file. This, with the figure size, controls the size in pixels of the resulting movie file. Default is fig.dpi.
 frame_prefix : str, optional
 The filename prefix to use for temporary files. Defaults to
'_tmp'
.  clear_temp : bool, optional
 If the temporary files should be deleted after stitching
the final result. Setting this to
False
can be useful for debugging. Defaults toTrue
.

Copyright chriskeraly Copyright (c) 2019 Lumerical Inc.

lumopt.utilities.scipy_wrappers.
wrapped_GridInterpolator
(points, values, method='linear', bounds_error=True, fill_value=nan)¶ This is a wrapper around Scipy’s RegularGridInterpolator so that it can deal with entries of 1 dimension
Original doc:
The data must be defined on a regular grid; the grid spacing however may be uneven. Linear and nearestneighbour interpolation are supported. After setting up the interpolator object, the interpolation method (linear or nearest) may be chosen at each evaluation.
 points : tuple of ndarray of float, with shapes (m1, ), …, (mn, )
 The points defining the regular grid in n dimensions.
 values : array_like, shape (m1, …, mn, …)
 The data on the regular grid in n dimensions.
 method : str, optional
 The method of interpolation to perform. Supported are “linear” and
“nearest”. This parameter will become the default for the object’s
__call__
method. Default is “linear”.  bounds_error : bool, optional
 If True, when interpolated values are requested outside of the domain of the input data, a ValueError is raised. If False, then fill_value is used.
 fill_value : number, optional
 If provided, the value to use for points outside of the interpolation domain. If None, values outside the domain are extrapolated.
Copyright chriskeraly Copyright (c) 2019 Lumerical Inc.