MCPcopy Create free account
hub / github.com/NanoComp/meep / bands_to_diffractedplanewave

Function bands_to_diffractedplanewave

python/simulation.py:138–160  ·  view source on GitHub ↗
(where, bands)

Source from the content-addressed store, hash-verified

136
137
138def bands_to_diffractedplanewave(where, bands):
139 if bands.axis is None:
140 if where.in_direction(mp.X) != 0:
141 axis = np.array([1, 0, 0], dtype=np.float64)
142 elif where.in_direction(mp.Y) != 0:
143 axis = np.array([0, 1, 0], dtype=np.float64)
144 elif where.in_direction(mp.Z) != 0:
145 axis = np.array([0, 0, 1], dtype=np.float64)
146 else:
147 raise ValueError(
148 "axis parameter of DiffractedPlanewave must be a non-zero Vector3"
149 )
150 elif isinstance(bands.axis, mp.Vector3):
151 axis = np.array([bands.axis.x, bands.axis.y, bands.axis.z], dtype=np.float64)
152 else:
153 raise TypeError("axis parameter of DiffractedPlanewave must be a Vector3")
154 diffractedplanewave_args = [
155 np.array(bands.g, dtype=np.intc),
156 axis,
157 bands.s * 1.0,
158 bands.p * 1.0,
159 ]
160 return mp.diffractedplanewave(*diffractedplanewave_args)
161
162
163class DiffractedPlanewave:

Callers 1

Calls 2

diffractedplanewaveMethod · 0.80
in_directionMethod · 0.45

Tested by

no test coverage detected