mirror of
https://github.com/slsdetectorgroup/aare.git
synced 2025-04-27 00:40:04 +02:00
fixing read bug
This commit is contained in:
parent
caf7b4ecdb
commit
7550a2cb97
@ -75,18 +75,18 @@ void define_cluster_finder_mt_bindings(py::module &m) {
|
|||||||
.def("sync", &ClusterFinderMT<uint16_t, pd_type>::sync)
|
.def("sync", &ClusterFinderMT<uint16_t, pd_type>::sync)
|
||||||
.def("stop", &ClusterFinderMT<uint16_t, pd_type>::stop)
|
.def("stop", &ClusterFinderMT<uint16_t, pd_type>::stop)
|
||||||
.def("start", &ClusterFinderMT<uint16_t, pd_type>::start)
|
.def("start", &ClusterFinderMT<uint16_t, pd_type>::start)
|
||||||
.def_property_readonly("pedestal",
|
.def("pedestal",
|
||||||
[](ClusterFinderMT<uint16_t, pd_type> &self) {
|
[](ClusterFinderMT<uint16_t, pd_type> &self, size_t thread_index) {
|
||||||
auto pd = new NDArray<pd_type, 2>{};
|
auto pd = new NDArray<pd_type, 2>{};
|
||||||
*pd = self.pedestal();
|
*pd = self.pedestal(thread_index);
|
||||||
return return_image_data(pd);
|
return return_image_data(pd);
|
||||||
})
|
},py::arg("thread_index") = 0)
|
||||||
.def_property_readonly("noise",
|
.def("noise",
|
||||||
[](ClusterFinderMT<uint16_t, pd_type> &self) {
|
[](ClusterFinderMT<uint16_t, pd_type> &self, size_t thread_index) {
|
||||||
auto arr = new NDArray<pd_type, 2>{};
|
auto arr = new NDArray<pd_type, 2>{};
|
||||||
*arr = self.noise();
|
*arr = self.noise(thread_index);
|
||||||
return return_image_data(arr);
|
return return_image_data(arr);
|
||||||
});
|
},py::arg("thread_index") = 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void define_cluster_collector_bindings(py::module &m) {
|
void define_cluster_collector_bindings(py::module &m) {
|
||||||
|
@ -35,7 +35,7 @@ void define_cluster_file_io_bindings(py::module &m) {
|
|||||||
[](ClusterFile &self) {
|
[](ClusterFile &self) {
|
||||||
auto v = new ClusterVector<int32_t>(self.read_frame());
|
auto v = new ClusterVector<int32_t>(self.read_frame());
|
||||||
return v;
|
return v;
|
||||||
},py::return_value_policy::take_ownership)
|
})
|
||||||
.def("write_frame", &ClusterFile::write_frame)
|
.def("write_frame", &ClusterFile::write_frame)
|
||||||
.def("read_cluster_with_cut",
|
.def("read_cluster_with_cut",
|
||||||
[](ClusterFile &self, size_t n_clusters,
|
[](ClusterFile &self, size_t n_clusters,
|
||||||
|
@ -72,7 +72,7 @@ ClusterVector<int32_t> ClusterFile::read_clusters(size_t n_clusters) {
|
|||||||
} else {
|
} else {
|
||||||
nn = nph;
|
nn = nph;
|
||||||
}
|
}
|
||||||
nph_read += fread(reinterpret_cast<void *>(buf + nph_read),
|
nph_read += fread((buf + nph_read*clusters.item_size()),
|
||||||
clusters.item_size(), nn, fp);
|
clusters.item_size(), nn, fp);
|
||||||
m_num_left = nph - nn; // write back the number of photons left
|
m_num_left = nph - nn; // write back the number of photons left
|
||||||
}
|
}
|
||||||
@ -87,7 +87,7 @@ ClusterVector<int32_t> ClusterFile::read_clusters(size_t n_clusters) {
|
|||||||
else
|
else
|
||||||
nn = nph;
|
nn = nph;
|
||||||
|
|
||||||
nph_read += fread(reinterpret_cast<void *>(buf + nph_read),
|
nph_read += fread((buf + nph_read*clusters.item_size()),
|
||||||
clusters.item_size(), nn, fp);
|
clusters.item_size(), nn, fp);
|
||||||
m_num_left = nph - nn;
|
m_num_left = nph - nn;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user