forked from brettviren/wire-cell-toolkit
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The shift was due to EmpiricalNoiseModel failing to follow the rules and return a spectrum of the configured size. Instead, it returns a size based on "best fft size" near the requested. The IncoherentAddNoise was too trusting and so effectively stretched the spectrum by the difference. IncoherentAddNoise now accepts the wrong size spectrum and truncates the generated noise waveform to the appropriate size.
- Loading branch information
1 parent
66afd44
commit 22154a5
Showing
6 changed files
with
191 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,85 @@ | ||
|
||
# The intention is to run this test in multiple releases and compare across releases. | ||
@test "generate simple noise for comparison with older releases" { | ||
file_base () { | ||
local noise="$1" ; shift | ||
local nsamples="${1:-6000}" | ||
|
||
local ver="$(wire-cell --version)" | ||
local outfile="test-addnoise-${ver}.tar.bz2" | ||
local base="$(basename ${BATS_TEST_FILENAME} .bats)" | ||
echo "test-addnoise-${ver}-${noise}-${nsamples}" | ||
} | ||
|
||
make_noise () { | ||
local noise="$1" ; shift | ||
local nsamples="${1:-6000}" | ||
|
||
local base="$(file_base $noise $nsamples)" | ||
|
||
run wire-cell -l test-addnoise.log -L debug \ | ||
-A outfile="$outfile" -c gen/test/test-addnoise.jsonnet | ||
local cfgfile="${BATS_TEST_FILENAME%.bats}.jsonnet" | ||
|
||
local outfile="${base}.tar.gz" | ||
local logfile="${base}.log" | ||
|
||
rm -f "$logfile" # appends otherwise | ||
if [ -s "$outfile" ] ; then | ||
echo "already have $outfile" 1>&3 | ||
return | ||
fi | ||
run wire-cell -l "$logfile" -L debug \ | ||
-A nsamples=$nsamples -A noise=$noise -A outfile="$outfile" \ | ||
-c "$cfgfile" | ||
echo "$output" | ||
[[ "$status" -eq 0 ]] | ||
[[ -s "$outfile" ]] | ||
} | ||
|
||
|
||
# The intention is to run this test in multiple releases and compare across releases. | ||
@test "generate simple noise for comparison with older releases" { | ||
|
||
|
||
|
||
for nsamples in 6000 | ||
do | ||
for noise in empno | ||
do | ||
make_noise $noise $nsamples | ||
local base="$(file_base $noise $nsamples)" | ||
|
||
wirecell-plot comp1d -o comp1d-addnoise-${ver}-${noise}-${nsamples}.pdf \ | ||
--markers 'o + x .' -t '*' -n spec \ | ||
--chmin 0 --chmax 800 -s --transform ac \ | ||
"${base}.tar.gz" | ||
done | ||
done | ||
# wirecell-plot comp1d -o comp1d-addnoise-${ver}-all-all.pdf \ | ||
# --markers 'o + x .' -t '*' -n spec \ | ||
# --chmin 0 --chmax 800 -s --transform ac \ | ||
# "test-addnoise-${ver}-empno-4096.tar.gz" \ | ||
# "test-addnoise-${ver}-inco-4096.tar.gz" \ | ||
# "test-addnoise-${ver}-empno-6000.tar.gz" \ | ||
# "test-addnoise-${ver}-inco-6000.tar.gz" | ||
|
||
} | ||
|
||
|
||
|
||
@test "inco and empno with external spectra file is identical" { | ||
|
||
for nsamples in 4095 4096 6000 | ||
do | ||
for noise in empno inco | ||
do | ||
make_noise $noise $nsamples | ||
done | ||
|
||
wirecell-plot comp1d \ | ||
-o "$(file_base inco+empno $nsamples)-comp1d.pdf" \ | ||
--markers 'o .' -t '*' -n spec \ | ||
--chmin 0 --chmax 800 -s --transform ac \ | ||
"$(file_base inco $nsamples).tar.gz" \ | ||
"$(file_base empno $nsamples).tar.gz" | ||
|
||
done | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// coherent group noise for PDSP | ||
local one(gid, start, num) = { | ||
plane: "p" + std.toString(gid), | ||
groupID: gid, | ||
channels: std.range(start, start+num-1), | ||
}; | ||
[ | ||
one(1, 0, 400), | ||
one(2, 400, 400), | ||
one(3, 800, 400), | ||
one(4, 1200, 400), | ||
one(5, 1600, 480), | ||
one(6, 2080, 480), | ||
] |