Skip to content
Snippets Groups Projects
Commit d92adfa3 authored by Martin Reinecke's avatar Martin Reinecke
Browse files

remove inverse_draw_sample() for good

parent e9a5b0f1
No related branches found
No related tags found
1 merge request!237Replace InverseOperator and AdjointOperator with OperatorAdapter, and more
Pipeline #
...@@ -70,7 +70,7 @@ class NonlinearPowerEnergy(Energy): ...@@ -70,7 +70,7 @@ class NonlinearPowerEnergy(Energy):
if samples is None or samples == 0: if samples is None or samples == 0:
xi_sample_list = [xi] xi_sample_list = [xi]
else: else:
xi_sample_list = [D.inverse_draw_sample() + xi xi_sample_list = [D.draw_sample(from_inverse=True) + xi
for _ in range(samples)] for _ in range(samples)]
self.xi_sample_list = xi_sample_list self.xi_sample_list = xi_sample_list
self.inverter = inverter self.inverter = inverter
......
...@@ -55,15 +55,3 @@ class EndomorphicOperator(LinearOperator): ...@@ -55,15 +55,3 @@ class EndomorphicOperator(LinearOperator):
A sample from the Gaussian of given covariance. A sample from the Gaussian of given covariance.
""" """
raise NotImplementedError raise NotImplementedError
def inverse_draw_sample(self, dtype=np.float64):
"""Generates a zero-mean sample
Generates a sample from a Gaussian distribution with zero mean and
covariance given by the inverse of the operator.
Returns
-------
A sample from the Gaussian of given covariance
"""
return self.draw_sample(True, dtype)
...@@ -51,7 +51,7 @@ class StatCalculator(object): ...@@ -51,7 +51,7 @@ class StatCalculator(object):
def probe_with_posterior_samples(op, post_op, nprobes): def probe_with_posterior_samples(op, post_op, nprobes):
sc = StatCalculator() sc = StatCalculator()
for i in range(nprobes): for i in range(nprobes):
sample = post_op(op.inverse_draw_sample()) sample = post_op(op.draw_sample(from_inverse=True))
sc.add(sample) sc.add(sample)
if nprobes == 1: if nprobes == 1:
......
...@@ -84,7 +84,7 @@ class Noise_Energy_Tests(unittest.TestCase): ...@@ -84,7 +84,7 @@ class Noise_Energy_Tests(unittest.TestCase):
S=S, S=S,
inverter=inverter).curvature inverter=inverter).curvature
res_sample_list = [d - R(f(ht(C.inverse_draw_sample() + xi))) res_sample_list = [d - R(f(ht(C.draw_sample(from_inverse=True) + xi)))
for _ in range(10)] for _ in range(10)]
energy = ift.library.NoiseEnergy(eta0, alpha, q, res_sample_list) energy = ift.library.NoiseEnergy(eta0, alpha, q, res_sample_list)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment