IAP GITLAB

Skip to content
Snippets Groups Projects
Commit fbd877af authored by Dominik Baack's avatar Dominik Baack Committed by ralfulrich
Browse files

Split SaveBoostHistogram into seperate files

parent 50069c02
No related branches found
No related tags found
No related merge requests found
......@@ -21,16 +21,6 @@
namespace corsika {
enum class SaveMode { overwrite, append };
/**
* This functions saves a boost::histogram into a numpy file. Only rather basic axis
* types are supported: regular, variable, integer, category<int>. Only "ordinary" bin
* counts (i.e. a double or int) are supported, nothing fancy like profiles.
*
* Note that this function makes a temporary, dense copy of the histogram, which could
* be an issue for huge sizes (e.g. for high dimensions)
*/
template <class Axes, class Storage>
inline void save_hist(boost::histogram::histogram<Axes, Storage> const& h,
std::string const& filename, SaveMode mode = SaveMode::append) {
......@@ -111,5 +101,6 @@ namespace corsika {
cnpy::npz_save(filename, "data", temp.get(), axes_dims, mode_str);
// In Python this array can directly be assigned to a histogram view if that
// histogram has its axes correspondingly: hist.view(flow=True)[:] = file['data']
}
} // namespace corsika
} // namespace corsika
} // namespace corsika
\ No newline at end of file
/*
* (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu
*
* This software is distributed under the terms of the GNU General Public
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of
* the license.
*/
#pragma once
#include <boost/histogram.hpp>
namespace corsika {
enum class SaveMode { overwrite, append };
/**
* This functions saves a boost::histogram into a numpy file. Only rather basic axis
* types are supported: regular, variable, integer, category<int>. Only "ordinary" bin
* counts (i.e. a double or int) are supported, nothing fancy like profiles.
*
* Note that this function makes a temporary, dense copy of the histogram, which could
* be an issue for huge sizes (e.g. for high dimensions)
*/
template <class Axes, class Storage>
inline void save_hist(boost::histogram::histogram<Axes, Storage> const& h,
std::string const& filename, SaveMode mode = SaveMode::append);
} // namespace corsika
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