So from the error my guess would be that for some reason
  * `aeff_hist=(38,40)`
  * `bin_sizes[0]=(40,38)`
  * `bin_sizes[1] = (38,40)`

Can you verify this?