Bugs fixed in reading with noise map and color_image speeded up with boost histogram
This commit is contained in:
@ -49,6 +49,8 @@ size_t read_clusters_with_cut(FILE *fp, size_t n_clusters, Cluster *buf,
|
||||
int iframe = 0;
|
||||
uint32_t nph = *n_left;
|
||||
|
||||
uint32_t nn = *n_left;
|
||||
|
||||
size_t nph_read = 0;
|
||||
|
||||
int32_t t2max, tot1;
|
||||
@ -57,8 +59,18 @@ size_t read_clusters_with_cut(FILE *fp, size_t n_clusters, Cluster *buf,
|
||||
int good = 1;
|
||||
double noise;
|
||||
// read photons left from previous frame
|
||||
// if (noise_map)
|
||||
// printf("Using moise map\n");
|
||||
|
||||
if (nph) {
|
||||
for (size_t iph = 0; iph < nph; iph++) {
|
||||
if (nph > n_clusters) {
|
||||
// if we have more photons left in the frame then photons to read we
|
||||
// read directly the requested number
|
||||
nn = n_clusters;
|
||||
} else {
|
||||
nn = nph;
|
||||
}
|
||||
for (size_t iph = 0; iph < nn; iph++) {
|
||||
// read photons 1 by 1
|
||||
size_t n_read = fread((void *)(ptr), sizeof(Cluster), 1, fp);
|
||||
if (n_read != 1) {
|
||||
@ -83,9 +95,9 @@ size_t read_clusters_with_cut(FILE *fp, size_t n_clusters, Cluster *buf,
|
||||
}
|
||||
if (good) {
|
||||
ptr++;
|
||||
nph_read++;
|
||||
(*n_left)--;
|
||||
nph_read++;
|
||||
}
|
||||
(*n_left)--;
|
||||
if (nph_read >= n_clusters)
|
||||
break;
|
||||
}
|
||||
@ -126,9 +138,9 @@ size_t read_clusters_with_cut(FILE *fp, size_t n_clusters, Cluster *buf,
|
||||
}
|
||||
if (good) {
|
||||
ptr++;
|
||||
nph_read++;
|
||||
(*n_left)--;
|
||||
nph_read++;
|
||||
}
|
||||
(*n_left)--;
|
||||
if (nph_read >= n_clusters)
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user