mirror of
https://github.com/slsdetectorgroup/aare.git
synced 2025-06-14 16:27:14 +02:00
Feature/reactivate python bindings (#74)
major changes: - add python bindings for all c++ features except network_io - changes to cross compile on windows,linux and macos - fix bugs with cluster_finder - use Dtype in Frame instead of bitdepth - remove boost::program_options and replace with our implementation - add Transforms class that applies a sequence of functions (c++ or python functions) on a Frame. - remove frame reorder and flip from SubFile.cpp. use Transforms instead - Test clusterFinder and Pedestal results in comparison with slsDetectorCalibration --------- Co-authored-by: Bechir <bechir.brahem420@gmail.com> Co-authored-by: Erik Fröjdh <erik.frojdh@gmail.com>
This commit is contained in:
@ -7,33 +7,26 @@
|
||||
using namespace aare;
|
||||
int main() {
|
||||
auto PROJECT_ROOT_DIR = std::filesystem::path(getenv("AARE_ROOT_DIR"));
|
||||
std::filesystem::path const fpath("/mnt/sls_det_storage/moench_data/testNewFW20230714/cu_half_speed_master_4.json");
|
||||
|
||||
NDArray<double, 2> frame({10, 10});
|
||||
frame = 0;
|
||||
|
||||
for (int i = 5; i < 8; i++) {
|
||||
for (int j = 5; j < 8; j++) {
|
||||
frame(i, j) = (i + j) % 10;
|
||||
}
|
||||
std::filesystem::path const fpath("/home/l_bechir/tmp/testNewFW20230714/cu_half_speed_master_4.json");
|
||||
auto f = File(fpath, "r");
|
||||
// calculate pedestal
|
||||
Pedestal pedestal(400,400,1000);
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
auto frame = f.read();
|
||||
pedestal.push<uint16_t>(frame);
|
||||
}
|
||||
|
||||
for (int i = 0; i < frame.shape(0); i++) {
|
||||
for (int j = 0; j < frame.shape(1); j++) {
|
||||
std::cout << frame(i, j) << " ";
|
||||
}
|
||||
std::cout << std::endl;
|
||||
// find clusters
|
||||
ClusterFinder clusterFinder(3, 3, 5, 0);
|
||||
f.seek(0);
|
||||
std::vector<std::vector<Cluster>> clusters_vector;
|
||||
auto start = std::chrono::high_resolution_clock::now();
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
auto frame = f.iread(i);
|
||||
auto clusters = clusterFinder.find_clusters_without_threshold(frame.view<uint16_t>(), pedestal,false);
|
||||
clusters_vector.emplace_back(clusters);
|
||||
}
|
||||
auto end = std::chrono::high_resolution_clock::now();
|
||||
std::chrono::duration<double> elapsed_seconds = end-start;
|
||||
std::cout << "elapsed time: " << elapsed_seconds.count() << "s\n";
|
||||
|
||||
ClusterFinder clusterFinder(3, 3, 1, 1); // 3x3 cluster, 1 nSigma, 1 threshold
|
||||
|
||||
Pedestal p(10, 10);
|
||||
|
||||
auto clusters = clusterFinder.find_clusters(frame.span(), p);
|
||||
|
||||
aare::logger::info("nclusters:", clusters.size());
|
||||
|
||||
for (auto &cluster : clusters) {
|
||||
aare::logger::info("cluster center:", cluster.to_string<double>());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user