JuliaImageRecon / RegularizedLeastSquares.jl

MIT License
20 stars 9 forks source link

info / ProgressBar for iterations #71

Open aTrotier opened 7 months ago

aTrotier commented 7 months ago

Following discussion in : in https://github.com/MagneticResonanceImaging/MRIReco.jl/issues/177

How can I add some way (progressBar or print) for the number of iterations and maybe other useful informations ?

I think we can pass a vector of callback to the solver, can we use that ?

nHackel commented 7 months ago

Yes, this can be achieved with the callbacks. The callbacks are invoked with the current solver and the current iteration, so you could just print the iteration.

By inspecting the solver one could also look at the iterations or look into the iterations parameter of the MPIReco dict to do a progress bar or X/Y done printing:

solution = solve!(S, b, callbacks = (s, i) -> println("$i/$(s.iterations)"))