diff --git a/dactest/Makefile b/dactest/Makefile new file mode 100644 index 0000000..fe5ae38 --- /dev/null +++ b/dactest/Makefile @@ -0,0 +1,16 @@ +all: calib-1.dat calib-2.dat calib-3.dat calib-4.dat + +clean: + rm -f calib-* + +calib-1 calib-2 calib-3 calib-4 calib-5: split.pl calibration.dat + perl split.pl < calibration.dat + +calibration.dat: + @echo get calibration.dat from bucket:/home/jim/data/zoom/dactest/calibration.dat + @false + +%.dat: % rearrange + ./rearrange < $< > $@ + +rearrange: rearrange.c diff --git a/dactest/dactest.m b/dactest/dactest.m new file mode 100644 index 0000000..3270019 --- /dev/null +++ b/dactest/dactest.m @@ -0,0 +1,8 @@ +stats1 = stats('calib-1.dat'); +stats2 = stats('calib-2.dat'); +stats3 = stats('calib-3.dat'); +stats4 = stats('calib-4.dat'); +errorbar(stats1(:,1),stats1(:,2),stats1(:,3)); +errorbar(stats2(:,1),stats2(:,2),stats2(:,3)); +errorbar(stats3(:,1),stats3(:,2),stats3(:,3)); +errorbar(stats4(:,1),stats4(:,2),stats4(:,3)); diff --git a/dactest/rearrange.c b/dactest/rearrange.c new file mode 100644 index 0000000..7084008 --- /dev/null +++ b/dactest/rearrange.c @@ -0,0 +1,40 @@ +#include +#include +#include + +/* rearrange things so instead of + 0 1 + 0 2 + 0 3 + 1 4 + 1 5 + 1 6 + we just print + 0 1 2 3 + 1 4 5 6 +*/ + +int main(void) +{ + uint32_t dac, adc; + uint32_t olddac; + int first = 1; + + while(1) { + scanf("%d %d", &dac, &adc); + if (feof(stdin)) + break; + if (first) { + printf("%ld ", dac); + first = 0; + } else if (dac != olddac) { + printf("\n%ld ", dac); + } else { + printf(" "); + } + printf("%ld", adc); + olddac = dac; + } + printf("\n"); + return 0; +} diff --git a/dactest/split.pl b/dactest/split.pl new file mode 100755 index 0000000..434fd73 --- /dev/null +++ b/dactest/split.pl @@ -0,0 +1,17 @@ +#!/usr/bin/perl + +# split the direct output of the PIC into separate calibration files + +$next=0; +while(<>) +{ + next if (1 .. /3ADC/); + if (/^---/ or !$next) { + close OUT if $next; + $next++; + open(OUT, ">calib-$next"); + } + s/\r\n/\n/; + print OUT if /^[0-9]+/; +} +close OUT;