plask
package¶PLaSK (Photonic Laser Simulation Kit) is a comprehensive toolkit for simulation of various microscale photonic devices. It is particularly well suited for analysis of semiconductor lasers, as it allows to perform simulations of various physical phenomena with different models: thermal, electrical, quantum and optical. PLaSK takes care of considering mutual interactions between these models and allows to easily perform complex selfconsistent analysis of complete devices.
geometry 
PLaSK geometry classes. 
mesh 
Meshes classes. 
material 
Materials and material database. 
flow 
Data flow classes for standard properties. 
phys 
Basic physical constants and utility functions. 
util 
Auxiliary PLaSK utilities. 
config 
Global PLaSK configuration. 
vec 
PLaSK vector. 
Data 
Data returned by field providers. 
Manager 
Main input manager. 
MaterialField 
Distribution of materials for a given geometry on a mesh. 
StepProfile 
Step profile for use in custom providers. 
Solver 
Base class for all solvers. 
XplWriter 
XPL writer that can save existing geometries and meshes to the XPL. 
loadxpl (source[, defs, sections, …]) 
Load the XPL file. 
runxpl (source[, defs]) 
Load and run the code from the XPL file. 
print_log (level, *args) 
Print log message into a specified log level. 
save_field (field, file[, path, mode, compress]) 
Save field to HDF5 file. 
load_field (file[, path]) 
Load field from HDF5 file. 
plot_profile (field[, comp, swap_axes, axes, …]) 
Plot a scalar real field value along one axis. 
plot_field (field[, levels, plane, fill, …]) 
Plot scalar real fields as twodimensional color map. 
plot_vectors (field[, plane, axes, figure, …]) 
Plot vector field with arrows. 
plot_stream (field[, plane, axes, figure, …]) 
Plot vector field as a streamlines. 
plot_geometry (geometry[, color, lw, plane, …]) 
Plot specified geometry. 
plot_mesh (mesh[, color, lw, plane, margin, …]) 
Plot twodimensional mesh. 
plot_boundary (boundary, mesh, geometry[, …]) 
Plot boundary conditions. 
JOBID 
Job index: either a job ID in batch submission system or a float indicating lauch time (that can be converted to time.time() ). 
ARRAYID 
Array index in batch submission system. None if the job is not a part of an array. 
PROCID 
Process index for parallel computations (eg. MPI). None if this is a regular or serial job. 
Function Details
plask.
loadxpl
(source, defs={}, sections=None, destination=None, update=False)¶Load the XPL file. All sections contents is read into the destination scope.
Parameters: 


plask.
runxpl
(source, defs={})¶Load and run the code from the XPL file. Unlike loadxpl()
this function
does not modify the current global scope.
Parameters: 


plask.
print_log
(level, *args)¶Print log message into a specified log level.
Parameters: 


plask.
save_field
(field, file, path='', mode='a', compress=None)¶Save field to HDF5 file.
Parameters: 


If file
is a string, a new HDF5 file is opened with the mode
specified by mode
. Then both the data and its mesh are written to
this file under the path specified by the path
argument. It can
contain slashes (‘/’), in which case a corresponding hierarchy is created
in the HDF5 file.
Saved data can later be restored by any HDF5aware application, or by
load_field
function of PLaSK.
Example
You may save data retrieved from a provider to file as follows:
>>> data = my_solver.outMyData(my_mesh)
>>> save_field('myfile.h5', data, 'mygroup/mydata', 'a')
In another PLaSK session, you may retrieve this data and plot it or provide to some receiver:
>>> data = load_field('myfile.h5', 'mygroup/mydata')
>>> plot_field(data)
>>> other_solver.inMyData = data
plask.
load_field
(file, path='/')¶Load field from HDF5 file.
Parameters: 


Returns:  Read plask.Data object. 
If file
is a string, a new HDF5 file is opened for reading. Then both
the data and its mesh are read from this file from the path specified by
the path
argument. path
can contain slashes (‘/’), in which case
the corresponding hierarchy in the HDF5 file is used.
Example
You may save data retrieved from a provider to file as follows:
>>> data = my_solver.outMyData(my_mesh)
>>> save_field('myfile.h5', data, 'mygroup/mydata', 'a')
In another PLaSK session, you may retrieve this data and plot it or provide to some receiver:
>>> data = load_field('myfile.h5', 'mygroup/mydata')
>>> plot_field(data)
>>> other_solver.inMyData = data
plask.
plot_profile
(field, comp=None, swap_axes=False, axes=None, figure=None, **kwargs)¶Plot a scalar real field value along one axis.
This function creates a classical plot of a scalar field. The field must be obtained on a rectangular mesh that has a single point in all dimensions but one. In other words, the field must be obtained over a single line which is used as an argument axis of this plot.
Parameters: 


plask.
plot_field
(field, levels=16, plane=None, fill=True, antialiased=False, comp=None, axes=None, figure=None, **kwargs)¶Plot scalar real fields as twodimensional color map.
This function uses contourf
of contour
functions to plot scalar real
fields returned by providers. It can also plot a single component of a vector
or tensor field; in such case the component must be specified with the comp
argument.
Parameters: 


plask.
plot_vectors
(field, plane=None, axes=None, figure=None, angles='xy', scale_units='xy', **kwargs)¶Plot vector field with arrows.
This function uses quiver
to plot a vector field returned by some providers
with arrows.
Parameters: 


plask.
plot_stream
(field, plane=None, axes=None, figure=None, scale=8.0, color='k', **kwargs)¶Plot vector field as a streamlines.
This function uses streamplot
to plot a vector field returned by some
providers using streamlines.
Parameters: 


plask.
plot_geometry
(geometry, color=None, lw=1.0, plane=None, zorder=None, mirror=False, periods=True, fill=False, axes=None, figure=None, margin=None, get_color=None, alpha=1.0, extra=None, picker=None, edges=False, edge_alpha=0.25, edge_lw=None)¶Plot specified geometry.
Parameters: 


Returns:  appended or given axes object dict (optional): dictionary mapping geometry objects to extra_patches. 
Return type:  matplotlib.axes.Axes 
Intersection is not drawn precisely (item is clipped to bounding box of the envelope).
Filling is not supported when 3D geometry object or Cartesian3D geometry is drawn.
plask.
plot_mesh
(mesh, color='0.5', lw=1.0, plane=None, margin=False, axes=None, figure=None, zorder=1.5, alpha=1.0)¶Plot twodimensional mesh.
Parameters: 


plask.
plot_boundary
(boundary, mesh, geometry, colors=None, color='0.75', plane=None, axes=None, figure=None, zorder=4, **kwargs)¶Plot boundary conditions.
This functions is used to visualize boundary conditions. It plots the markers at mesh points, in which boundary conditions are specified. Optionally it can color the points according to the boundary condition value using a specified colormap.
Parameters: 


Example
>>> solver = electrical.Schockey2D()
>>> # configure solver
>>> plot_boundary(solver.voltage_boundary, solver.mesh, solver.geometry,
... cmap='summer')