44import ProxNest .utils as utils
55import ProxNest .sampling as sampling
66import ProxNest .optimisations as optimisations
7- import ProxNest .operators as operators
7+ from ProxNest .operators import sensing_operators as sense_ops
88
99def test_against_analytic_gaussian ():
1010 """ Tests ProxNest against analytic Gaussian """
1111
1212 # 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 ()
1514 sigma = 1
1615 iterations = 20
1716 delta = 1 / 2
@@ -22,7 +21,7 @@ def test_against_analytic_gaussian():
2221 # Parameter dictionary associated with optimisation problem of resampling from the prior subject to the likelihood iso-ball
2322 params = utils .create_parameters_dict (
2423 y = image , # Measurements i.e. data
25- Phi = phi , # Forward model
24+ Phi = id , # Forward model
2625 epsilon = 1e-3 , # Radius of L2-ball of likelihood
2726 tight = True , # Is Phi a tight frame or not?
2827 nu = 1 , # Bound on the squared-norm of Phi
@@ -55,16 +54,16 @@ def test_against_analytic_gaussian():
5554 params ["y" ] = image
5655
5756 # 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 )
5958
6059 # 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
6261
6362 # Lambda function for L2-ball likelihood projection during resampling
6463 proxB = lambda x , tau : optimisations .l2_ball_proj .sopt_fast_proj_B2 (x , tau , params )
6564
6665 # Select a starting position
67- X0 = np .abs (phi .adj_op (image ))
66+ X0 = np .abs (id .adj_op (image ))
6867
6968 # Perform proximal nested sampling
7069 NS_BayEvi , NS_Trace = sampling .proximal_nested .ProxNestedSampling (X0 , LogLikeliL , proxH , proxB , params , options )
0 commit comments