IAP GITLAB

Skip to content
Snippets Groups Projects
Commit cc183aac authored by Maximilian Reininghaus's avatar Maximilian Reininghaus :vulcan:
Browse files

better handling of overflow bins

parent 6bf00c78
No related branches found
No related tags found
No related merge requests found
...@@ -44,7 +44,9 @@ namespace corsika { ...@@ -44,7 +44,9 @@ namespace corsika {
std::vector<double> ax_edges; std::vector<double> ax_edges;
ax_edges.reserve(ax.size()); ax_edges.reserve(ax.size());
for (int j = 0; j <= ax.size(); ++j) { ax_edges.push_back(ax.bin(j).lower()); } for (int j = 0; j < ax.size() + has_overflow; ++j) {
ax_edges.push_back(ax.bin(j).lower());
}
cnpy::npz_save(filename, std::string{"binedges_"} + std::to_string(i), cnpy::npz_save(filename, std::string{"binedges_"} + std::to_string(i),
ax_edges.data(), {ax_edges.size()}, "a"); ax_edges.data(), {ax_edges.size()}, "a");
...@@ -79,7 +81,7 @@ namespace corsika { ...@@ -79,7 +81,7 @@ namespace corsika {
int const offset_underflow = (h.axis(0).options() & 0x01) ? 1 : 0; int const offset_underflow = (h.axis(0).options() & 0x01) ? 1 : 0;
auto p = x.index(0) + offset_underflow; // 1-d-index auto p = x.index(0) + offset_underflow; // 1-d-index
for (size_t axis_index = 1; axis_index < rank; ++axis_index) { for (int axis_index = 1; axis_index < rank; ++axis_index) {
int const offset_underflow = (h.axis(axis_index).options() & 0x01) ? 1 : 0; int const offset_underflow = (h.axis(axis_index).options() & 0x01) ? 1 : 0;
auto k = x.index(axis_index) + offset_underflow; auto k = x.index(axis_index) + offset_underflow;
p = k + p * axes_dims.at(axis_index); p = k + p * axes_dims.at(axis_index);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment