Compare commits

...

5 commits

Author SHA1 Message Date
Stephan I. Böttcher
c69b231ddd ahepam: make %.HD 2025-08-01 13:33:13 +02:00
Stephan I. Böttcher
8ff9eccb55 AHEPAM: @include pressure 2025-08-01 13:32:41 +02:00
Stephan I. Böttcher
785f560e46 dorn_hk: return slice with the data 2025-08-01 13:31:40 +02:00
Stephan I. Böttcher
f077df1366 chmod a+x pressure.awk 2025-08-01 13:30:13 +02:00
Stephan I. Böttcher
831342b7e6 udpterm: add periodic jobs to sockets 2025-08-01 13:29:25 +02:00
6 changed files with 23 additions and 11 deletions

View file

@ -1,5 +1,7 @@
#!/usr/bin/gawk -i #!/usr/bin/gawk -i
@include "../pressure.awk"
/^EDB /{skip_ED++} /^EDB /{skip_ED++}
skip_ED && /^ED / {next} skip_ED && /^ED / {next}

View file

@ -34,6 +34,11 @@ doScut=100
%.HDORN: %.AHA HDORN.awk %.HDORN: %.AHA HDORN.awk
./HDORN.awk 'isHDORN(){doHDORN()}' $< > $@ ./HDORN.awk 'isHDORN(){doHDORN()}' $< > $@
HDINST=--seth
HDTYPE=cooked
%.HD: %.AHA
../dorn_hk.py $(HDINST) --what=$(HDTYPE) $< | tr -d '[],' > $@
SIGMA=600 SIGMA=600
%.HD4BIAS: %.HDORN %.HD4BIAS: %.HDORN

16
dorn.py
View file

@ -187,23 +187,23 @@ def hk(sl, what="print", data=None):
if isinstance(data, str): if isinstance(data, str):
# HDORN … data line # HDORN … data line
if "x" in data: if "x" in data:
return return sl, None
data = data.split() data = data.split()
if data[0] != "HDORN": if data[0] != "HDORN":
return return sl, None
data = list(map(int, data[1:])) data = list(map(int, data[1:]))
if sl is None: if sl is None:
sl = data[0] & 3; sl = data[0] & 3;
if data[0] & 3 != sl: if data[0] & 3 != sl:
return None return sl, None
if what=="data": if what=="data":
return data return sl, data
ND = CONFIG.n_adc() ND = CONFIG.n_adc()
NV = ND NV = ND
data = [d & 0xfff for d in data] data = [d & 0xfff for d in data]
data = [data[ND*i+1:ND*i+1+NV] for i in range(8)] data = [data[ND*i+1:ND*i+1+NV] for i in range(8)]
if what=="raw": if what=="raw":
return data return sl, data
Vref = CONFIG.Vref(sl)/4096 Vref = CONFIG.Vref(sl)/4096
ddata = [] ddata = []
for a in range(8): for a in range(8):
@ -237,9 +237,9 @@ def hk(sl, what="print", data=None):
V[H[0]] = data[a][c] V[H[0]] = data[a][c]
if what=="cooked": if what=="cooked":
return data return sl, data
if what=="dict": if what=="dict":
return ddata return sl, ddata
r = [] r = []
for a in range(8): for a in range(8):
@ -249,7 +249,7 @@ def hk(sl, what="print", data=None):
if what=="print": if what=="print":
sys.stderr.write("".join(r)) sys.stderr.write("".join(r))
return r return sl, r
def dorn_config(a, v=None, mes=None, slice=0): def dorn_config(a, v=None, mes=None, slice=0):
verb = CONFIG.verbose verb = CONFIG.verbose

View file

@ -30,11 +30,11 @@ def hk_file(f):
continue continue
if not T: if not T:
continue continue
h = dorn.hk(sl, what=what, data=l) s, h = dorn.hk(sl, what=what, data=l)
if not h: if not h:
continue continue
for c in ch: for c in ch:
print(T, c, h[c]) print(T, s, c, h[c])
if not ff: if not ff:
hk_file(sys.stdin) hk_file(sys.stdin)

0
pressure.awk Normal file → Executable file
View file

View file

@ -181,6 +181,7 @@ class messagelog(asyncore.dispatcher):
self.bind(("", port)) self.bind(("", port))
self.logfile = None self.logfile = None
self.open_logfile(fn) self.open_logfile(fn)
self.jobs = []
def writable(self): def writable(self):
return False return False
@ -213,6 +214,10 @@ class messagelog(asyncore.dispatcher):
if self.sync>1: if self.sync>1:
os.fsync(self.logfile.fileno()) os.fsync(self.logfile.fileno())
self.blocks += 1 self.blocks += 1
if self.Jobs:
t = time.time()
for j in self.Jobs:
j.poll(t)
def Status(self, name): def Status(self, name):
return "%s socket %s file %s blocks %d" % (name, repr(self), repr(self.logfile), self.blocks) return "%s socket %s file %s blocks %d" % (name, repr(self), repr(self.logfile), self.blocks)