Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Commit 840068fc authored by Edward Andò's avatar Edward Andò
Browse files

avoid append in deformationField

parent 772c4c6d
Pipeline #51980 passed with stages
in 24 minutes and 34 seconds
......@@ -414,14 +414,19 @@ def decomposeFfield(Ffield, components, twoD=False):
output = {}
for component in components:
output[component] = []
if component == 'vol' or component == 'dev' or component == 'volss' or component == 'devss':
output[component] = numpy.zeros(fieldRavelLength)
if component == 'r' or component == 'z':
output[component] = numpy.zeros((fieldRavelLength, 3))
if component == 'U' or component == 'E' or component == 'e':
output[component] = numpy.zeros((fieldRavelLength, 3, 3))
# Iterate through flat field of Fs
for n in pbar(range(FfieldFlat.shape[0])):
F = FfieldFlat[n]
decomposedF = spam.deformation.decomposeF(F, twoD=twoD)
for component in components:
output[component].append(decomposedF[component])
output[component][n] = decomposedF[component]
# Reshape on the output
for component in components:
......@@ -431,7 +436,7 @@ def decomposeFfield(Ffield, components, twoD=False):
if component == 'r' or component == 'z':
output[component] = numpy.array(output[component]).reshape(Ffield.shape[0:-1])
if component == 'U' or component == 'e':
if component == 'U' or component == 'E' or component == 'e':
output[component] = numpy.array(output[component]).reshape(Ffield.shape)
return output
......@@ -474,14 +479,19 @@ def decomposePhiField(PhiField, components, twoD=False):
output = {}
for component in components:
output[component] = []
if component == 'vol' or component == 'dev' or component == 'volss' or component == 'devss':
output[component] = numpy.zeros(fieldRavelLength)
if component == 't' or component == 'r' or component == 'z':
output[component] = numpy.zeros((fieldRavelLength, 3))
if component == 'U' or component == 'E' or component == 'e':
output[component] = numpy.zeros((fieldRavelLength, 3, 3))
# Iterate through flat field of Fs
# Iterate through flat field of Phis
for n in pbar(range(PhiFieldFlat.shape[0])):
Phi = PhiFieldFlat[n]
decomposedPhi = spam.deformation.decomposePhi(Phi, twoD=twoD)
for component in components:
output[component].append(decomposedPhi[component])
output[component][n] = decomposedPhi[component]
# Reshape on the output
for component in components:
......@@ -491,7 +501,7 @@ def decomposePhiField(PhiField, components, twoD=False):
if component == 't' or component == 'r' or component == 'z':
output[component] = numpy.array(output[component]).reshape(*PhiField.shape[0:-2], 3)
if component == 'U' or component == 'e':
if component == 'U' or component == 'E' or component == 'e':
output[component] = numpy.array(output[component]).reshape(*PhiField.shape[0:-2], 3, 3)
return output
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment