mirror of
https://github.com/slsdetectorgroup/aare.git
synced 2026-02-19 11:48:39 +01:00
added structs with chip defeinitions
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
import numpy as np
|
||||
from . import _aare
|
||||
from aare import ReadoutMode
|
||||
from aare._aare import Matterhorn10
|
||||
|
||||
class AdcSar04Transform64to16:
|
||||
def __call__(self, data):
|
||||
@@ -92,12 +93,8 @@ class Matterhorn10Transform:
|
||||
:type data: np.ndarray
|
||||
:raises ValueError: if not compatible
|
||||
"""
|
||||
expected_size = (Matterhorn10.nRows*Matterhorn10.nCols*self.num_counters*self.dynamic_range)//8 # read_frame returns data in uint8_t
|
||||
|
||||
# TODO maybe better to have definition in matterhorn10 struct
|
||||
rows = 256
|
||||
cols = 256
|
||||
expected_size = (rows*cols*self.num_counters*self.dynamic_range)//8 # read_frame returns data in uint8_t
|
||||
|
||||
if(data.size != expected_size):
|
||||
raise ValueError(f"Data size {data.size} does not match expected size {expected_size} for Matterhorn10 with dynamic range {self.dynamic_range} and num_counters {self.num_counters}.")
|
||||
|
||||
|
||||
25
python/src/bind_Defs.hpp
Normal file
25
python/src/bind_Defs.hpp
Normal file
@@ -0,0 +1,25 @@
|
||||
#include <pybind11/pybind11.h>
|
||||
#include <pybind11/stl.h>
|
||||
|
||||
#include "aare/defs.hpp"
|
||||
|
||||
namespace py = pybind11;
|
||||
using namespace aare;
|
||||
|
||||
void define_defs_bindings(py::module &m) {
|
||||
auto matterhorn10 = py::class_<Matterhorn10>(m, "Matterhorn10");
|
||||
matterhorn10.attr("nRows") = Matterhorn10::nRows;
|
||||
matterhorn10.attr("nCols") = Matterhorn10::nCols;
|
||||
|
||||
auto matterhorn02 = py::class_<Matterhorn02>(m, "Matterhorn02");
|
||||
matterhorn02.attr("nRows") = Matterhorn02::nRows;
|
||||
matterhorn02.attr("nCols") = Matterhorn02::nCols;
|
||||
matterhorn02.attr("nHalfCols") = Matterhorn02::nHalfCols;
|
||||
|
||||
auto moench04 = py::class_<Moench04>(m, "Moench04");
|
||||
moench04.attr("nRows") = Moench04::nRows;
|
||||
moench04.attr("nCols") = Moench04::nCols;
|
||||
moench04.attr("nPixelsPerSuperColumn") = Moench04::nPixelsPerSuperColumn;
|
||||
moench04.attr("superColumnWidth") = Moench04::superColumnWidth;
|
||||
moench04.attr("adcNumbers") = Moench04::adcNumbers;
|
||||
}
|
||||
@@ -9,12 +9,13 @@
|
||||
#include "bind_ClusterFinder.hpp"
|
||||
#include "bind_ClusterFinderMT.hpp"
|
||||
#include "bind_ClusterVector.hpp"
|
||||
#include "bind_Defs.hpp"
|
||||
#include "bind_Eta.hpp"
|
||||
#include "bind_Interpolator.hpp"
|
||||
#include "bind_PixelMap.hpp"
|
||||
#include "bind_calibration.hpp"
|
||||
|
||||
// TODO! migrate the other names
|
||||
#include "bind_PixelMap.hpp"
|
||||
#include "ctb_raw_file.hpp"
|
||||
#include "file.hpp"
|
||||
#include "fit.hpp"
|
||||
@@ -140,6 +141,8 @@ PYBIND11_MODULE(_aare, m) {
|
||||
register_calculate_3x3eta<float, 3, 3, uint16_t>(m);
|
||||
register_calculate_3x3eta<int16_t, 3, 3, uint16_t>(m);
|
||||
|
||||
define_defs_bindings(m);
|
||||
|
||||
using Sum_index_pair_d = Sum_index_pair<double, corner>;
|
||||
PYBIND11_NUMPY_DTYPE(Sum_index_pair_d, sum, index);
|
||||
using Sum_index_pair_f = Sum_index_pair<float, corner>;
|
||||
|
||||
Reference in New Issue
Block a user