diff --git a/doc/docs/Python_User_Interface.md b/doc/docs/Python_User_Interface.md index 8f4ca7c2e..b76f8960f 100644 --- a/doc/docs/Python_User_Interface.md +++ b/doc/docs/Python_User_Interface.md @@ -1065,12 +1065,12 @@ Similar to `add_flux`, but for use with `get_eigenmode_coefficients`. `add_mode_monitor` works properly with arbitrary symmetries, but may be suboptimal because the Fourier-transformed region does not exploit the symmetry. As an optimization, if you have a mirror plane that bisects the mode monitor, you can instead use `add_flux` to gain a factor of two, but in that case you *must* also pass the corresponding `eig_parity` to `get_eigenmode_coefficients` in order to only compute eigenmodes with the corresponding mirror symmetry. -**`get_eigenmode(omega_src, direction, where, band_num, kpoint, eig_vol=None, match_frequency=True, parity=mp.NO_PARITY, resolution=0, eigensolver_tol=1e-12, verbose=False)`** +**`get_eigenmode(freq, direction, where, band_num, kpoint, eig_vol=None, match_frequency=True, parity=mp.NO_PARITY, resolution=0, eigensolver_tol=1e-12, verbose=False)`** — The parameters of this routine are the same as that of `get_eigenmode_coefficients` or `EigenModeSource`, but this function returns an object that can be used to inspect the computed mode. In particular, it returns an `EigenmodeData` instance with the following fields: + `band_num`: same as the `band_num` parameter -+ `omega`: the computed frequency, same as `omega_src` if `match_frequency=True` ++ `freq`: the computed frequency, same as the `freq` input parameter if `match_frequency=True` + `group_velocity`: the group velocity of the mode in `direction` + `k`: the Bloch wavevector of the mode in `direction` + `kdom`: the dominant planewave of mode `band_num` diff --git a/python/simulation.py b/python/simulation.py index 6805fabfb..8037f3867 100644 --- a/python/simulation.py +++ b/python/simulation.py @@ -339,9 +339,9 @@ def chunks(self): class EigenmodeData(object): - def __init__(self, band_num, omega, group_velocity, k, swigobj, kdom): + def __init__(self, band_num, freq, group_velocity, k, swigobj, kdom): self.band_num = band_num - self.omega = omega + self.freq = freq self.group_velocity = group_velocity self.k = k self.swigobj = swigobj @@ -1394,7 +1394,7 @@ def get_eigenmode_coefficients(self, flux, bands, eig_parity=mp.NO_PARITY, return EigCoeffsResult(np.reshape(coeffs, (num_bands, flux.Nfreq, 2)), vgrp, kpoints, kdom) - def get_eigenmode(self, omega_src, direction, where, band_num, kpoint, eig_vol=None, match_frequency=True, + def get_eigenmode(self, freq, direction, where, band_num, kpoint, eig_vol=None, match_frequency=True, parity=mp.NO_PARITY, resolution=0, eigensolver_tol=1e-12, verbose=False): if self.fields is None: @@ -1408,7 +1408,7 @@ def get_eigenmode(self, omega_src, direction, where, band_num, kpoint, eig_vol=N swig_kpoint = mp.vec(kpoint.x, kpoint.y, kpoint.z) kdom = np.zeros(3) - emdata = mp._get_eigenmode(self.fields, omega_src, direction, where, eig_vol, band_num, swig_kpoint, + emdata = mp._get_eigenmode(self.fields, freq, direction, where, eig_vol, band_num, swig_kpoint, match_frequency, parity, resolution, eigensolver_tol, verbose, kdom) Gk = mp._get_eigenmode_Gk(emdata) diff --git a/python/tests/mode_coeffs.py b/python/tests/mode_coeffs.py index 6e5ccd661..a93eb9920 100644 --- a/python/tests/mode_coeffs.py +++ b/python/tests/mode_coeffs.py @@ -94,7 +94,7 @@ def test_modes(self): # Test mp.get_eigenmode and EigenmodeData vol = mp.Volume(center=mp.Vector3(5), size=mp.Vector3(y=7)) emdata = self.sim.get_eigenmode(0.2, mp.X, vol, 2, mp.Vector3()) - self.assertEqual(emdata.omega, 0.2) + self.assertEqual(emdata.freq, 0.2) self.assertEqual(emdata.band_num, 2) self.assertTrue(emdata.kdom.close(res.kdom[1]))