forked from jan/fdfd_tools
Style fixes
This commit is contained in:
parent
5bf902212e
commit
05d2557f6f
@ -13,7 +13,7 @@ from . import dx_lists_t, field_t
|
|||||||
__author__ = 'Jan Petykiewicz'
|
__author__ = 'Jan Petykiewicz'
|
||||||
|
|
||||||
|
|
||||||
functional_matrix = Callable[[List[numpy.ndarray]], List[numpy.ndarray]]
|
functional_matrix = Callable[[field_t], field_t]
|
||||||
|
|
||||||
|
|
||||||
def curl_h(dxes: dx_lists_t) -> functional_matrix:
|
def curl_h(dxes: dx_lists_t) -> functional_matrix:
|
||||||
@ -28,11 +28,11 @@ def curl_h(dxes: dx_lists_t) -> functional_matrix:
|
|||||||
def dH(f, ax):
|
def dH(f, ax):
|
||||||
return (f - numpy.roll(f, 1, axis=ax)) / dxyz_b[ax]
|
return (f - numpy.roll(f, 1, axis=ax)) / dxyz_b[ax]
|
||||||
|
|
||||||
def ch_fun(H: List[numpy.ndarray]) -> List[numpy.ndarray]:
|
def ch_fun(h: field_t) -> field_t:
|
||||||
E = [dH(H[2], 1) - dH(H[1], 2),
|
e = [dh(h[2], 1) - dh(h[1], 2),
|
||||||
dH(H[0], 2) - dH(H[2], 0),
|
dh(h[0], 2) - dh(h[2], 0),
|
||||||
dH(H[1], 0) - dH(H[0], 1)]
|
dh(h[1], 0) - dh(h[0], 1)]
|
||||||
return E
|
return e
|
||||||
|
|
||||||
return ch_fun
|
return ch_fun
|
||||||
|
|
||||||
@ -49,11 +49,11 @@ def curl_e(dxes: dx_lists_t) -> functional_matrix:
|
|||||||
def dE(f, ax):
|
def dE(f, ax):
|
||||||
return (numpy.roll(f, -1, axis=ax) - f) / dxyz_a[ax]
|
return (numpy.roll(f, -1, axis=ax) - f) / dxyz_a[ax]
|
||||||
|
|
||||||
def ce_fun(E: List[numpy.ndarray]) -> List[numpy.ndarray]:
|
def ce_fun(e: field_t) -> field_t:
|
||||||
H = [dE(E[2], 1) - dE(E[1], 2),
|
h = [de(e[2], 1) - de(e[1], 2),
|
||||||
dE(E[0], 2) - dE(E[2], 0),
|
de(e[0], 2) - de(e[2], 0),
|
||||||
dE(E[1], 0) - dE(E[0], 1)]
|
de(e[1], 0) - de(e[0], 1)]
|
||||||
return H
|
return h
|
||||||
|
|
||||||
return ce_fun
|
return ce_fun
|
||||||
|
|
||||||
@ -77,13 +77,13 @@ def e_full(omega: complex,
|
|||||||
ch = curl_h(dxes)
|
ch = curl_h(dxes)
|
||||||
ce = curl_e(dxes)
|
ce = curl_e(dxes)
|
||||||
|
|
||||||
def op_1(E):
|
def op_1(e):
|
||||||
curls = ch(ce(E))
|
curls = ch(ce(e))
|
||||||
return [c - omega ** 2 * e * x for c, e, x in zip(curls, epsilon, E)]
|
return [c - omega ** 2 * e * x for c, e, x in zip(curls, epsilon, e)]
|
||||||
|
|
||||||
def op_mu(E):
|
def op_mu(e):
|
||||||
curls = ch([m * y for m, y in zip(mu, ce(E))])
|
curls = ch([m * y for m, y in zip(mu, ce(e))])
|
||||||
return [c - omega ** 2 * e * x for c, e, x in zip(curls, epsilon, E)]
|
return [c - omega ** 2 * p * x for c, p, x in zip(curls, epsilon, e)]
|
||||||
|
|
||||||
if numpy.any(numpy.equal(mu, None)):
|
if numpy.any(numpy.equal(mu, None)):
|
||||||
return op_1
|
return op_1
|
||||||
@ -108,13 +108,13 @@ def eh_full(omega: complex,
|
|||||||
ch = curl_h(dxes)
|
ch = curl_h(dxes)
|
||||||
ce = curl_e(dxes)
|
ce = curl_e(dxes)
|
||||||
|
|
||||||
def op_1(E, H):
|
def op_1(e, h):
|
||||||
return ([c - 1j * omega * e * x for c, e, x in zip(ch(H), epsilon, E)],
|
return ([c - 1j * omega * p * x for c, p, x in zip(ch(h), epsilon, e)],
|
||||||
[c + 1j * omega * y for c, y in zip(ce(E), H)])
|
[c + 1j * omega * y for c, y in zip(ce(e), h)])
|
||||||
|
|
||||||
def op_mu(E, H):
|
def op_mu(e, h):
|
||||||
return ([c - 1j * omega * e * x for c, e, x in zip(ch(H), epsilon, E)],
|
return ([c - 1j * omega * p * x for c, p, x in zip(ch(h), epsilon, e)],
|
||||||
[c + 1j * omega * m * y for c, m, y in zip(ce(E), mu, H)])
|
[c + 1j * omega * m * y for c, m, y in zip(ce(e), mu, h)])
|
||||||
|
|
||||||
if numpy.any(numpy.equal(mu, None)):
|
if numpy.any(numpy.equal(mu, None)):
|
||||||
return op_1
|
return op_1
|
||||||
@ -137,11 +137,11 @@ def e2h(omega: complex,
|
|||||||
"""
|
"""
|
||||||
A2 = curl_e(dxes)
|
A2 = curl_e(dxes)
|
||||||
|
|
||||||
def e2h_1_1(E):
|
def e2h_1_1(e):
|
||||||
return [y / (-1j * omega) for y in A2(E)]
|
return [y / (-1j * omega) for y in A2(e)]
|
||||||
|
|
||||||
def e2h_mu(E):
|
def e2h_mu(e):
|
||||||
return [y / (-1j * omega * m) for y, m in zip(A2(E), mu)]
|
return [y / (-1j * omega * m) for y, m in zip(A2(e), mu)]
|
||||||
|
|
||||||
if numpy.any(numpy.equal(mu, None)):
|
if numpy.any(numpy.equal(mu, None)):
|
||||||
return e2h_1_1
|
return e2h_1_1
|
||||||
|
Loading…
Reference in New Issue
Block a user