Problem reconstructing single slice with binning_z

On the dataset "bamboo", I want to reconstruct the slice 0 with the following parameters:

binning = 3
binning_z = 3
projections_subsampling = 2

with the command:

nabu nabu.conf --slice 0 

I get the following error:

Loading darks and refs from /tmp/paleo/bamboo/tomwer_processes.h5
Overwriting config file start_z to 0 and end_z to 0
Going to reconstruct slices (0, 0)
Estimated phase margin: 8 pixels

Processing sub-volume (0, 9)
Creating a new pipeline object
Data shape for flatfield is (2000, 3, 853)
Data shape for double_flatfield is (2000, 3, 853)
Data shape for phase is (3, 853)
Data shape for take_log is (2000, -5, 853)
Data shape for build_sino is (2000, -5, 853)
Allocating recs: (-5, 853, 853)
Traceback (most recent call last):
  File "/scisoft/tomotools_env/py38_ubuntu20_pow9/bin/nabu", line 8, in <module>
    sys.exit(main())
  File "/scisoft/tomotools_env/py38_ubuntu20_pow9/lib/python3.8/site-packages/nabu/resources/cli/reconstruct.py", line 146, in main
    R.reconstruct()
  File "/scisoft/tomotools_env/py38_ubuntu20_pow9/lib/python3.8/site-packages/nabu/app/local_reconstruction.py", line 264, in reconstruct
    self._instantiate_pipeline_if_necessary(task, prev_task)
  File "/scisoft/tomotools_env/py38_ubuntu20_pow9/lib/python3.8/site-packages/nabu/app/local_reconstruction.py", line 240, in _instantiate_pipeline_if_necessary
    self._instantiate_pipeline(current_task)
  File "/scisoft/tomotools_env/py38_ubuntu20_pow9/lib/python3.8/site-packages/nabu/app/local_reconstruction.py", line 227, in _instantiate_pipeline
    pipeline = self._pipeline_cls(
  File "/scisoft/tomotools_env/py38_ubuntu20_pow9/lib/python3.8/site-packages/nabu/app/fullfield_cuda.py", line 37, in __init__
    super().__init__(
  File "/scisoft/tomotools_env/py38_ubuntu20_pow9/lib/python3.8/site-packages/nabu/app/fullfield.py", line 66, in __init__
    self._init_pipeline()
  File "/scisoft/tomotools_env/py38_ubuntu20_pow9/lib/python3.8/site-packages/nabu/app/fullfield.py", line 311, in _init_pipeline
    self._prepare_reconstruction()
  File "/scisoft/tomotools_env/py38_ubuntu20_pow9/lib/python3.8/site-packages/nabu/app/utils.py", line 20, in wrapper
    return func(*args, **kwargs)
  File "/scisoft/tomotools_env/py38_ubuntu20_pow9/lib/python3.8/site-packages/nabu/app/fullfield.py", line 440, in _prepare_reconstruction
    self._allocate_recs(y_e - y_s, x_e - x_s)
  File "/scisoft/tomotools_env/py38_ubuntu20_pow9/lib/python3.8/site-packages/nabu/app/fullfield.py", line 277, in _allocate_recs
    self.recs = self._allocate_array((self.n_slices, ny, nx), "f", name="recs")
  File "/scisoft/tomotools_env/py38_ubuntu20_pow9/lib/python3.8/site-packages/nabu/app/fullfield_cuda.py", line 59, in _allocate_array
    d_arr = garray.zeros(shape, dtype)
  File "/scisoft/tomotools_env/py38_ubuntu20_pow9/lib/python3.8/site-packages/pycuda/gpuarray.py", line 1066, in zeros
    result = GPUArray(shape, dtype, allocator, order=order)
  File "/scisoft/tomotools_env/py38_ubuntu20_pow9/lib/python3.8/site-packages/pycuda/gpuarray.py", line 210, in __init__
    self.gpudata = self.allocator(self.size * self.dtype.itemsize)
OverflowError: can't convert negative value to unsigned int

The data is reshaped by subtracting phase margin to original shape. In this case, not enough data is loaded in the first place. sub_region should account for binning.

Edited by Pierre Paleo