I'm trying to merge two grids. The merge seems to be successful and the information seems not to be lost (since a convolute after the merge does show the merged grid to be the sum of the other two) however the .axes() method stops working.
Here's the snippet of code that produces the error:
#!/usr/bin/env python
import numpy as np
from pineappl.grid import Grid
from pineappl.bin import BinRemapper
grid_1 = "./grid1.pineappl.lz4"
grid_2 = "./grid2.pineappl.lz4"
g2_rb = "./grid2_rebin.pineappl.lz4"
gout = "./gout.pineappl.lz4"
main_grid = Grid.read(grid_1)
# Rebin because I don't care about the observable itself
n = len(main_grid.bin_left(0))
rebin = BinRemapper(np.ones(n), [(i, i) for i in range(n)])
main_grid.set_remapper(rebin)
# Rebin also the secondary grid...
second_grid = Grid.read(grid_2)
second_grid.set_remapper(rebin)
second_grid.write(g2_rb)
# Now merge the rebinned grid into the main grid
main_grid.merge_from_file(g2_rb)
# And write out the final grid
main_grid.write(gout)
# At this point pineappl convolute gout ... does produce a result which is grid1 + grid2
# however...
final_grid = Grid.read(gout)
final_grid.axes() # EXCEPTION
The error is:
Traceback (most recent call last):
final_grid.axes() # EXCEPTION
pyo3_runtime.PanicException: called `Option::unwrap()` on a `None` value
I've attached the grid1 and grid2 files to this issue.
grids1_and_2.zip
I'm trying to merge two grids. The merge seems to be successful and the information seems not to be lost (since a
convoluteafter the merge does show the merged grid to be the sum of the other two) however the.axes()method stops working.Here's the snippet of code that produces the error:
The error is:
I've attached the
grid1andgrid2files to this issue.grids1_and_2.zip