Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,4 @@ larsoft-cfg
*.dot
configure

*.gz
10 changes: 10 additions & 0 deletions cfg/wirecell.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,16 @@
// go through a format/parse. Maybe there's a better way?
roundToInt(x):: std.parseInt("%d" % (x+0.5)),

// Like the shell command of the same name.
basename(name, ext="", delim="/") ::
local parts = std.split(name, delim);
local base = parts[std.length(parts)-1];
if std.endsWith(base, ext) then
base[:std.length(base)-std.length(ext)]
else
base,


freqbinner :: function(tick, nsamples) {
nyquist : 0.5 / tick,
hz_perbin : 1.0/(tick/$.second * nsamples),
Expand Down
12 changes: 9 additions & 3 deletions gen/src/AddNoise.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include "WireCellAux/SimpleTrace.h"
#include "WireCellAux/SimpleFrame.h"
#include "WireCellAux/FrameTools.h"


#include <unordered_map>
Expand Down Expand Up @@ -116,6 +117,10 @@ bool Gen::IncoherentAddNoise::operator()(const input_pointer& inframe, output_po
outframe = make_shared<SimpleFrame>(inframe->ident(), inframe->time(), outtraces, inframe->tick());
log->debug("call={} frame={} {} traces",
m_count, inframe->ident(), outtraces.size());

log->debug("input : {}", Aux::taginfo(inframe));
log->debug("output: {}", Aux::taginfo(outframe));

++m_count;
return true;
}
Expand Down Expand Up @@ -194,10 +199,11 @@ bool Gen::CoherentAddNoise::operator()(const input_pointer& inframe, output_poin
outtraces.push_back(trace);
}
outframe = make_shared<SimpleFrame>(inframe->ident(), inframe->time(), outtraces, inframe->tick());
log->debug("call={} frame={} {} traces",
m_count, inframe->ident(), outtraces.size());

log->debug("input : {}", Aux::taginfo(inframe));
log->debug("output: {}", Aux::taginfo(outframe));

++m_count;
return true;

}

6 changes: 4 additions & 2 deletions gen/src/DepoTransform.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include "WireCellAux/SimpleTrace.h"
#include "WireCellAux/SimpleFrame.h"
#include "WireCellAux/DepoTools.h"
#include "WireCellAux/FrameTools.h"

#include "WireCellIface/IAnodePlane.h"

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

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

++m_frame_count;
++m_count;
Expand Down
4 changes: 4 additions & 0 deletions gen/src/Digitizer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ bool Gen::Digitizer::operator()(const input_pointer& vframe, output_pointer& adc
log->debug("call={} traces={} frame={} totadc={} outtag=\"{}\"",
m_count,
adctraces.size(), vframe->ident(), totadc, m_frame_tag);

log->debug("input : {}", Aux::taginfo(vframe));
log->debug("output: {}", Aux::taginfo(adcframe));

++m_count;
return true;
}
4 changes: 4 additions & 0 deletions gen/src/Reframer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "WireCellAux/SimpleFrame.h"
#include "WireCellAux/SimpleTrace.h"
#include "WireCellAux/FrameTools.h"

#include "WireCellUtil/NamedFactory.h"

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

outframe = sframe;

log->debug("input : {}", Aux::taginfo(inframe));
log->debug("output: {}", Aux::taginfo(outframe));

report << "out tag: \"" << m_frame_tag << "\"";
log->debug(report.str());

Expand Down
59 changes: 0 additions & 59 deletions gen/test/history-addnoise.bats

This file was deleted.

53 changes: 36 additions & 17 deletions gen/test/test-addnoise.bats
Original file line number Diff line number Diff line change
Expand Up @@ -10,39 +10,58 @@
# cd ~/path/to/old/release
# bats ~/path/to/new-wct/gen/test/test-addnoise.bats

# bats file_tags=noise,history
# bats file_tags=noise

bats_load_library wct-bats.sh

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

setup_file () {
cd_tmp

local nsamples=6000
local noise=empno
local name="test-addnoise-${noise}-${nsamples}"
local adcfile="${name}.tar.gz" # format with support going back the longest
local cfgfile="${BATS_TEST_FILENAME%.bats}.jsonnet"

run wire-cell -l "$logfile" -L debug \
-A nsamples=$nsamples -A noise=$noise -A outfile="$adcfile" \
-c "$cfgfile"
echo "$output"
[[ "$status" -eq 0 ]]
[[ -s "$adcfile" ]]
saveout -c history "$adcfile"
local cfg_file="${BATS_TEST_FILENAME%.bats}.jsonnet"

run_idempotently -s $cfg_file -t $dag_file -- \
compile_jsonnet $cfg_file $dag_file \
-A nsamples=$nsamples -A noise=$noise -A outfile="$adc_file"

run_idempotently -s $dag_file -t $adc_file -t $log_file -- \
wct -l $log_file -L debug -c $dag_file


# run wire-cell -l "$logfile" -L debug \
# -A nsamples=$nsamples -A noise=$noise -A outfile="$adc_file" \
# -c "$cfgfile"
}

# bats test_tags=history
@test "make history" {
cd_tmp file
[[ -s "$dag_file" ]]
[[ -s "$adc_file" ]]
saveout -c history "$dag_file"
saveout -c history "$adc_file"
}

# The intention is to run this test in multiple releases and compare across releases.
# bats test_tags=plots,implicit
@test "generate simple noise for comparison with older releases" {

cd_tmp file

local wcplot=$(wcb_env_value WCPLOT)
for what in spec wave
do
local pout="${name}-comp1d-${what}.png"
local pout="comp1d-${what}.png"
$wcplot comp1d \
-o $pout \
-t '*' -n $what \
--chmin 0 --chmax 800 -s --transform ac \
"${adcfile}"
"${adc_file}"
echo "$output"
[[ "$status" -eq 0 ]]
[[ -s "$pout" ]]
Expand Down
Loading