(where, bands)
| 136 | |
| 137 | |
| 138 | def 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 | |
| 163 | class DiffractedPlanewave: |
no test coverage detected