diff --git a/generate_images.py b/generate_images.py index 01d3c4d7afb1bf9f88508ce6f84c902225c1f12a..4936a2da5f40dbe727ea84c20071088544bbe164 100644 --- a/generate_images.py +++ b/generate_images.py @@ -448,9 +448,10 @@ class Mapping: pass def init_t_translation(self, t): - self.D[0] = self.deformation["Dx"]*self.phi(t) if ("Dx" in self.deformation.keys()) else 0. - self.D[1] = self.deformation["Dy"]*self.phi(t) if ("Dy" in self.deformation.keys()) else 0. - self.D[2] = self.deformation["Dz"]*self.phi(t) if ("Dz" in self.deformation.keys()) else 0. + self.D[0] = self.deformation["Dx"] if ("Dx" in self.deformation.keys()) else 0. + self.D[1] = self.deformation["Dy"] if ("Dy" in self.deformation.keys()) else 0. + self.D[2] = self.deformation["Dz"] if ("Dz" in self.deformation.keys()) else 0. + self.D *= self.phi(t) def init_t_rotation(self, t): self.C[0] = self.deformation["Cx"] if ("Cx" in self.deformation.keys()) else 0. @@ -472,31 +473,31 @@ class Mapping: self.Rinv[:,:] = numpy.linalg.inv(self.R) def init_t_homogeneous(self, t): - if any(E in self.deformation.keys() for E in ("Exx", "Eyy", "Ezz")): - Exx = self.deformation["Exx"]*self.phi(t) if ("Exx" in self.deformation.keys()) else 0. - Eyy = self.deformation["Eyy"]*self.phi(t) if ("Eyy" in self.deformation.keys()) else 0. - Ezz = self.deformation["Ezz"]*self.phi(t) if ("Ezz" in self.deformation.keys()) else 0. + if (any(E in self.deformation.keys() for E in ("Exx", "Eyy", "Ezz"))): # build F from E + Exx = self.deformation["Exx"] if ("Exx" in self.deformation.keys()) else 0. + Eyy = self.deformation["Eyy"] if ("Eyy" in self.deformation.keys()) else 0. + Ezz = self.deformation["Ezz"] if ("Ezz" in self.deformation.keys()) else 0. self.F = numpy.array([[Exx, 0., 0.], [ 0., Eyy, 0.], - [ 0., 0., Ezz]]) + [ 0., 0., Ezz]])*self.phi(t) self.F *= 2 self.F += numpy.eye(3) w, v = numpy.linalg.eig(self.F) # assert (numpy.diag(numpy.dot(numpy.dot(numpy.transpose(v), self.F), v)) == w).all(), str(numpy.dot(numpy.dot(numpy.transpose(v), self.F), v))+" ≠"+str(numpy.diag(w))+". Aborting." self.F = numpy.dot(numpy.dot(v, numpy.diag(numpy.sqrt(w))), numpy.transpose(v)) else: - Fxx = self.deformation["Fxx"]*self.phi(t) if ("Fxx" in self.deformation.keys()) else 0. - Fyy = self.deformation["Fyy"]*self.phi(t) if ("Fyy" in self.deformation.keys()) else 0. - Fzz = self.deformation["Fzz"]*self.phi(t) if ("Fzz" in self.deformation.keys()) else 0. - Fxy = self.deformation["Fxy"]*self.phi(t) if ("Fxy" in self.deformation.keys()) else 0. - Fyx = self.deformation["Fyx"]*self.phi(t) if ("Fyx" in self.deformation.keys()) else 0. - Fyz = self.deformation["Fyz"]*self.phi(t) if ("Fyz" in self.deformation.keys()) else 0. - Fzy = self.deformation["Fzy"]*self.phi(t) if ("Fzy" in self.deformation.keys()) else 0. - Fzx = self.deformation["Fzx"]*self.phi(t) if ("Fzx" in self.deformation.keys()) else 0. - Fxz = self.deformation["Fxz"]*self.phi(t) if ("Fxz" in self.deformation.keys()) else 0. - self.F = numpy.array([[Fxx, Fxy, Fxz], - [Fyx, Fyy, Fyz], - [Fzx, Fzy, Fzz]]) + Fxx = self.deformation["Fxx"] if ("Fxx" in self.deformation.keys()) else 0. + Fyy = self.deformation["Fyy"] if ("Fyy" in self.deformation.keys()) else 0. + Fzz = self.deformation["Fzz"] if ("Fzz" in self.deformation.keys()) else 0. + Fxy = self.deformation["Fxy"] if ("Fxy" in self.deformation.keys()) else 0. + Fyx = self.deformation["Fyx"] if ("Fyx" in self.deformation.keys()) else 0. + Fyz = self.deformation["Fyz"] if ("Fyz" in self.deformation.keys()) else 0. + Fzy = self.deformation["Fzy"] if ("Fzy" in self.deformation.keys()) else 0. + Fzx = self.deformation["Fzx"] if ("Fzx" in self.deformation.keys()) else 0. + Fxz = self.deformation["Fxz"] if ("Fxz" in self.deformation.keys()) else 0. + self.F = numpy.eye(3) + (numpy.array([[Fxx, Fxy, Fxz], + [Fyx, Fyy, Fyz], + [Fzx, Fzy, Fzz]])-numpy.eye(3))*self.phi(t) self.Finv = numpy.linalg.inv(self.F) def init_t_heart(self, t):