From 5b0bd8d09958f83a0fb6f378d17077a9525f9525 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ne=C4=8Dada?= Date: Wed, 11 Jan 2017 11:27:50 +0200 Subject: [PATCH] small fixes Former-commit-id: 90d007ae19ad42222c406564adc80b5394703b83 --- Scattering and Shit.lyx | 16 +++++++++++----- qpms/lattices.py | 8 ++++---- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/Scattering and Shit.lyx b/Scattering and Shit.lyx index 1cdefc7..554a94c 100644 --- a/Scattering and Shit.lyx +++ b/Scattering and Shit.lyx @@ -262,11 +262,13 @@ Original formulation, sect. \begin_layout Standard \begin_inset Formula -\begin{eqnarray*} -\vect A_{1lm}\left(\hat{\vect r}\right) & = & \frac{1}{\sqrt{l\left(l+1\right)}}\left(\hat{\vect{\theta}}\frac{1}{\sin\theta}\frac{\partial}{\partial\phi}Y_{lm}\left(\hat{\vect r}\right)-\hat{\vect{\phi}}\frac{\partial}{\partial\theta}Y_{lm}\left(\hat{\vect r}\right)\right)\\ -\vect A_{2lm}\left(\hat{\vect r}\right) & = & \frac{1}{\sqrt{l\left(l+1\right)}}\left(\hat{\vect{\theta}}\frac{\partial}{\partial\phi}Y_{lm}\left(\hat{\vect r}\right)-\hat{\vect{\phi}}\frac{1}{\sin\theta}\frac{\partial}{\partial\theta}Y_{lm}\left(\hat{\vect r}\right)\right)\\ -\vect A_{3lm}\left(\hat{\vect r}\right) & = & \hat{\vect r}Y_{lm}\left(\hat{\vect r}\right) -\end{eqnarray*} +\begin{eqnarray} +\vect A_{1lm}\left(\hat{\vect r}\right) & = & \frac{1}{\sqrt{l\left(l+1\right)}}\left(\hat{\vect{\theta}}\frac{1}{\sin\theta}\frac{\partial}{\partial\phi}Y_{lm}\left(\hat{\vect r}\right)-\hat{\vect{\phi}}\frac{\partial}{\partial\theta}Y_{lm}\left(\hat{\vect r}\right)\right)\nonumber \\ + & = & \frac{1}{\sqrt{l\left(l+1\right)}}\nabla\times\left(\vect rY_{lm}\left(\hat{\vect r}\right)\right)\nonumber \\ +\vect A_{2lm}\left(\hat{\vect r}\right) & = & \frac{1}{\sqrt{l\left(l+1\right)}}\left(\hat{\vect{\theta}}\frac{\partial}{\partial\phi}Y_{lm}\left(\hat{\vect r}\right)-\hat{\vect{\phi}}\frac{1}{\sin\theta}\frac{\partial}{\partial\theta}Y_{lm}\left(\hat{\vect r}\right)\right)\label{eq:vector spherical harmonics Kristensson}\\ + & = & \frac{1}{\sqrt{l\left(l+1\right)}}r\nabla Y_{lm}\left(\hat{\vect r}\right)\nonumber \\ +\vect A_{3lm}\left(\hat{\vect r}\right) & = & \hat{\vect r}Y_{lm}\left(\hat{\vect r}\right)\nonumber +\end{eqnarray} \end_inset @@ -1236,6 +1238,10 @@ Translation of spherical waves: getting insane Multiple scattering: nice linear algebra born from all the mess \end_layout +\begin_layout Chapter +Quantisation of quasistatic modes of a sphere +\end_layout + \begin_layout Standard \begin_inset CommandInset bibtex LatexCommand bibtex diff --git a/qpms/lattices.py b/qpms/lattices.py index 960fc24..5f9ac47 100644 --- a/qpms/lattices.py +++ b/qpms/lattices.py @@ -138,14 +138,14 @@ class Scattering(object): btime = _time_b(verbose) self.prepare(verbose=verbose) pq_0 = np.broadcast_to(pq_0, (self.N,2,self.nelem)) - MP_0 = np.empty((N,2,nelem),dtype=np.complex_) + MP_0 = np.empty((self.N,2,self.nelem),dtype=np.complex_) for j in range(self.N): MP_0[j] = np.tensordot(self.TMatrices[j], pq_0[j],axes=([-2,-1],[-2,-1])) - MP_0.shape = (N*2*self.nelem,) + MP_0.shape = (self.N*2*self.nelem,) solvebtime = _time_b(verbose,step='Solving the linear equation') ab = scipy.linalg.lu_solve(self.lupiv, MP_0) _time_e(solvebtime, verbose, step='Solving the linear equation') - ab.shape = (N,2,nelem) + ab.shape = (self.N,2,self.nelem) _time_e(btime, verbose) return ab @@ -171,7 +171,7 @@ class Scattering(object): _time_e(btime, verbose) return ab -class Scattering_2D_lattice(Scattering): +class Scattering_2D_lattice_rectcells(Scattering): def __init__(self, rectcell_dims, rectcell_elem_positions, cellspec, k_0, rectcell_TMatrices = None, TMatrices = None, lMax = None, verbose=False, J_scat=3): ''' cellspec: dvojice ve tvaru (seznam_zaplněnosti, seznam_pozic)