CIL icon indicating copy to clipboard operation
CIL copied to clipboard

added RCGLS

Open paskino opened this issue 5 years ago • 4 comments

Introduces a Regularised CGLS algorithm which would do Tikhonov regularisation with Gradient on all dimensions. It is 10% faster than implementing it with the block framework.

paskino avatar May 13 '20 17:05 paskino

I'll provide an example. ATM I am using it in the electron tomography data.

paskino avatar May 13 '20 17:05 paskino

Currently testing on some 2D+time tomo data. It gives me an error AttributeError: 'Gradient_numpy' object has no attribute 'direct_L21norm' The reason is because Gradient_C cannot handle channels and uses Gradient numpy.

Also from the CGLS simple demo, I am getting

Gradient_C' object has no attribute 'fd_f_L2sum

epapoutsellis avatar May 13 '20 17:05 epapoutsellis

As I said, it is for gradient on all dimensions.

Since it works only with the C backend of the Gradient, to be able to use it you need to rebuild the C library. That's the probable origin of Gradient_C' object has no attribute 'fd_f_L2sum

paskino avatar May 13 '20 22:05 paskino

I'm doing some more basic tests and I found out that the norm we calculate normally with np.dot differs quite a lot with the one calculated with Gradient_C.

For instance use this file to test and change alpha. The following is for alpha=1.

basically here a is calculating the squared norm of the output of direct or adjoint with squared_norm and b is with Gradient_C.direct_L21norm and relative adjoint_L21norm. As you can see the numbers are very similar but very different in machine precision.

This then leads to very unexpected behaviour of RGCLS

testing 
a 121.75004577636719
b 121.74970356811536
direct decimal 3
testing 
a 529.4775390625
b 529.4817953544953
testing 
a 529.4775390625
b 529.4817953544953
adjoint decimal 2 2
testing 
a 121.75004577636719
b 121.74970356811536
scaled direct decimal 3
<class 'ccpi.framework.BlockDataContainer.BlockDataContainer'>
testing 
a 121.75004577636719
b 121.74970356811536
scaled direct decimal with L21norm 3
testing 
a 529.4775390625
b 529.4817953544953
scaled adjoint decimal1 using scaled direct 2
testing 
a 529.4775390625
b 529.4817953544953
scaled adjoint decimal2 using L21 scaled 2

paskino avatar May 22 '20 07:05 paskino