diff --git a/idefix/vxl.py b/idefix/vxl.py index 3d99c72..ab27a81 100644 --- a/idefix/vxl.py +++ b/idefix/vxl.py @@ -53,8 +53,9 @@ def get_grid(spatial, step): #ipdb.set_trace() grid = [] - for start, stop, s in zip(bb[0], bb[1], step): - grid += [np.arange(start, stop + 2*s, s)] + for a_min, a_max, a_s in zip(bb[0], bb[1], step): + bins = np.trunc((a_max - a_min) / a_s).astype(int) + 1 + grid += [np.linspace(a_min, a_min + bins * a_s, bins + 1)] return grid diff --git a/test/test_vxl/pc0_grid_s0_6.txt b/test/test_vxl/pc0_grid_s0_6.txt new file mode 100644 index 0000000..5a99bef --- /dev/null +++ b/test/test_vxl/pc0_grid_s0_6.txt @@ -0,0 +1,3 @@ +1.0 1.6 2.2 2.8 3.4 4.0 4.6 5.2 5.8 6.4 7.0 7.6 8.2 8.8 9.4 10.0 10.6 +1.0 1.6 2.2 2.8 3.4 4.0 4.6 5.2 5.8 6.4 7.0 7.6 8.2 8.8 9.4 10.0 10.6 +1.0 1.6 2.2 2.8 3.4 4.0 4.6 5.2 5.8 6.4 7.0 7.6 8.2 8.8 9.4 10.0 10.6 diff --git a/test/test_vxl/pc0_grid_s0_7.txt b/test/test_vxl/pc0_grid_s0_7.txt new file mode 100644 index 0000000..d1c72ec --- /dev/null +++ b/test/test_vxl/pc0_grid_s0_7.txt @@ -0,0 +1,3 @@ +1.0 1.7 2.4 3.1 3.8 4.5 5.2 5.9 6.6 7.3 8.0 8.7 9.4 10.1 +1.0 1.7 2.4 3.1 3.8 4.5 5.2 5.9 6.6 7.3 8.0 8.7 9.4 10.1 +1.0 1.7 2.4 3.1 3.8 4.5 5.2 5.9 6.6 7.3 8.0 8.7 9.4 10.1