Commit 62ecfb9a authored by Roel Aaij's avatar Roel Aaij
Browse files

Remove some unused variables and run Python tests from cmake

parent 6f44fdc1
......@@ -6,3 +6,4 @@ build/
# OS X
.DS_Store
.dir-locals.el
\ No newline at end of file
set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++)
......@@ -83,10 +83,7 @@ class CatchTestCommand(test_ext):
version=sys.version_info)
def run(self):
# Run Python tests
super(CatchTestCommand, self).run()
print("\nPython tests complete, now running C++ tests...\n")
# Run catch tests
# Run CMake tests
subprocess.call(['ctest -V'],
cwd=os.path.join('build',
self.distutils_dir_name('temp')),
......
......@@ -32,14 +32,6 @@ namespace {
using std::pair;
using std::vector;
using std::array;
// from fit to Gaussian part of ToT distribution
const float_t tot_mean = 26.936f;
const float_t tot_sigma = 2.44078f;
const int n_pmt = 31;
const int random_method = 2;
}
Generators::Generators(const int seed0, const int seed1, const std::array<float, 4> rates)
......
......@@ -59,7 +59,6 @@ std::tuple<storage_t, storage_t> generate_scalar(const long time_start, const lo
for (int mod = 0; mod < storage::n_mod; ++mod) {
size_t mod_start = idx;
long offset = 0l;
long last = 0l;
while(last < time_end && idx < times.size() - 2) {
// Generate times
......
#include "pybind11/pybind11.h"
#include "pybind11/stl.h"
#include "xtensor/xmath.hpp"
#include "xtensor/xarray.hpp"
#define FORCE_IMPORT_ARRAY
#include "xtensor-python/pyarray.hpp"
#include "xtensor-python/pyvectorize.hpp"
#include <iostream>
#include <numeric>
#include <cmath>
#include <km3net/generate.h>
namespace py = pybind11;
inline xt::pyarray<long>
generate_k40(const long start, const long end, const Generators& gens, bool avx2)
{
auto r = generate(start, end, gens, avx2);
auto times = std::get<0>(r);
auto values = std::get<1>(r);
auto n = times.size();
times.resize(2 * n);
std::copy(begin(values), end(values), begin(times) + n);
return xt::adapt(std::move(times), std::array<size_t>{2, n});
}
// Python Module and Docstrings
PYBIND11_MODULE(k40-gen, m)
{
xt::import_numpy();
py::class_<Generators>(m, "Generators")
.def(py::init<const uint, const uint, std::array<float, 4>>());
m.doc() = R"pbdoc(
standalong background generator for KM3NeT
.. currentmodule:: k40-gen
.. autosummary::
:toctree: _generate
generate_k40
)pbdoc";
m.def("generate_k40", generate_k40, "Generate K40 background");
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment