Browse Source

DAC test stuff

git-svn-id: https://bucket.mit.edu/svn/nilm/zoom@5920 ddd99763-3ecb-0310-9145-efcb8ce7c51f
tags/zoom-1.0
jim 13 years ago
parent
commit
3bcb136417
4 changed files with 81 additions and 0 deletions
  1. +16
    -0
      dactest/Makefile
  2. +8
    -0
      dactest/dactest.m
  3. +40
    -0
      dactest/rearrange.c
  4. +17
    -0
      dactest/split.pl

+ 16
- 0
dactest/Makefile View File

@@ -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

+ 8
- 0
dactest/dactest.m View File

@@ -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));

+ 40
- 0
dactest/rearrange.c View File

@@ -0,0 +1,40 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

/* 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;
}

+ 17
- 0
dactest/split.pl View File

@@ -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;

Loading…
Cancel
Save