pufmaizo

pufmaizo (popcorn in Esperanto) is a set of tools for handling and analyzing Popcorn data.
Installation
$> go install git.sr.ht/~sbinet/pufmaizo/...@latest
Commands
cmd/puf-srv
Command puf-srv runs a web server that can launch popcorn analyses.
$> puf-srv -h
Usage of puf-srv:
-addr string
[host]:port to listen on (default "localhost:8080")
-root string
path to storage directory

cmd/puf-simu
Command puf-simu generates a calibration database from a set of simulation data files.
$> puf-simu -h
Usage of puf-simu:
-emin float
energy spectrum cut off (in keV) (default 1000)
-i string
path to input simulation data (default "./sim-data/PTFE_Po210_1290hPa")
-ncpu int
number of parallel workers (default 1)
-noise float
gaussian noise to convolve with simulation (in keV) (default 90)
-o string
path to output calibration db (default "calib-puf.db")
-seed1 uint
seed1 for PRNG (default=epoch)
-seed2 uint
seed2 for PRNG (default=epoch)
$> time puf-simu -seed1=1234 -seed2=1234 -ncpu=8 -i ./sim-data/
puf: found 2710 simulations
puf: processing sim-data/CELL_Po210_allP/output/output_D1_P1_Z8/ActorPips_edepHisto.txt ...
puf: processing sim-data/CELL_Po210_allP/output/output_D1_P1_Z4/ActorPips_edepHisto.txt ...
puf: processing sim-data/CELL_Po210_allP/output/output_D1_P1_Z2/ActorPips_edepHisto.txt ...
puf: processing sim-data/CELL_Po210_allP/output/output_D1_P1_Z6/ActorPips_edepHisto.txt ...
puf: processing sim-data/CELL_Po210_allP/output/output_D1_P1_Z5/ActorPips_edepHisto.txt ...
[...]
puf: processing sim-data/CELL_Po210_allP/output/output_D1_P1_Z18/ActorPips_edepHisto.txt ...
puf: skipping: Po210|CELL|D1|P1|Z18 (peak=0.20850000000000002 < 1)
puf: processing sim-data/CELL_Po210_allP/output/output_D1_P1_Z19/ActorPips_edepHisto.txt ...
puf: skipping: Po210|CELL|D1|P1|Z19 (peak=0.1775 < 1)
puf: processing sim-data/CELL_Po210_allP/output/output_D1_P1_Z20/ActorPips_edepHisto.txt ...
puf: skipping: Po210|CELL|D1|P1|Z20 (peak=0.1455 < 1)
[...]
puf: → retry [Po214|CELL|D1|P2|Z15]: could not fit lhoir: optimize: initial function value is NaN
puf: → retry [Po214|CELL|D1|P2|Z15]: could not fit lhoir: optimize: initial function value is NaN
puf: → retry [Po214|CELL|D1|P2|Z15]: could not fit lhoir: optimize: initial function value is NaN
[...]
puf: processing sim-data/PTFE_Po218_allP/output/output_D3_P4_Z18/ActorPips_edepHisto.txt ...
puf: processing sim-data/PTFE_Po218_allP/output/output_D3_P4_Z19/ActorPips_edepHisto.txt ...
puf: analyzed 2710 simulations
real 8m19.103s
user 62m14.629s
sys 0m07.946s
$> ll calib-puf.db
-rw-r--r-- 1 binet binet 392K Sep 29 17:58 calib-puf.db
cmd/puf-ana
Command puf-ana analyses a set of data files.
$> puf-ana -h
Usage of puf-ana:
-o string
path to output results directory (default "./results")
-tz string
time zone to use for analysis (default "Europe/Paris")
$> time puf-ana ./data/filters/variable-flux-et20-0829-D4-BN1.info
puf: filter info: name="et20-0829-D4-BN1", type="PTFE1"
puf: DAQ: 4
puf: Run: {run 2020-08-29 13:38:38.011 +0000 +0000 2020-08-29 14:38:38.076 +0000 +0000 1h0m0s}
puf: Infos: 2
puf: RAVIOLI: RAVIOLI1
puf: COMPASS: V2
puf: Path: data/ACQ_CAEN/et20-0829-D4-BN1/DAQ/run/UNFILTERED/Data_CH1@DT5724B_1411_run.csv
puf: Events: 661568
puf: RAVIOLI: RAVIOLI1
puf: COMPASS: V2
puf: Path: data/ACQ_CAEN/et20-0829-D4-BN1/DAQ/run/UNFILTERED/Data_CH2@DT5724B_1411_run.csv
puf: Events: 3007
puf: Run: {run 2020-08-30 14:05:33.776 +0000 +0000 2020-08-30 17:49:37.753 +0000 +0000 3h44m3s}
puf: Infos: 2
puf: RAVIOLI: RAVIOLI1
puf: COMPASS: V2
puf: Path: data/ACQ_CAEN/et20-0829-D4-BN1-2/DAQ/run/UNFILTERED/Data_CH1@DT5724B_1411_run.csv
puf: Events: 3735350
puf: RAVIOLI: RAVIOLI1
puf: COMPASS: V2
puf: Path: data/ACQ_CAEN/et20-0829-D4-BN1-2/DAQ/run/UNFILTERED/Data_CH2@DT5724B_1411_run.csv
puf: Events: 1845
puf: Run: {run 2020-10-01 14:47:01.523 +0200 CEST 2020-10-02 10:06:26.913 +0200 CEST 19h19m25s}
puf: Infos: 1
puf: RAVIOLI: RAVIOLI1
puf: COMPASS: V2
puf: Path: data/ACQ_CAEN/et20-0829-D4-BN1-LPC1/DAQ/run/UNFILTERED/Data_CH2@DT5724B_1411_run.csv
puf: Events: 89513
puf: Run: {run 2020-10-02 10:54:53.066 +0200 CEST 2020-10-02 19:17:44.122 +0200 CEST 8h22m51s}
puf: Infos: 1
puf: RAVIOLI: RAVIOLI1
puf: COMPASS: V2
puf: Path: data/ACQ_CAEN/et20-0829-D4-BN1-LPC2/DAQ/run/UNFILTERED/Data_CH2@DT5724B_1411_run.csv
puf: Events: 15894
puf: BKG: 4
puf: Run: {run 2020-08-29 11:13:10.806 +0000 +0000 2020-08-29 11:44:15.849 +0000 +0000 31m5s}
puf: Infos: 2
puf: RAVIOLI: RAVIOLI1
puf: COMPASS: V2
puf: Path: data/ACQ_BCKG/et20-0829-R1-BCKG1/DAQ/run/UNFILTERED/Data_CH1@DT5724B_1411_run.csv
puf: Events: 345635
puf: RAVIOLI: RAVIOLI1
puf: COMPASS: V2
puf: Path: data/ACQ_BCKG/et20-0829-R1-BCKG1/DAQ/run/UNFILTERED/Data_CH2@DT5724B_1411_run.csv
puf: Events: 325
puf: Run: {run 2020-08-30 10:54:55.335 +0000 +0000 2020-08-30 11:25:23.019 +0000 +0000 30m27s}
puf: Infos: 2
puf: RAVIOLI: RAVIOLI1
puf: COMPASS: V2
puf: Path: data/ACQ_BCKG/et20-0830-R1-BCKG1/DAQ/run/UNFILTERED/Data_CH1@DT5724B_1411_run.csv
puf: Events: 505192
puf: RAVIOLI: RAVIOLI1
puf: COMPASS: V2
puf: Path: data/ACQ_BCKG/et20-0830-R1-BCKG1/DAQ/run/UNFILTERED/Data_CH2@DT5724B_1411_run.csv
puf: Events: 301
puf: Run: {run 2020-09-17 15:05:07.559 +0200 CEST 2020-09-18 15:33:59.369 +0200 CEST 24h28m51s}
puf: Infos: 1
puf: RAVIOLI: RAVIOLI1
puf: COMPASS: V2
puf: Path: data/ACQ_BCKG/lpc20-0917-R1-BCKG1/DAQ/run/UNFILTERED/Data_CH2@DT5724B_1411_run.csv
puf: Events: 11177
puf: Run: {run 2020-09-17 15:05:07.559 +0200 CEST 2020-09-18 15:33:59.369 +0200 CEST 24h28m51s}
puf: Infos: 1
puf: RAVIOLI: RAVIOLI1
puf: COMPASS: V2
puf: Path: data/ACQ_BCKG/lpc20-0917-R1-BCKG1/DAQ/run/UNFILTERED/Data_CH2@DT5724B_1411_run.csv
puf: Events: 11177
puf: starting preliminary review of "et20-0829-D4-BN1"...
puf: analyzing DAQ 1/4...
puf: unique flags: 6: [0x0, 0x1, 0x80, 0x81, 0x8000, 0x8001]
puf: number of correct events: 649502 (98.176151%)
puf: number of saturation events: 5306 (0.802034%)
puf: number of pile-up events: 1511 (0.228397%)
puf: unique flags: 2: [0x0, 0x8000]
puf: number of correct events: 2990 (99.434652%)
puf: number of saturation events: 0 (0.000000%)
puf: number of pile-up events: 17 (0.565348%)
puf: analyzing DAQ 2/4...
puf: unique flags: 6: [0x0, 0x1, 0x80, 0x81, 0x8000, 0x8001]
puf: number of correct events: 3711161 (99.352430%)
puf: number of saturation events: 5556 (0.148741%)
puf: number of pile-up events: 13096 (0.350596%)
puf: unique flags: 3: [0x0, 0x80, 0x8000]
puf: number of correct events: 1740 (94.308943%)
puf: number of saturation events: 65 (3.523035%)
puf: number of pile-up events: 40 (2.168022%)
puf: analyzing DAQ 3/4...
puf: unique flags: 3: [0x0, 0x80, 0x8000]
puf: number of correct events: 6062 (6.772201%)
puf: number of saturation events: 76788 (85.784188%)
puf: number of pile-up events: 6663 (7.443612%)
puf: analyzing DAQ 4/4...
puf: unique flags: 4: [0x0, 0x80, 0x8000, 0x8001]
puf: number of correct events: 1838 (11.564112%)
puf: number of saturation events: 5706 (35.900340%)
puf: number of pile-up events: 8350 (52.535548%)
puf: roi-start: 140
puf: roi-stop: 185
puf: energy calibration: rn="Po214", D="D2", P="P4", Z="Z2"...
puf: starting alpha energy calibration
puf: Best fit Po214 - Chi²/NdF = 38.33235137962646/43 = 0.8914500320843363 - peak position = 177.61291926686448 ADC ch
puf: calib: μ = 7.405338e+00
puf: conv: 41.69368750349163
puf: conf-interval:
⎡1321.604 -45.613 177.180 0.400 27.704 27.648⎤
⎣1705.509 64.081 178.046 1.605 30.623 30.679⎦
puf: origIncMu=[1.77179659285509e+02, 1.78046179248220e+02] -> [-0.4332599813553486, 0.4332599813553486]
puf: calibration coefficient is 41.69368750349163 ± 2.4393494749352826 keV/ch
puf: shape-damping matrix(rn="Po214", filter="PTFE", dlvl="D2", plvl="P4", conv=4.16936875034916e+01, roi=[140, 185])...
puf: sum(data) = 1.10100000000000e+03
puf: sum(simu) = 3.98103555559434e-01
puf: reduced χ² = 836.9831281522787/43 = 19.46472391051811
puf: data / simulation comparison [done]
puf: log-info: "data/ACQ_CAEN/et20-0829-D4-BN1/DAQ/run/UNFILTERED/Data_CH2@DT5724B_1411_run.csv"
puf: roi: "ROI1" [140, 185]
puf: conv: 41.69368750349163
puf: spectrum: chi2=38.33235137962646
puf: shape-damping matrix(rn="Po214", filter="PTFE", dlvl="D2", plvl="P4", conv=4.16936875034916e+01, roi=[140, 185])...
puf: cond(matrix of inversion)= 6.642644713673642e+10
puf: In case of large value, the problem might not be well posed.
puf: sum(invCovData)= 1101.1999999999998
puf: l-curve...
puf: shape-damping matrix(rn="Po218", filter="PTFE", dlvl="D2", plvl="P4", conv=4.16936875034916e+01, roi=[140, 185])...
puf: shape-damping matrix(rn="Po214", filter="PTFE", dlvl="D2", plvl="P4", conv=4.16936875034916e+01, roi=[140, 185])...
puf: shape-damping matrix(rn="Po218", filter="PTFE", dlvl="D2", plvl="P4", conv=4.16936875034916e+01, roi=[120, 140])...
puf: shape-damping matrix(rn="Po214", filter="PTFE", dlvl="D2", plvl="P4", conv=4.16936875034916e+01, roi=[120, 140])...
puf: prepare-inversion: #DAQs=4
puf: doing C1...
puf: doing C2...
puf: doing C3...
puf: doing C4...
puf: inversion-all: name="et20-0829-D4-BN1", type="PTFE1"
puf: #daqs: 4
puf: #bkgs: 4
puf: invs: 4
puf: roi: i=0...
puf: roi: i=1...
puf: A = ⎡39.1986⎤
puf: ⎢38.7333⎥
puf: ⎣83.0567⎦ (cpm)
puf:
puf: ± ⎡15.4932⎤
puf: ⎢11.0413⎥
puf: ⎣10.7775⎦
puf: LC (Bi,Pb) = ⎡0.4532⎤
puf: ⎣0.3586⎦ (cpm)
puf: LC (Po) = 7.0339 (cpm)
puf: V: 2.4595
puf: C = [4.4645 3.4111 7.5084] (Bq/m³) ± [1.7646 1.0112 1.0191]
real 0m15.666s
user 0m15.532s
sys 0m01.878s
$> ll ./results/et20-0829-D4-BN1
total 1.3M
-rw-r--r-- 1 binet binet 22K Sep 29 18:01 et20-0829-D4-BN1_AlphaCountRate_C1_ROI1_RAVIOLI1.png
-rw-r--r-- 1 binet binet 22K Sep 29 18:01 et20-0829-D4-BN1_AlphaCountRate_C1_ROI2_RAVIOLI1.png
-rw-r--r-- 1 binet binet 22K Sep 29 18:01 et20-0829-D4-BN1_AlphaCountRate_C1_ROI3_RAVIOLI1.png
-rw-r--r-- 1 binet binet 22K Sep 29 18:01 et20-0829-D4-BN1_AlphaCountRate_C1_ROI4_RAVIOLI1.png
-rw-r--r-- 1 binet binet 23K Sep 29 18:01 et20-0829-D4-BN1_AlphaCountRate_C2_ROI1_RAVIOLI1.png
-rw-r--r-- 1 binet binet 22K Sep 29 18:01 et20-0829-D4-BN1_AlphaCountRate_C2_ROI2_RAVIOLI1.png
-rw-r--r-- 1 binet binet 23K Sep 29 18:01 et20-0829-D4-BN1_AlphaCountRate_C2_ROI3_RAVIOLI1.png
-rw-r--r-- 1 binet binet 23K Sep 29 18:01 et20-0829-D4-BN1_AlphaCountRate_C2_ROI4_RAVIOLI1.png
-rw-r--r-- 1 binet binet 23K Sep 29 18:01 et20-0829-D4-BN1_AlphaCountRate_C3_ROI1_RAVIOLI1.png
-rw-r--r-- 1 binet binet 23K Sep 29 18:01 et20-0829-D4-BN1_AlphaCountRate_C3_ROI2_RAVIOLI1.png
-rw-r--r-- 1 binet binet 23K Sep 29 18:01 et20-0829-D4-BN1_AlphaCountRate_C3_ROI3_RAVIOLI1.png
-rw-r--r-- 1 binet binet 23K Sep 29 18:01 et20-0829-D4-BN1_AlphaCountRate_C3_ROI4_RAVIOLI1.png
-rw-r--r-- 1 binet binet 23K Sep 29 18:01 et20-0829-D4-BN1_AlphaCountRate_C4_ROI1_RAVIOLI1.png
-rw-r--r-- 1 binet binet 23K Sep 29 18:01 et20-0829-D4-BN1_AlphaCountRate_C4_ROI2_RAVIOLI1.png
-rw-r--r-- 1 binet binet 23K Sep 29 18:01 et20-0829-D4-BN1_AlphaCountRate_C4_ROI3_RAVIOLI1.png
-rw-r--r-- 1 binet binet 23K Sep 29 18:01 et20-0829-D4-BN1_AlphaCountRate_C4_ROI4_RAVIOLI1.png
-rw-r--r-- 1 binet binet 20K Sep 29 18:01 et20-0829-D4-BN1_AlphaSpectrum_acqno_1_RAVIOLI1.png
-rw-r--r-- 1 binet binet 19K Sep 29 18:01 et20-0829-D4-BN1_AlphaSpectrum_acqno_2_RAVIOLI1.png
-rw-r--r-- 1 binet binet 19K Sep 29 18:01 et20-0829-D4-BN1_AlphaSpectrum_acqno_3_RAVIOLI1.png
-rw-r--r-- 1 binet binet 17K Sep 29 18:01 et20-0829-D4-BN1_AlphaSpectrum_acqno_4_RAVIOLI1.png
-rw-r--r-- 1 binet binet 22K Sep 29 18:01 et20-0829-D4-BN1_depth_profile_214Po.png
-rw-r--r-- 1 binet binet 50K Sep 29 18:01 et20-0829-D4-BN1_energyCalibration_214Po.png
-rw-r--r-- 1 binet binet 37K Sep 29 18:01 et20-0829-D4-BN1_fitSpectrum_214Po.png
-rw-r--r-- 1 binet binet 21K Sep 29 18:01 et20-0829-D4-BN1_GammaSpectrum_acqno_1_RAVIOLI1.png
-rw-r--r-- 1 binet binet 21K Sep 29 18:01 et20-0829-D4-BN1_GammaSpectrum_acqno_2_RAVIOLI1.png
-rw-r--r-- 1 binet binet 48K Sep 29 18:01 et20-0829-D4-BN1_inflection.png
-rw-r--r-- 1 binet binet 53K Sep 29 18:01 et20-0829-D4-BN1_inversion.png
-rw-r--r-- 1 binet binet 24K Sep 29 18:01 et20-0829-D4-BN1_rawAdcSpectrum_alpha_acqno_1_RAVIOLI1.png
-rw-r--r-- 1 binet binet 27K Sep 29 18:01 et20-0829-D4-BN1_rawAdcSpectrum_alpha_acqno_2_RAVIOLI1.png
-rw-r--r-- 1 binet binet 30K Sep 29 18:01 et20-0829-D4-BN1_rawAdcSpectrum_alpha_acqno_3_RAVIOLI1.png
-rw-r--r-- 1 binet binet 30K Sep 29 18:01 et20-0829-D4-BN1_rawAdcSpectrum_alpha_acqno_4_RAVIOLI1.png
-rw-r--r-- 1 binet binet 33K Sep 29 18:01 et20-0829-D4-BN1_rawAdcSpectrum_gamma_acqno_1_RAVIOLI1.png
-rw-r--r-- 1 binet binet 34K Sep 29 18:01 et20-0829-D4-BN1_rawAdcSpectrum_gamma_acqno_2_RAVIOLI1.png
-rw-r--r-- 1 binet binet 28K Sep 29 18:01 et20-0829-D4-BN1_rawTimeStructure_alpha_acqno_1_RAVIOLI1.png
-rw-r--r-- 1 binet binet 32K Sep 29 18:01 et20-0829-D4-BN1_rawTimeStructure_alpha_acqno_2_RAVIOLI1.png
-rw-r--r-- 1 binet binet 39K Sep 29 18:01 et20-0829-D4-BN1_rawTimeStructure_alpha_acqno_3_RAVIOLI1.png
-rw-r--r-- 1 binet binet 33K Sep 29 18:01 et20-0829-D4-BN1_rawTimeStructure_alpha_acqno_4_RAVIOLI1.png
-rw-r--r-- 1 binet binet 37K Sep 29 18:01 et20-0829-D4-BN1_rawTimeStructure_gamma_acqno_1_RAVIOLI1.png
-rw-r--r-- 1 binet binet 43K Sep 29 18:01 et20-0829-D4-BN1_rawTimeStructure_gamma_acqno_2_RAVIOLI1.png
-rw-r--r-- 1 binet binet 40K Sep 29 18:01 et20-0829-D4-BN1_spectrum_inversion_214Po.png
-rw-r--r-- 1 binet binet 22K Sep 29 18:01 et20-0829-D4-BN1_synopticROIs_C1_RAVIOLI1.png
-rw-r--r-- 1 binet binet 18K Sep 29 18:01 et20-0829-D4-BN1_synopticROIs_C2_RAVIOLI1.png
-rw-r--r-- 1 binet binet 17K Sep 29 18:01 et20-0829-D4-BN1_synopticROIs_C3_RAVIOLI1.png
-rw-r--r-- 1 binet binet 16K Sep 29 18:01 et20-0829-D4-BN1_synopticROIs_C4_RAVIOLI1.png
-rw-r--r-- 1 binet binet 5.9K Sep 29 18:01 inver.gob
-rw-r--r-- 1 binet binet 374 Sep 29 18:01 yield.gob
