Skip to content

Commit 095eace

Browse files
authored
Merge pull request #216 from WireCell/check-test2
Check test2
2 parents c7c832a + 8249fe3 commit 095eace

33 files changed

Lines changed: 943 additions & 650 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,4 @@ larsoft-cfg
7676
*.dot
7777
configure
7878

79+
*.gz

cfg/wirecell.jsonnet

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,16 @@
334334
// go through a format/parse. Maybe there's a better way?
335335
roundToInt(x):: std.parseInt("%d" % (x+0.5)),
336336

337+
// Like the shell command of the same name.
338+
basename(name, ext="", delim="/") ::
339+
local parts = std.split(name, delim);
340+
local base = parts[std.length(parts)-1];
341+
if std.endsWith(base, ext) then
342+
base[:std.length(base)-std.length(ext)]
343+
else
344+
base,
345+
346+
337347
freqbinner :: function(tick, nsamples) {
338348
nyquist : 0.5 / tick,
339349
hz_perbin : 1.0/(tick/$.second * nsamples),

gen/src/AddNoise.cxx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
#include "WireCellAux/SimpleTrace.h"
77
#include "WireCellAux/SimpleFrame.h"
8+
#include "WireCellAux/FrameTools.h"
89

910

1011
#include <unordered_map>
@@ -116,6 +117,10 @@ bool Gen::IncoherentAddNoise::operator()(const input_pointer& inframe, output_po
116117
outframe = make_shared<SimpleFrame>(inframe->ident(), inframe->time(), outtraces, inframe->tick());
117118
log->debug("call={} frame={} {} traces",
118119
m_count, inframe->ident(), outtraces.size());
120+
121+
log->debug("input : {}", Aux::taginfo(inframe));
122+
log->debug("output: {}", Aux::taginfo(outframe));
123+
119124
++m_count;
120125
return true;
121126
}
@@ -194,10 +199,11 @@ bool Gen::CoherentAddNoise::operator()(const input_pointer& inframe, output_poin
194199
outtraces.push_back(trace);
195200
}
196201
outframe = make_shared<SimpleFrame>(inframe->ident(), inframe->time(), outtraces, inframe->tick());
197-
log->debug("call={} frame={} {} traces",
198-
m_count, inframe->ident(), outtraces.size());
202+
203+
log->debug("input : {}", Aux::taginfo(inframe));
204+
log->debug("output: {}", Aux::taginfo(outframe));
205+
199206
++m_count;
200207
return true;
201-
202208
}
203209

gen/src/DepoTransform.cxx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
#include "WireCellAux/SimpleTrace.h"
4545
#include "WireCellAux/SimpleFrame.h"
4646
#include "WireCellAux/DepoTools.h"
47+
#include "WireCellAux/FrameTools.h"
4748

4849
#include "WireCellIface/IAnodePlane.h"
4950

@@ -205,8 +206,9 @@ bool Gen::DepoTransform::operator()(const input_pointer& in, output_pointer& out
205206
}
206207

207208
auto frame = make_shared<SimpleFrame>(m_frame_count, m_start_time, traces, m_tick);
208-
log->debug("call={} frame={} ndepos_in={} ndepos_used={} ntraces={}",
209-
m_count, m_frame_count, depos->size(), ndepos_used, traces.size());
209+
log->debug("call={} count={} ndepos_in={} ndepos_used={}",
210+
m_count, m_frame_count, depos->size(), ndepos_used);
211+
log->debug("output: {}", Aux::taginfo(frame));
210212

211213
++m_frame_count;
212214
++m_count;

gen/src/Digitizer.cxx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,10 @@ bool Gen::Digitizer::operator()(const input_pointer& vframe, output_pointer& adc
165165
log->debug("call={} traces={} frame={} totadc={} outtag=\"{}\"",
166166
m_count,
167167
adctraces.size(), vframe->ident(), totadc, m_frame_tag);
168+
169+
log->debug("input : {}", Aux::taginfo(vframe));
170+
log->debug("output: {}", Aux::taginfo(adcframe));
171+
168172
++m_count;
169173
return true;
170174
}

