CERN / TIGRE

TIGRE: Tomographic Iterative GPU-based Reconstruction Toolbox
BSD 3-Clause "New" or "Revised" License
560 stars 183 forks source link

Python sirt with computel2=True crashes #308

Closed Scriptkiddi closed 3 years ago

Scriptkiddi commented 3 years ago

In PR #263 in https://github.com/CERN/TIGRE/blob/11c477423505c5473c95ef4334e85646798d775e/Python/tigre/algorithms/iterative_recon_alg.py#L332 Changes

            self.l2l.append(errornow)

to

            self.l2l[0,iter]=errornow

which leads to the error message below.

in my opinion this change is ?incorrect? because l2l is initialized as a list.

Expected Behavior

Sirt runs with computel2=True

Actual Behavior

Crashes with

            SIRT algorithm in progress.
Traceback (most recent call last):
  File "main.py", line 137, in <module>
    main()
  File "main.py", line 113, in main
    reconstruction, errL2SIRT = algs.sirt(projections, geo, angles, 60, computel2=True)
  File "/...../miniconda3/envs/tigre/lib/python3.9/site-packages/pytigre-2.1.0-py3.9-linux-x86_64.egg/tigre/algorithms/iterative_recon_alg.py", line 464, in iterativereconalg
    alg.run_main_iter()
  File "/...../miniconda3/envs/tigre/lib/python3.9/site-packages/pytigre-2.1.0-py3.9-linux-x86_64.egg/tigre/algorithms/iterative_recon_alg.py", line 333, in run_main_iter
    self.error_measurement(res_prev, i)
  File "/...../miniconda3/envs/tigre/lib/python3.9/site-packages/pytigre-2.1.0-py3.9-linux-x86_64.egg/tigre/algorithms/iterative_recon_alg.py", line 377, in error_measurement
    self.l2l[0, iter] = errornow
TypeError: list indices must be integers or slices, not tuple

Process finished with exit code 1

Code to reproduce the problem (If applicable)

reconstruction, errL2SIRT = algs.sirt(projections, geo, angles, 60, computel2=True)

Specifications

Python from master

AnderBiguri commented 3 years ago

True! I think the best solution would be to initialize as np.array.