Skip to content

Commit

Permalink
Rename omega to freq (#587)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopherHogan authored and stevengj committed Nov 6, 2018
1 parent 41802ae commit 1e628c9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions doc/docs/Python_User_Interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
8 changes: 4 additions & 4 deletions python/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion python/tests/mode_coeffs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]))

Expand Down

0 comments on commit 1e628c9

Please sign in to comment.