mirror of
https://asciireactor.com/otho/psdlag-agn.git
synced 2024-11-24 19:55:06 +00:00
fixed the averaging in heasoft->psdlag translation to handle n values in a single bin
This commit is contained in:
parent
30c5ec9803
commit
2fc8861683
@ -47,18 +47,28 @@ while (<>) {
|
|||||||
# This mess to average measurements occuring at the same time coordinate
|
# This mess to average measurements occuring at the same time coordinate
|
||||||
$this_t = "$t𝓃.$t𝜀";
|
$this_t = "$t𝓃.$t𝜀";
|
||||||
if ($this_t == $last_t) {
|
if ($this_t == $last_t) {
|
||||||
if ( $linetoprint =~ /([0-9\.]+)\s+([0-9e\-\.]+)\s+([0-9e\-\.]+)/ ) {
|
if ($heap_count == 0) {
|
||||||
$new_flux_μ = ($flux_μ + $2)/2;
|
if ( $linetoprint =~ /([0-9\.]+)\s+([0-9e\-\.]+)\s+([0-9e\-\.]+)/ ) {
|
||||||
# Could just take the max error
|
$new_flux_μ = $flux_μ + $2;
|
||||||
# $new_flux_σ = max($flux_σ,$3);
|
# Could just take the max error
|
||||||
# Average error seems fair
|
# $new_flux_σ = max($flux_σ,$3);
|
||||||
$new_flux_σ = ($flux_σ + $3)/2;
|
# Average error seems fair
|
||||||
$linetoprint="$this_t $new_flux_μ $new_flux_σ";
|
$new_flux_σ = $flux_σ + $3;
|
||||||
$num_avg++;
|
$num_avg++;
|
||||||
}
|
}
|
||||||
else { die "Malformed data"; }
|
else { die "Malformed data"; }
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$new_flux_μ += $flux_μ;
|
||||||
|
$new_flux_σ += $flux_σ;
|
||||||
|
}
|
||||||
|
$heap_count++;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
$new_flux_μ /= $heap_count;
|
||||||
|
$new_flux_σ /= $heap_count;
|
||||||
|
$linetoprint="$this_t $new_flux_μ $new_flux_σ";
|
||||||
|
our $heap_count = 0;
|
||||||
say $linetoprint;
|
say $linetoprint;
|
||||||
$linetoprint = "$t𝓃.$t𝜀 $flux_μ $flux_σ";
|
$linetoprint = "$t𝓃.$t𝜀 $flux_μ $flux_σ";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user