4
4
import ProxNest .utils as utils
5
5
import ProxNest .sampling as sampling
6
6
import ProxNest .optimisations as optimisations
7
- import ProxNest .operators as operators
7
+ from ProxNest .operators import sensing_operators as sense_ops
8
8
9
9
def test_against_analytic_gaussian ():
10
10
""" Tests ProxNest against analytic Gaussian """
11
11
12
12
# A simple identity forward model and redundant dictionary
13
- phi = operators .sensing_operators .Identity ()
14
- psi = operators .sensing_operators .Identity ()
13
+ id = sense_ops .Identity ()
15
14
sigma = 1
16
15
iterations = 20
17
16
delta = 1 / 2
@@ -22,7 +21,7 @@ def test_against_analytic_gaussian():
22
21
# Parameter dictionary associated with optimisation problem of resampling from the prior subject to the likelihood iso-ball
23
22
params = utils .create_parameters_dict (
24
23
y = image , # Measurements i.e. data
25
- Phi = phi , # Forward model
24
+ Phi = id , # Forward model
26
25
epsilon = 1e-3 , # Radius of L2-ball of likelihood
27
26
tight = True , # Is Phi a tight frame or not?
28
27
nu = 1 , # Bound on the squared-norm of Phi
@@ -55,16 +54,16 @@ def test_against_analytic_gaussian():
55
54
params ["y" ] = image
56
55
57
56
# Lambda functions to evaluate cost function
58
- LogLikeliL = lambda sol : - np .linalg .norm (image - phi .dir_op (sol ))** 2 / (2 * sigma ** 2 )
57
+ LogLikeliL = lambda sol : - np .linalg .norm (image - id .dir_op (sol ))** 2 / (2 * sigma ** 2 )
59
58
60
59
# Lambda function for L2-norm identity prior backprojection steps
61
- proxH = lambda x , T : x - 2 * T * psi .adj_op (psi .dir_op (x ))* 2 * delta
60
+ proxH = lambda x , T : x - 2 * T * id .adj_op (id .dir_op (x ))* 2 * delta
62
61
63
62
# Lambda function for L2-ball likelihood projection during resampling
64
63
proxB = lambda x , tau : optimisations .l2_ball_proj .sopt_fast_proj_B2 (x , tau , params )
65
64
66
65
# Select a starting position
67
- X0 = np .abs (phi .adj_op (image ))
66
+ X0 = np .abs (id .adj_op (image ))
68
67
69
68
# Perform proximal nested sampling
70
69
NS_BayEvi , NS_Trace = sampling .proximal_nested .ProxNestedSampling (X0 , LogLikeliL , proxH , proxB , params , options )
0 commit comments