gen/src/Reframer.cxx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include "WireCellAux/SimpleFrame.h"
55
#include "WireCellAux/SimpleTrace.h"
6+
#include "WireCellAux/FrameTools.h"
67

78
#include "WireCellUtil/NamedFactory.h"
89

@@ -151,6 +152,9 @@ bool Gen::Reframer::operator()(const input_pointer& inframe, output_pointer& out
151152

152153
outframe = sframe;
153154

155+
log->debug("input : {}", Aux::taginfo(inframe));
156+
log->debug("output: {}", Aux::taginfo(outframe));
157+
154158
report << "out tag: \"" << m_frame_tag << "\"";
155159
log->debug(report.str());
156160

gen/test/history-addnoise.bats

Lines changed: 0 additions & 59 deletions
This file was deleted.

gen/test/test-addnoise.bats

Lines changed: 36 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,39 +10,58 @@
1010
# cd ~/path/to/old/release
1111
# bats ~/path/to/new-wct/gen/test/test-addnoise.bats
1212

13-
# bats file_tags=noise,history
13+
# bats file_tags=noise
1414

1515
bats_load_library wct-bats.sh
1616

17-
# The intention is to run this test in multiple releases and compare across releases.
18-
# bats test_tags=history,plots,implicit
19-
@test "generate simple noise for comparison with older releases" {
17+
log_file="wire-cell.log"
18+
adc_file="frames-adc.tar.gz"
19+
dag_file="dag.json"
2020

21+
setup_file () {
2122
cd_tmp
2223

2324
local nsamples=6000
2425
local noise=empno
25-
local name="test-addnoise-${noise}-${nsamples}"
26-
local adcfile="${name}.tar.gz" # format with support going back the longest
27-
local cfgfile="${BATS_TEST_FILENAME%.bats}.jsonnet"
28-
29-
run wire-cell -l "$logfile" -L debug \
30-
-A nsamples=$nsamples -A noise=$noise -A outfile="$adcfile" \
31-
-c "$cfgfile"
32-
echo "$output"
33-
[[ "$status" -eq 0 ]]
34-
[[ -s "$adcfile" ]]
35-
saveout -c history "$adcfile"
26+
local cfg_file="${BATS_TEST_FILENAME%.bats}.jsonnet"
27+
28+
run_idempotently -s $cfg_file -t $dag_file -- \
29+
compile_jsonnet $cfg_file $dag_file \
30+
-A nsamples=$nsamples -A noise=$noise -A outfile="$adc_file"
31+
32+
run_idempotently -s $dag_file -t $adc_file -t $log_file -- \
33+
wct -l $log_file -L debug -c $dag_file
34+
35+
36+
# run wire-cell -l "$logfile" -L debug \
37+
# -A nsamples=$nsamples -A noise=$noise -A outfile="$adc_file" \
38+
# -c "$cfgfile"
39+
}
40+
41+
# bats test_tags=history
42+
@test "make history" {
43+
cd_tmp file
44+
[[ -s "$dag_file" ]]
45+
[[ -s "$adc_file" ]]
46+
saveout -c history "$dag_file"
47+
saveout -c history "$adc_file"
48+
}
49+
50+
# The intention is to run this test in multiple releases and compare across releases.
51+
# bats test_tags=plots,implicit
52+
@test "generate simple noise for comparison with older releases" {
53+
54+
cd_tmp file
3655

3756
local wcplot=$(wcb_env_value WCPLOT)
3857
for what in spec wave
3958
do
40-
local pout="${name}-comp1d-${what}.png"
59+
local pout="comp1d-${what}.png"
4160
$wcplot comp1d \
4261
-o $pout \
4362
-t '*' -n $what \
4463
--chmin 0 --chmax 800 -s --transform ac \
45-
"${adcfile}"
64+
"${adc_file}"
4665
echo "$output"
4766
[[ "$status" -eq 0 ]]
4867
[[ -s "$pout" ]]

0 commit comments

Comments
 (0)