Commit 09c9b645 authored by Martin Reinecke's avatar Martin Reinecke
Browse files

rewrite for clarity

parent 66480b63
Pipeline #19439 passed with stage
in 4 minutes and 18 seconds
...@@ -213,11 +213,13 @@ class Field(object): ...@@ -213,11 +213,13 @@ class Field(object):
else: else:
parts = [self.real*self.real + self.imag*self.imag] parts = [self.real*self.real + self.imag*self.imag]
parts = [ part.weight(1,spaces) for part in parts ]
for space_index in spaces: for space_index in spaces:
parts = [self._single_power_analyze(field=part, parts = [self._single_power_analyze(field=part,
idx=space_index, idx=space_index,
binbounds=binbounds) binbounds=binbounds)
for part in parts] for part in parts]
parts = [ part.weight(-1,spaces) for part in parts ]
return parts[0] + 1j*parts[1] if keep_phase_information else parts[0] return parts[0] + 1j*parts[1] if keep_phase_information else parts[0]
...@@ -233,10 +235,6 @@ class Field(object): ...@@ -233,10 +235,6 @@ class Field(object):
power_spectrum = dobj.bincount_axis(pindex, weights=field.val, power_spectrum = dobj.bincount_axis(pindex, weights=field.val,
axis=axes) axis=axes)
new_rho_shape = [1] * len(power_spectrum.shape)
new_rho_shape[axes[0]] = power_domain.dim
power_spectrum /= power_domain.dvol().reshape(new_rho_shape)
power_spectrum *= field.domain[idx].scalar_dvol()
result_domain = list(field.domain) result_domain = list(field.domain)
result_domain[idx] = power_domain result_domain[idx] = power_domain
return Field(result_domain, power_spectrum) return Field(result_domain, power_spectrum)
......
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