Commit 49218708 authored by Philipp Arras's avatar Philipp Arras
Browse files

Actually return amplitude in one-space case

parent beebf0dc
Pipeline #63676 passed with stages
in 9 minutes and 15 seconds
......@@ -38,7 +38,7 @@ if __name__ == '__main__':
fa.add_fluctuations(ift.RGSpace(32), 3, 5, 1, 1e-6, 2,
1e-6, slope_means[1], 1, 'freq')
correlated_field = fa.finalize()
amplitudes = fa.amplitudes
amplitudes = fa.normalized_amplitudes
plt.style.use('seaborn-notebook')
tgt = correlated_field.target
......
......@@ -61,7 +61,7 @@ if __name__ == '__main__':
cfmaker.add_fluctuations(position_space,
1., 1e-2, 1, .5, .1, .5, -3, 0.5, '')
correlated_field = cfmaker.finalize()
A = cfmaker.amplitudes[0]
A = cfmaker.amplitude
# Apply a nonlinearity
signal = ift.sigmoid(correlated_field)
......
......@@ -78,8 +78,8 @@ if __name__ == '__main__':
-1.5, .5, 'amp2')
correlated_field = cfmaker.finalize()
A1 = cfmaker.amplitudes[0]
A2 = cfmaker.amplitudes[1]
A1 = cfmaker.normalized_amplitudes[0]
A2 = cfmaker.normalized_amplitudes[1]
DC = SingleDomain(correlated_field.target, position_space)
# Apply a nonlinearity
......
......@@ -7,7 +7,7 @@ sspace = ift.RGSpace((128,))
fa = ift.CorrelatedFieldMaker.make(10, 0.1, '')
fa.add_fluctuations(sspace, 10, 2, 1, 1e-6, 2, 1e-6, -2, 1e-6, 'spatial')
op = fa.finalize()
A = fa.amplitudes[0]
A = fa.amplitude
cstpos = ift.from_random('normal', op.domain)
p1, p2 = [ift.Plot() for _ in range(2)]
......
......@@ -372,7 +372,7 @@ class CorrelatedFieldMaker:
lst = [('Offset amplitude', self.amplitude_total_offset),
('Total fluctuation amplitude', self.total_fluctuation)]
namps = len(self.amplitudes)
namps = len(self._a)
if namps > 1:
for ii in range(namps):
lst.append(('Slice fluctuation (space {})'.format(ii),
......@@ -399,9 +399,19 @@ class CorrelatedFieldMaker:
return fluctuations_slice_mean/np.mean(np.sqrt(scm))
@property
def amplitudes(self):
def normalized_amplitudes(self):
return self._a
@property
def amplitude(self):
if len(self._a) > 1:
s = ('If more than one spectrum is present in the model,',
' no unique set of amplitudes exist because only the',
' relative scale is determined.')
raise NotImplementedError(s)
expand = VdotOperator(full(self._a[0].target, 1)).adjoint
return self._a[0]*(expand @ self.amplitude_total_offset)
@property
def amplitude_total_offset(self):
return self._azm
......
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