Compare commits

..

79 commits

Author SHA1 Message Date
Stephan I. Böttcher
52208e6161 Merge branch 'master' of forge.bexus.org:Stephan/irena-arm 2026-03-30 09:56:01 +02:00
Stephan I. Böttcher
87fc412d1b nmdbstream: fix str-bytes error 2026-03-30 09:54:52 +02:00
Stephan I. Böttcher
f908aa31d7 irenarc-jfett for Svea 2026-02-05 10:31:38 +01:00
Stephan I. Böttcher
2debb5d65a leia: lost+found 2026-02-05 10:31:07 +01:00
Stephan I. Böttcher
4269bba81a avr/leia: add 'n' → ports 2025-12-01 20:45:50 +01:00
Stephan I. Böttcher
a8d2f4c797 leia_stepper: VbiasD calibration 2025-12-01 20:28:04 +01:00
Stephan I. Böttcher
f7af6fb900 leia_stepper: fix .speed() 2025-12-01 20:23:46 +01:00
Stephan I. Böttcher
70cefb78d3 avr commits 2025-11-19 19:13:49 +01:00
Stephan I. Böttcher
8539542690 leia_stepper: .enable() rework 2025-11-19 19:13:17 +01:00
Stephan I. Böttcher
bb8884d2ca leia_stepper: class bitnames 2025-11-19 16:54:47 +01:00
Stephan I. Böttcher
57e99bf199 leia_stepper: stepping methods 2025-11-19 16:20:58 +01:00
Stephan I. Böttcher
8ed1b837f0 dorn leia hk: VbiasD is negative 2025-11-19 16:19:45 +01:00
Stephan I. Böttcher
4269bd8293 dorn: LEIA hk() 2025-11-17 23:57:40 +01:00
Stephan I. Böttcher
c5a8f7fef2 leia_stepper: .enable(), .step() 2025-11-17 23:56:52 +01:00
Stephan I. Böttcher
10f2815e5d ahepam doEPOCH() 2025-11-17 23:51:58 +01:00
Stephan I. Böttcher
dd879c5433 update avr 2025-11-17 23:51:04 +01:00
Stephan I. Böttcher
9aee6531e0 flash_LEIA: new fat 2025-11-17 23:50:26 +01:00
Stephan I. Böttcher
1310ad3e53 leia_stepper: dac, adc fixes 2025-11-12 20:21:36 +01:00
Stephan I. Böttcher
0c8591a6ef flash_tarena: 1MByte 2025-11-12 20:20:49 +01:00
Stephan I. Böttcher
8220f10bcb tarena: Bitfile from 2025 2025-11-10 11:39:00 +01:00
Stephan I. Böttcher
122a9fb802 tarena: Bitfile from 2014 2025-11-10 11:38:27 +01:00
Stephan I. Böttcher
d5e4d19165 nmahepam: --leia
- add option --leia to nmahepam.py
- to load leia_stepper

leia_stepper fixes and new functions
2025-10-30 10:17:53 +01:00
Stephan I. Böttcher
26d700bbad add submodule avr 2025-10-30 10:17:36 +01:00
Stephan I. Böttcher
4c6bb8cb79 Gd4_2thr config 2025-10-30 10:03:13 +01:00
Stephan I. Böttcher
85b210b9e8 Gd4 (flash_alke) 9ch TWOTHR bitfile 2025-10-30 10:01:25 +01:00
Stephan I. Böttcher
c18624c745 irenafile: twothr has 6 L2 triggers 2025-10-27 17:12:02 +01:00
Stephan I. Böttcher
6269048394 flash_alke: update bitfile 2025-10-27 12:57:30 +01:00
Stephan I. Böttcher
934fecf35b leia_stepper: adaptet from chaos.py 2025-10-22 21:21:18 +02:00
Stephan I. Böttcher
36c011d26e tarena: fix lasc 2025-10-20 09:34:32 +02:00
Stephan I. Böttcher
cfa4107659 cvphase: reset numavg to restart averaging 2025-10-20 09:33:51 +02:00
Stephan I. Böttcher
53c8767dea armlib.ifc.Sync(on=True) 2025-10-06 17:15:12 +02:00
Stephan I. Böttcher
3e53d6695e irena: fix irenarc exception 2025-10-06 17:14:21 +02:00
Stephan I. Böttcher
2ae7187eeb flash_IRENA: CRONGD4 2025-10-06 16:42:55 +02:00
BEXUS CHAOS
98936fcad7 dorn.py: change " to , 2025-08-13 12:56:28 +02:00
Stephan I. Böttcher
ee585c187e Merge branch 'ava' of /home/asterix/athena/arm 2025-08-13 11:52:00 +02:00
Ava@athena
45f240f99c Change Treiggervalues in nmahepam.py 2025-08-13 11:34:43 +02:00
BEXUS CHAOS
69831cac23 armlib Keep_Alive call(interval=) 2025-08-08 17:41:38 +02:00
Stephan I. Böttcher
2513757ba3 udpterm s/jobs/Jobs/ 2025-08-08 17:39:55 +02:00
Stephan I. Böttcher
0c4b6629f2 SETH raise BGO thres to 15 2025-08-08 11:58:31 +02:00
Stephan I. Böttcher
287e7b1aba NMAHEPAM: call ETH.RC before attempting FPGA config 2025-08-08 11:57:53 +02:00
Stephan I. Böttcher
c5a625e61f AHEPAM: add Time to doSETHBGO(), fix doSETH*() 2025-08-06 15:52:47 +02:00
Stephan I. Böttcher
881609eca0 dorn --seth: list BGO channels
for c in CONFIG.BGO: thres(*c, 10)
2025-08-06 15:48:04 +02:00
Stephan I. Böttcher
22adf761cb nmahepam --seth: _stream_control=0x000a enable() does short packets 2025-08-06 15:47:31 +02:00
nm64.hfsjg etbern2
24f95cd5a7 nmdbstream.py: fix connection list logic
Whenever 10 concurrent connections expand the list to 10 entries, no new
connections were accepted.
Fix: first try to find an empty slot in the list, then reject connection
when the list is too long.
2025-08-06 15:15:35 +02:00
Stephan I. Böttcher
783d82b83e AHEPAM EPOCH: harden rollover 2025-08-04 22:04:06 +02:00
Stephan I. Böttcher
7881b72b1b NMAHEPAM: UDP.RC: reset spi_min_q=665 @ ETH resets 2025-08-04 22:02:22 +02:00
Stephan I. Böttcher
a22c05dc82 NMAHEPAM: ETH.RC: SETH flight IPs 2025-08-04 22:01:46 +02:00
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
Stephan I. Böttcher
de178db0a1 DORN.RC: avoid overflow in banana coeff 2025-07-30 12:17:14 +02:00
Stephan I. Böttcher
eb2c92e0e9 armlib: add class Keep_Alive_Schedule 2025-07-30 12:16:17 +02:00
Stephan I. Böttcher
ac271696f5 armlib: add class Keep_Alive_Schedule 2025-07-30 12:15:46 +02:00
Stephan I. Böttcher
7678ba7845 AHEPAM: .SETH same order as .seth_hist 2025-07-30 12:14:24 +02:00
Stephan I. Böttcher
7258def910 NNAHEPAM: retry altera config four times
It looks like Vprim=28V is the worst condition for the power board.
At this voltage the altera frequently fails to configure, probably do to
transients in the core voltage when the FPGA starts its PLL.

Retry altera/file up to four times as long as the config fails.
2025-07-29 17:05:10 +02:00
Stephan I. Böttcher
b71770f57c arm ssp_isr: disable interrupt when no buffer
Count the occurences of DMA buffer unavailable.
Disable ssp interrupts when no dma buffer is available.  The irq
condition will persist, probably reentering the isr at high rate.
2025-07-29 16:30:38 +02:00
Stephan I. Böttcher
d087cb4254 arm: udp: do not reset eth when udp_poll_message sent a packet 2025-07-29 16:29:50 +02:00
Stephan I. Böttcher
6e411b523b HK Vprim SETH calib 2025-07-29 16:04:01 +02:00
Stephan I. Böttcher
a4451ae8a8 fix for SETH flight s/V/var/ 2025-07-29 16:03:23 +02:00
Stephan I. Böttcher
022845e44a flash_NMAHEPAM: channel seth 0/4 calib for broken shaper 2025-07-28 13:47:47 +02:00
Stephan I. Böttcher
2d6507d126 flash_NMAHEPAM: fix HETB threshold channel number 2025-07-28 13:47:19 +02:00
Stephan I. Böttcher
f1ad213b11 nm64: new location of kiel2 data on nm64kiel 2025-07-28 13:46:05 +02:00
Stephan I. Böttcher
2de6cb8de7 ahepam: new calib
- banana fit for channel 0/4, damaged shaper
- skipED for file with ED and EDB lines
- uniform tBGO
2025-07-28 13:44:09 +02:00
Stephan I. Böttcher
493e41a593 ahepam/pulser_fit: wide ranges 2025-07-28 13:42:50 +02:00
Stephan I. Böttcher
e940df4a7f ahepam make %.doS doScut= 2025-07-28 13:42:05 +02:00
Stephan I. Böttcher
bbceab82a7 DORN/RC: bgo calib
Remove pulser calib for slice 1
Intercalibtrate the BGO signals using 2025-07-24-seth-9
Raise HETB threshold to 15
2025-07-25 13:23:54 +02:00
Stephan I. Böttcher
9a125cd357 dorn_hk: read from stdin, default --what=pretty 2025-07-25 13:23:24 +02:00
Stephan I. Böttcher
c2b723e3f6 seth_hist, bgo fits 2025-07-25 13:22:07 +02:00
Stephan I. Böttcher
f04b5ef9c5 ahepam: make %.Itime 2025-07-18 12:25:33 +02:00
Stephan I. Böttcher
e522a09084 DORN.RC: do not omit $3 for DORNCC 2025-07-17 23:05:34 +02:00
Stephan I. Böttcher
7c4f82d462 script: properly save old_locals
`parse_parameters()` sets `local_variables`, save `old_locals` first.

NB:
`script_execute_fd()` does not clear the local variables, unless there were none.
`parse_parameters()` only updates the given paramteres.
Testing for zero is not a good way to detect omitted parameters.  Use
$0.
2025-07-17 22:56:34 +02:00
Stephan I. Böttcher
30f6446a06 DORNCC: B-calib nomalization on the last sample 2025-07-16 21:39:04 +02:00
Stephan I. Böttcher
90edb57ac2 nmahepam: aenable(what) 2025-07-16 21:36:23 +02:00
Stephan I. Böttcher
ac2b77791b ahepam/Makefile: $(BANANA) 2025-07-16 21:35:28 +02:00
Stephan I. Böttcher
0f32d27cb9 NMAHEPAM/CRONFLY: add missing @ 2025-07-16 21:34:40 +02:00
Stephan I. Böttcher
072a93c0e4 dorn.nsamples(): remove extra arg **slice 2025-07-16 20:54:11 +02:00
2db14b65ad Merge pull request 'add seth diodes, switch HK shapers 0,2' (#1) from nicolas/irena-arm:master into master
Reviewed-on: Stephan/irena-arm#1
2025-07-08 15:45:31 +02:00
58 changed files with 1686 additions and 483 deletions

2
.gitignore vendored
View file

@ -19,3 +19,5 @@ nm64file
mustang_scripts mustang_scripts
nm64/nm64 nm64/nm64
ahepam/seth ahepam/seth
leia/
irena/d3direna/

3
.gitmodules vendored Normal file
View file

@ -0,0 +1,3 @@
[submodule "avr"]
path = avr
url = ../irena-avr.git

View file

@ -76,6 +76,8 @@ ProductId-NMAHEPAM = 0x0c
SerialNo-NMAHEPAM = 14 SerialNo-NMAHEPAM = 14
ProductId-SETH = 0x0c ProductId-SETH = 0x0c
SerialNo-SETH = 15 SerialNo-SETH = 15
ProductId-LEIA = 0x0c
SerialNo-LEIA = 16
#sirena: #sirena:
ProductId-Torsten = 0x04 ProductId-Torsten = 0x04
@ -228,8 +230,10 @@ FATNAME_flash_TANOS=TANOS
FATNAME_flash_CHAOS=CHAOS FATNAME_flash_CHAOS=CHAOS
FATNAME_flash_µM=IRENAuM FATNAME_flash_µM=IRENAuM
FATNAME_flash_NMAHEPAM=NMAHEPAM FATNAME_flash_NMAHEPAM=NMAHEPAM
FATNAME_flash_LEIA=LEIA
FATNAME=$(FATNAME_$(FLASH)) FATNAME=$(FATNAME_$(FLASH))
FATSIZE_flash_tarena=1M
FATSIZE_flash_pirena=1M FATSIZE_flash_pirena=1M
FATSIZE_flash_darena=1M FATSIZE_flash_darena=1M
FATSIZE_flash_erena=1M FATSIZE_flash_erena=1M

View file

@ -160,6 +160,7 @@ int main(int argc, const char * const * argv)
n_counters = 25; n_counters = 25;
if (!nl2) if (!nl2)
switch (nch) { switch (nch) {
case 9:
case 18: nl2=6; break; case 18: nl2=6; break;
default: nl2=8; break; default: nl2=8; break;
} }

View file

@ -0,0 +1,60 @@
#!/usr/local/bin/gnuplot
fn = "2025-07-24-seth-9"
set tit fn
set samples 10000
set xrange [ 10.6473 : 72.0818 ] noreverse writeback
set yrange [ 0.0824143 : 319.883 ] noreverse writeback
set logscale y
set fit logfile fn.".fitlog" brief errorvariables
landau(l)=sqrt(exp(-l-exp(-l))/2/pi)
mips(i, x)=a[i]*landau((x-e[i])/s[i])
Itime = 1
array a[13] = [,,,,,,, \
859.092052918976, 836.661498376021, 774.308992188805, \
868.7682895186, 886.040923070115, 839.914159064545 ]
array e[13] = [,,,,,,, \
23.1129960324349, 23.7449670595066, 24.6546072882361, \
21.9335751062165, 21.1775893511824, 22.8589648291739 ]
array s[13] = [,,,,,,, \
2.93026673210812, 3.02173616155514, 3.36397159128985, \
2.83639020739353, 2.83826477232856, 3.01391842919058 ]
a_8__err = 17.0887311070516
e_8__err = 0.0889472501153327
s_8__err = 0.0935171552631583
a_9__err = 17.4032436542983
e_9__err = 0.097488036256732
s_9__err = 0.106290500933751
a_10__err = 15.7027910610272
e_10__err = 0.105569403248042
s_10__err = 0.114612006466013
a_11__err = 20.7697327629865
e_11__err = 0.100670852522929
s_11__err = 0.102334658647667
a_12__err = 16.5452708067998
e_12__err = 0.0803181922085788
s_12__err = 0.0845228040571695
a_13__err = 18.1355609385629
e_13__err = 0.105214047154568
s_13__err = 0.118194681270004
plot for [c=8:13] "seth/".fn.".seth_hist" \
u 1:(column(2+c)/Itime) \
t "".c." ".columnhead(2+c) \
w histeps, \
for [c=8:13] mips(c,x)+0.1 not w l lt c-7
do for [c=8:13] {
fit [] [a[c]/10.:*] \
mips(c,x) \
"seth/".fn.".seth_hist" u 1:2+c:(sqrt(column(2+c)+1)) \
zerror \
via a[c],e[c],s[c]
replot
}

View file

@ -0,0 +1,468 @@
*******************************************************************************
Fri Jul 25 13:03:18 2025
FIT: data read from "seth/".fn.".seth_hist" u 1:2+c:(sqrt(column(2+c)+1)) zerror
format = x:z:s
function range restricted to [85.9092 : *]
#datapoints = 48
function used for fitting: mips(c,x)
mips(i, x)=a[i]*landau((x-e[i])/s[i])
landau(l)=sqrt(exp(-l-exp(-l))/2/pi)
fitted parameters initialized with current variable values
iter chisq delta/lim lambda a[8] e[8] s[8]
0 6.4318474790e+01 0.00e+00 2.93e+01 8.590921e+02 2.311300e+01 2.930267e+00
1 6.4318474759e+01 -4.89e-05 2.93e+00 8.590923e+02 2.311300e+01 2.930265e+00
After 1 iterations the fit converged.
final sum of squares of residuals : 64.3185
rel. change during last iteration : -4.88767e-10
degrees of freedom (FIT_NDF) : 45
rms of residuals (FIT_STDFIT) = sqrt(WSSR/ndf) : 1.19553
variance of residuals (reduced chisquare) = WSSR/ndf : 1.4293
p-value of the Chisq distribution (FIT_P) : 0.0307724
Final set of parameters Asymptotic Standard Error
======================= ==========================
a[8] = 859.092 +/- 17.09 (1.989%)
e[8] = 23.113 +/- 0.08895 (0.3848%)
s[8] = 2.93027 +/- 0.09352 (3.191%)
correlation matrix of the fit parameters:
a[8] e[8] s[8]
a[8] 1.000
e[8] -0.251 1.000
s[8] -0.719 0.383 1.000
*******************************************************************************
Fri Jul 25 13:03:18 2025
FIT: data read from "seth/".fn.".seth_hist" u 1:2+c:(sqrt(column(2+c)+1)) zerror
format = x:z:s
function range restricted to [83.6661 : *]
#datapoints = 48
function used for fitting: mips(c,x)
mips(i, x)=a[i]*landau((x-e[i])/s[i])
landau(l)=sqrt(exp(-l-exp(-l))/2/pi)
fitted parameters initialized with current variable values
iter chisq delta/lim lambda a[9] e[9] s[9]
0 6.8507114449e+01 0.00e+00 2.75e+01 8.366615e+02 2.374497e+01 3.021736e+00
1 6.8507114449e+01 -2.07e-11 2.75e+04 8.366615e+02 2.374497e+01 3.021736e+00
After 1 iterations the fit converged.
final sum of squares of residuals : 68.5071
rel. change during last iteration : -2.07436e-16
degrees of freedom (FIT_NDF) : 45
rms of residuals (FIT_STDFIT) = sqrt(WSSR/ndf) : 1.23385
variance of residuals (reduced chisquare) = WSSR/ndf : 1.52238
p-value of the Chisq distribution (FIT_P) : 0.0135097
Final set of parameters Asymptotic Standard Error
======================= ==========================
a[9] = 836.661 +/- 17.4 (2.08%)
e[9] = 23.745 +/- 0.09749 (0.4106%)
s[9] = 3.02174 +/- 0.1063 (3.518%)
correlation matrix of the fit parameters:
a[9] e[9] s[9]
a[9] 1.000
e[9] -0.211 1.000
s[9] -0.725 0.297 1.000
*******************************************************************************
Fri Jul 25 13:03:19 2025
FIT: data read from "seth/".fn.".seth_hist" u 1:2+c:(sqrt(column(2+c)+1)) zerror
format = x:z:s
function range restricted to [77.4309 : *]
#datapoints = 54
function used for fitting: mips(c,x)
mips(i, x)=a[i]*landau((x-e[i])/s[i])
landau(l)=sqrt(exp(-l-exp(-l))/2/pi)
fitted parameters initialized with current variable values
iter chisq delta/lim lambda a[10] e[10] s[10]
0 7.6078685857e+01 0.00e+00 2.44e+01 7.743090e+02 2.465461e+01 3.363972e+00
1 7.6078685837e+01 -2.66e-05 2.44e+00 7.743093e+02 2.465461e+01 3.363969e+00
After 1 iterations the fit converged.
final sum of squares of residuals : 76.0787
rel. change during last iteration : -2.66022e-10
degrees of freedom (FIT_NDF) : 51
rms of residuals (FIT_STDFIT) = sqrt(WSSR/ndf) : 1.22137
variance of residuals (reduced chisquare) = WSSR/ndf : 1.49174
p-value of the Chisq distribution (FIT_P) : 0.0129596
Final set of parameters Asymptotic Standard Error
======================= ==========================
a[10] = 774.309 +/- 15.7 (2.028%)
e[10] = 24.6546 +/- 0.1056 (0.4282%)
s[10] = 3.36397 +/- 0.1146 (3.407%)
correlation matrix of the fit parameters:
a[10] e[10] s[10]
a[10] 1.000
e[10] -0.179 1.000
s[10] -0.726 0.235 1.000
*******************************************************************************
Fri Jul 25 13:03:19 2025
FIT: data read from "seth/".fn.".seth_hist" u 1:2+c:(sqrt(column(2+c)+1)) zerror
format = x:z:s
function range restricted to [86.8768 : *]
#datapoints = 49
function used for fitting: mips(c,x)
mips(i, x)=a[i]*landau((x-e[i])/s[i])
landau(l)=sqrt(exp(-l-exp(-l))/2/pi)
fitted parameters initialized with current variable values
iter chisq delta/lim lambda a[11] e[11] s[11]
0 9.5016426174e+01 0.00e+00 2.83e+01 8.687683e+02 2.193358e+01 2.836390e+00
1 9.5016426174e+01 -1.50e-11 2.83e+06 8.687683e+02 2.193358e+01 2.836390e+00
After 1 iterations the fit converged.
final sum of squares of residuals : 95.0164
rel. change during last iteration : -1.49562e-16
degrees of freedom (FIT_NDF) : 46
rms of residuals (FIT_STDFIT) = sqrt(WSSR/ndf) : 1.43721
variance of residuals (reduced chisquare) = WSSR/ndf : 2.06557
p-value of the Chisq distribution (FIT_P) : 2.90326e-05
Final set of parameters Asymptotic Standard Error
======================= ==========================
a[11] = 868.768 +/- 20.77 (2.391%)
e[11] = 21.9336 +/- 0.1007 (0.459%)
s[11] = 2.83639 +/- 0.1023 (3.608%)
correlation matrix of the fit parameters:
a[11] e[11] s[11]
a[11] 1.000
e[11] -0.203 1.000
s[11] -0.722 0.280 1.000
*******************************************************************************
Fri Jul 25 13:03:19 2025
FIT: data read from "seth/".fn.".seth_hist" u 1:2+c:(sqrt(column(2+c)+1)) zerror
format = x:z:s
function range restricted to [88.6041 : *]
#datapoints = 47
function used for fitting: mips(c,x)
mips(i, x)=a[i]*landau((x-e[i])/s[i])
landau(l)=sqrt(exp(-l-exp(-l))/2/pi)
fitted parameters initialized with current variable values
iter chisq delta/lim lambda a[12] e[12] s[12]
0 5.5243080524e+01 0.00e+00 2.81e+01 8.860409e+02 2.117759e+01 2.838265e+00
1 5.5243080524e+01 -1.73e-08 2.81e+02 8.860409e+02 2.117759e+01 2.838265e+00
After 1 iterations the fit converged.
final sum of squares of residuals : 55.2431
rel. change during last iteration : -1.72738e-13
degrees of freedom (FIT_NDF) : 44
rms of residuals (FIT_STDFIT) = sqrt(WSSR/ndf) : 1.1205
variance of residuals (reduced chisquare) = WSSR/ndf : 1.25552
p-value of the Chisq distribution (FIT_P) : 0.119174
Final set of parameters Asymptotic Standard Error
======================= ==========================
a[12] = 886.041 +/- 16.55 (1.867%)
e[12] = 21.1776 +/- 0.08032 (0.3793%)
s[12] = 2.83826 +/- 0.08452 (2.978%)
correlation matrix of the fit parameters:
a[12] e[12] s[12]
a[12] 1.000
e[12] -0.245 1.000
s[12] -0.723 0.358 1.000
*******************************************************************************
Fri Jul 25 13:03:19 2025
FIT: data read from "seth/".fn.".seth_hist" u 1:2+c:(sqrt(column(2+c)+1)) zerror
format = x:z:s
function range restricted to [83.9914 : *]
#datapoints = 46
function used for fitting: mips(c,x)
mips(i, x)=a[i]*landau((x-e[i])/s[i])
landau(l)=sqrt(exp(-l-exp(-l))/2/pi)
fitted parameters initialized with current variable values
iter chisq delta/lim lambda a[13] e[13] s[13]
0 6.7709403756e+01 0.00e+00 2.49e+01 8.399142e+02 2.285896e+01 3.013918e+00
1 6.7709403750e+01 -9.61e-06 2.49e+01 8.399142e+02 2.285897e+01 3.013919e+00
After 1 iterations the fit converged.
final sum of squares of residuals : 67.7094
rel. change during last iteration : -9.60902e-11
degrees of freedom (FIT_NDF) : 43
rms of residuals (FIT_STDFIT) = sqrt(WSSR/ndf) : 1.25485
variance of residuals (reduced chisquare) = WSSR/ndf : 1.57464
p-value of the Chisq distribution (FIT_P) : 0.00947836
Final set of parameters Asymptotic Standard Error
======================= ==========================
a[13] = 839.914 +/- 18.14 (2.159%)
e[13] = 22.859 +/- 0.1052 (0.4603%)
s[13] = 3.01392 +/- 0.1182 (3.922%)
correlation matrix of the fit parameters:
a[13] e[13] s[13]
a[13] 1.000
e[13] -0.137 1.000
s[13] -0.728 0.143 1.000
*******************************************************************************
Fri Jul 25 13:04:41 2025
FIT: data read from "seth/".fn.".seth_hist" u 1:2+c:(sqrt(column(2+c)+1)) zerror
format = x:z:s
function range restricted to [85.9092 : *]
#datapoints = 48
function used for fitting: mips(c,x)
mips(i, x)=a[i]*landau((x-e[i])/s[i])
landau(l)=sqrt(exp(-l-exp(-l))/2/pi)
fitted parameters initialized with current variable values
iter chisq delta/lim lambda a[8] e[8] s[8]
0 6.4318474790e+01 0.00e+00 2.93e+01 8.590921e+02 2.311300e+01 2.930267e+00
1 6.4318474759e+01 -4.89e-05 2.93e+00 8.590923e+02 2.311300e+01 2.930265e+00
After 1 iterations the fit converged.
final sum of squares of residuals : 64.3185
rel. change during last iteration : -4.88767e-10
degrees of freedom (FIT_NDF) : 45
rms of residuals (FIT_STDFIT) = sqrt(WSSR/ndf) : 1.19553
variance of residuals (reduced chisquare) = WSSR/ndf : 1.4293
p-value of the Chisq distribution (FIT_P) : 0.0307724
Final set of parameters Asymptotic Standard Error
======================= ==========================
a[8] = 859.092 +/- 17.09 (1.989%)
e[8] = 23.113 +/- 0.08895 (0.3848%)
s[8] = 2.93027 +/- 0.09352 (3.191%)
correlation matrix of the fit parameters:
a[8] e[8] s[8]
a[8] 1.000
e[8] -0.251 1.000
s[8] -0.719 0.383 1.000
*******************************************************************************
Fri Jul 25 13:04:41 2025
FIT: data read from "seth/".fn.".seth_hist" u 1:2+c:(sqrt(column(2+c)+1)) zerror
format = x:z:s
function range restricted to [83.6661 : *]
#datapoints = 48
function used for fitting: mips(c,x)
mips(i, x)=a[i]*landau((x-e[i])/s[i])
landau(l)=sqrt(exp(-l-exp(-l))/2/pi)
fitted parameters initialized with current variable values
iter chisq delta/lim lambda a[9] e[9] s[9]
0 6.8507114449e+01 0.00e+00 2.75e+01 8.366615e+02 2.374497e+01 3.021736e+00
1 6.8507114449e+01 -2.07e-11 2.75e+04 8.366615e+02 2.374497e+01 3.021736e+00
After 1 iterations the fit converged.
final sum of squares of residuals : 68.5071
rel. change during last iteration : -2.07436e-16
degrees of freedom (FIT_NDF) : 45
rms of residuals (FIT_STDFIT) = sqrt(WSSR/ndf) : 1.23385
variance of residuals (reduced chisquare) = WSSR/ndf : 1.52238
p-value of the Chisq distribution (FIT_P) : 0.0135097
Final set of parameters Asymptotic Standard Error
======================= ==========================
a[9] = 836.661 +/- 17.4 (2.08%)
e[9] = 23.745 +/- 0.09749 (0.4106%)
s[9] = 3.02174 +/- 0.1063 (3.518%)
correlation matrix of the fit parameters:
a[9] e[9] s[9]
a[9] 1.000
e[9] -0.211 1.000
s[9] -0.725 0.297 1.000
*******************************************************************************
Fri Jul 25 13:04:41 2025
FIT: data read from "seth/".fn.".seth_hist" u 1:2+c:(sqrt(column(2+c)+1)) zerror
format = x:z:s
function range restricted to [77.4309 : *]
#datapoints = 54
function used for fitting: mips(c,x)
mips(i, x)=a[i]*landau((x-e[i])/s[i])
landau(l)=sqrt(exp(-l-exp(-l))/2/pi)
fitted parameters initialized with current variable values
iter chisq delta/lim lambda a[10] e[10] s[10]
0 7.6078685857e+01 0.00e+00 2.44e+01 7.743090e+02 2.465461e+01 3.363972e+00
1 7.6078685837e+01 -2.66e-05 2.44e+00 7.743093e+02 2.465461e+01 3.363969e+00
After 1 iterations the fit converged.
final sum of squares of residuals : 76.0787
rel. change during last iteration : -2.66022e-10
degrees of freedom (FIT_NDF) : 51
rms of residuals (FIT_STDFIT) = sqrt(WSSR/ndf) : 1.22137
variance of residuals (reduced chisquare) = WSSR/ndf : 1.49174
p-value of the Chisq distribution (FIT_P) : 0.0129596
Final set of parameters Asymptotic Standard Error
======================= ==========================
a[10] = 774.309 +/- 15.7 (2.028%)
e[10] = 24.6546 +/- 0.1056 (0.4282%)
s[10] = 3.36397 +/- 0.1146 (3.407%)
correlation matrix of the fit parameters:
a[10] e[10] s[10]
a[10] 1.000
e[10] -0.179 1.000
s[10] -0.726 0.235 1.000
*******************************************************************************
Fri Jul 25 13:04:41 2025
FIT: data read from "seth/".fn.".seth_hist" u 1:2+c:(sqrt(column(2+c)+1)) zerror
format = x:z:s
function range restricted to [86.8768 : *]
#datapoints = 49
function used for fitting: mips(c,x)
mips(i, x)=a[i]*landau((x-e[i])/s[i])
landau(l)=sqrt(exp(-l-exp(-l))/2/pi)
fitted parameters initialized with current variable values
iter chisq delta/lim lambda a[11] e[11] s[11]
0 9.5016426174e+01 0.00e+00 2.83e+01 8.687683e+02 2.193358e+01 2.836390e+00
1 9.5016426174e+01 -1.50e-11 2.83e+06 8.687683e+02 2.193358e+01 2.836390e+00
After 1 iterations the fit converged.
final sum of squares of residuals : 95.0164
rel. change during last iteration : -1.49562e-16
degrees of freedom (FIT_NDF) : 46
rms of residuals (FIT_STDFIT) = sqrt(WSSR/ndf) : 1.43721
variance of residuals (reduced chisquare) = WSSR/ndf : 2.06557
p-value of the Chisq distribution (FIT_P) : 2.90326e-05
Final set of parameters Asymptotic Standard Error
======================= ==========================
a[11] = 868.768 +/- 20.77 (2.391%)
e[11] = 21.9336 +/- 0.1007 (0.459%)
s[11] = 2.83639 +/- 0.1023 (3.608%)
correlation matrix of the fit parameters:
a[11] e[11] s[11]
a[11] 1.000
e[11] -0.203 1.000
s[11] -0.722 0.280 1.000
*******************************************************************************
Fri Jul 25 13:04:41 2025
FIT: data read from "seth/".fn.".seth_hist" u 1:2+c:(sqrt(column(2+c)+1)) zerror
format = x:z:s
function range restricted to [88.6041 : *]
#datapoints = 47
function used for fitting: mips(c,x)
mips(i, x)=a[i]*landau((x-e[i])/s[i])
landau(l)=sqrt(exp(-l-exp(-l))/2/pi)
fitted parameters initialized with current variable values
iter chisq delta/lim lambda a[12] e[12] s[12]
0 5.5243080524e+01 0.00e+00 2.81e+01 8.860409e+02 2.117759e+01 2.838265e+00
1 5.5243080524e+01 -1.73e-08 2.81e+02 8.860409e+02 2.117759e+01 2.838265e+00
After 1 iterations the fit converged.
final sum of squares of residuals : 55.2431
rel. change during last iteration : -1.72738e-13
degrees of freedom (FIT_NDF) : 44
rms of residuals (FIT_STDFIT) = sqrt(WSSR/ndf) : 1.1205
variance of residuals (reduced chisquare) = WSSR/ndf : 1.25552
p-value of the Chisq distribution (FIT_P) : 0.119174
Final set of parameters Asymptotic Standard Error
======================= ==========================
a[12] = 886.041 +/- 16.55 (1.867%)
e[12] = 21.1776 +/- 0.08032 (0.3793%)
s[12] = 2.83826 +/- 0.08452 (2.978%)
correlation matrix of the fit parameters:
a[12] e[12] s[12]
a[12] 1.000
e[12] -0.245 1.000
s[12] -0.723 0.358 1.000
*******************************************************************************
Fri Jul 25 13:04:41 2025
FIT: data read from "seth/".fn.".seth_hist" u 1:2+c:(sqrt(column(2+c)+1)) zerror
format = x:z:s
function range restricted to [83.9914 : *]
#datapoints = 46
function used for fitting: mips(c,x)
mips(i, x)=a[i]*landau((x-e[i])/s[i])
landau(l)=sqrt(exp(-l-exp(-l))/2/pi)
fitted parameters initialized with current variable values
iter chisq delta/lim lambda a[13] e[13] s[13]
0 6.7709403756e+01 0.00e+00 2.49e+01 8.399142e+02 2.285896e+01 3.013918e+00
1 6.7709403750e+01 -9.61e-06 2.49e+01 8.399142e+02 2.285897e+01 3.013919e+00
After 1 iterations the fit converged.
final sum of squares of residuals : 67.7094
rel. change during last iteration : -9.60902e-11
degrees of freedom (FIT_NDF) : 43
rms of residuals (FIT_STDFIT) = sqrt(WSSR/ndf) : 1.25485
variance of residuals (reduced chisquare) = WSSR/ndf : 1.57464
p-value of the Chisq distribution (FIT_P) : 0.00947836
Final set of parameters Asymptotic Standard Error
======================= ==========================
a[13] = 839.914 +/- 18.14 (2.159%)
e[13] = 22.859 +/- 0.1052 (0.4603%)
s[13] = 3.01392 +/- 0.1182 (3.922%)
correlation matrix of the fit parameters:
a[13] e[13] s[13]
a[13] 1.000
e[13] -0.137 1.000
s[13] -0.728 0.143 1.000

View file

@ -1,5 +1,10 @@
#!/usr/bin/gawk -i #!/usr/bin/gawk -i
@include "../pressure.awk"
/^EDB /{skip_ED++}
skip_ED && /^ED / {next}
function isE(d,c) { function isE(d,c) {
if (!/^EDB?/ || $3!=d || $4!=c) return 0 if (!/^EDB?/ || $3!=d || $4!=c) return 0
Ch = NDCh * d + c Ch = NDCh * d + c
@ -30,10 +35,20 @@ function isEE() {
return 1 return 1
} }
function doEPOCH(t) {
if (t < 0x00ffffff && TLAST > 0xff000000) {
EPOCH += 0x100000000
TLAST = t
} else if (t > TLAST) {
TLAST = t
}
return t+EPOCH
}
function isCC() { function isCC() {
N = 0 N = 0
if (!/^EDB? /) return 0 if (!/^EDB? /) return 0
if (NE && ($2 > T0+20 || $2+20 < T0)) { if (NE && ($2 > T0+7 || $2+7 < T0)) {
N = NE N = NE
TE0 = T0 TE0 = T0
save = $0 save = $0
@ -60,10 +75,7 @@ function isCC() {
i = NDCh * $3 + $4 i = NDCh * $3 + $4
ELINES[i] = $0 ELINES[i] = $0
NE++ NE++
if (N) { if (N) doEPOCH(TE0)
if (TE0 < 0x40000000 && TLAST > 0xc0000000) EPOCH += 0x100000000
TLAST = TE0
}
return N return N
} }
@ -97,8 +109,10 @@ BEGIN {
} }
function isSETH() { function isSETH() {
if (/^H /) Time=$2
tBGO=10 tBGO=10
if (!isCC()) return if (!isCC()) return
if (!Time) return
EBGO0 = 0 EBGO0 = 0
EBGO1 = 0 EBGO1 = 0
EHETB = EE[11] EHETB = EE[11]
@ -115,6 +129,8 @@ function isSETH() {
} }
ETRIG0 = 0 ETRIG0 = 0
ETRIG1 = 0 ETRIG1 = 0
iTRIG0 = -1
iTRIG1 = 48
for (i in cTRIG) { for (i in cTRIG) {
if (EE[i] > ETRIG0) { if (EE[i] > ETRIG0) {
ETRIG0 = EE[i] ETRIG0 = EE[i]
@ -129,18 +145,15 @@ function isSETH() {
} }
function doSETH() { function doSETH() {
printf "%.0f %g %g %g %g %d %g %d %g\n", TE0+EPOCH, \ printf "%.0f %d %d %g %g %g %g %g %g\n", TE0+EPOCH, \
EBGO0, EBGO1, EHETB, EHETA, \ iTRIG0, iTRIG1, ETRIG0, ETRIG1, \
iTRIG0, ETRIG0, iTRIG1, ETRIG1 EHETB, EHETA, EBGO0, EBGO1
for (i in cBGO) printf " %g", EE[i]
for (i in cBGO) printf " %g", EE[i+24]
printf "\n"
} }
function doSETHBGO() { function doSETHBGO() {
printf "%.0f %g %g %g %g %d %g %d %g", TE0+EPOCH, \ printf "%u %.0f %d %d %g %g %g %g %g %g", Time, TE0+EPOCH, \
EBGO0, EBGO1, EHETB, EHETA, \ iTRIG0, iTRIG1, ETRIG0, ETRIG1, \
iTRIG0, ETRIG0, iTRIG1, ETRIG1 EHETB, EHETA, EBGO0, EBGO1
for (i in cBGO) printf " %g", EE[i] for (i in cBGO) printf " %g", EE[i]
for (i in cBGO) printf " %g", EE[i+24] for (i in cBGO) printf " %g", EE[i+24]
printf "\n" printf "\n"
@ -292,7 +305,7 @@ function doS() {
for (i in SLINES[d]) { for (i in SLINES[d]) {
$0 = SLINES[d][i] $0 = SLINES[d][i]
if ($2 > T0+40 || $2 < T0-20) continue if ($2 > T0+40 || $2 < T0-20) continue
print d, c, T0, A, P, Phase(P), EE, $2-T0, S0, $(4+c), ($(4+c)-S0)/EE print d, c, T0, A, P, Phase(P), E, $2-T0, S0, $(4+c), ($(4+c)-S0)/E
} }
N++ N++
} }
@ -346,6 +359,42 @@ function doHIST(Ch, x) {
} }
} }
function doSETHhist() {
if (NHCh != 14) {
NHCh = 14
name[ 0] = "iT0"
name[ 1] = "iT1"
name[ 2] = "T0"
name[ 3] = "T1"
name[ 4] = "HETB"
name[ 5] = "HETA"
name[ 6] = "BGO0"
name[ 7] = "BGO1"
name[ 8] = "BGO00"
name[ 9] = "BGO01"
name[10] = "BGO02"
name[11] = "BGO10"
name[12] = "BGO11"
name[13] = "BGO11"
}
if (EBGO0 > 46 && EBGO1 > 46) {
doHIST(0, 10*resV*iTRIG0)
doHIST(1, 10*resV*iTRIG1)
doHIST(2, ETRIG0)
doHIST(3, ETRIG1)
doHIST(4, EHETB)
doHIST(5, EHETA)
}
if (ETRIG0 > 12 && ETRIG1 > 12) {
doHIST(6, EBGO0)
doHIST(7, EBGO1)
for (i in cBGO) {
doHIST( 8 + cBGO[i], EE[i])
doHIST(11 + cBGO[i], EE[i+24])
}
}
}
BEGIN { BEGIN {
NDCh = 24 NDCh = 24
NCh = 48 NCh = 48
@ -360,15 +409,16 @@ BEGIN {
} }
function print_HIST(fn) { function print_HIST(fn) {
if (!NHCh) NHCh = NCh
printf "mV" > fn printf "mV" > fn
for (i=0; i<NCh; i++) { for (i=0; i<NHCh; i++) {
printf " %s", name[i] > fn printf " %s", name[i] > fn
} }
print "" > fn print "" > fn
nx = int((maxV-minV)/resV)+1; nx = int((maxV-minV)/resV)+1;
for (xx=0; xx<nx; xx++) { for (xx=0; xx<nx; xx++) {
printf "%g", (xx+0.5)*resV+minV > fn printf "%g", (xx+0.5)*resV+minV > fn
for (i=0; i<NCh; i++) { for (i=0; i<NHCh; i++) {
printf " %d", Hist[i,xx]+0 > fn printf " %d", Hist[i,xx]+0 > fn
} }
print "" > fn print "" > fn
@ -439,6 +489,12 @@ BEGIN {
B3[d,c] = 12898 / 0x8000 B3[d,c] = 12898 / 0x8000
B4[d,c] = 24618 / 0x8000 B4[d,c] = 24618 / 0x8000
} }
# 2025-07-25-seth-10 fix ch 04
# --banana=4,-4404,10830,-23912,45271
B0[0,4] = -4404 / 0x4000
B2[0,4] = 10830 / 0x4000
B3[0,4] = -23912 / 0x8000
B4[0,4] = 45271 / 0x8000
} }
function BANANA(d,c, p) { function BANANA(d,c, p) {

View file

@ -4,10 +4,19 @@ include ../irena/libirena.make
.PRECIOUS: %.dat %.AHA .PRECIOUS: %.dat %.AHA
%.AHA: %.dat ahepamfile %.AHA: %.dat ahepamfile
./ahepamfile < $< > $@ ./ahepamfile $(CAT_BANANA) < $< > $@
%.Itime: %.AHA
../irena/Itime.awk $< > $@
ifneq ($(BANANA),)
CAT_BANANA := `cat $(BANANA)`
endif
doScut=100
%.doS: %.AHA %.doS: %.AHA
./AHEPAM.awk 'doS(){}' $< > $@ ./AHEPAM.awk 'doS(){}' doScut=$(doScut) $< > $@
%.AES: %.dat ahepamfile %.AES: %.dat ahepamfile
./ahepamfile < $< | grep '^[ES]' | grep -v 'X' | sort -nk2,2 -k1 > $@ ./ahepamfile < $< | grep '^[ES]' | grep -v 'X' | sort -nk2,2 -k1 > $@
@ -25,6 +34,11 @@ include ../irena/libirena.make
%.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
@ -41,6 +55,9 @@ EE=E
%.SETH: %.AHA %.SETH: %.AHA
./AHEPAM.awk 'isSETH(){doSETHBGO()}' $< > $@ ./AHEPAM.awk 'isSETH(){doSETHBGO()}' $< > $@
%.seth_hist: %.AHA
./AHEPAM.awk 'isSETH(){doSETHhist()}' $< > $@
CUT=P CUT=P
CUT_P=&&P>-0.398&&P<=-0.105 CUT_P=&&P>-0.398&&P<=-0.105
CUT_nP=&&(P<=-0.398||P>-0.105) CUT_nP=&&(P<=-0.398||P>-0.105)

View file

@ -2,9 +2,9 @@
if (ARG1 ne "") { if (ARG1 ne "") {
Emin = "1100" Emin = "1100"
Emax = "1300" Emax = "1500"
Pmin = "-0.5" Pmin = "-0.6"
Pmax = "0.05" Pmax = "0.1"
fn = ARG1 fn = ARG1
prefix = "seth/" prefix = "seth/"
suffix = ".ED" suffix = ".ED"
@ -25,6 +25,8 @@ a0 = 1200
set fit errorvar results logfile bfn.".log" set fit errorvar results logfile bfn.".log"
ptime = 0 ptime = 0
set samples 10000
set xra [Pmin:Pmax]
set style data dot set style data dot
plot dpab u 1:2, dpab u 1:($2*banana($3/$2)), a0/banana(x) w l lw 4 plot dpab u 1:2, dpab u 1:($2*banana($3/$2)), a0/banana(x) w l lw 4
fit a0/banana(x) dpab u 1:2 via a0 fit a0/banana(x) dpab u 1:2 via a0

View file

@ -1 +1,2 @@
--banana=-1,-3686,16027,12898,24618 --banana=-1,-3686,16027,12898,24618
--banana=4,-4404,10830,-23912,45271

View file

@ -1048,6 +1048,7 @@ const struct keywords altera_variable_names[] = {
{"ssp_block_size", {.par=&ssp_block_size}}, {"ssp_block_size", {.par=&ssp_block_size}},
{"ssp_write_ptr", {.par=&ssp_injection_write_ptr}}, {"ssp_write_ptr", {.par=&ssp_injection_write_ptr}},
{"ssp_read_ptr", {.par=&ssp_injection_read_ptr}}, {"ssp_read_ptr", {.par=&ssp_injection_read_ptr}},
{"ssp_nobuffer_count",{.par=&ssp_nobuffer_count}},
{"alterastatus", {.par=&alterastatus}}, {"alterastatus", {.par=&alterastatus}},
{"altera2status", {.par=&altera2status}}, {"altera2status", {.par=&altera2status}},
{"psconfig2", {.par=&psconfig2}}, {"psconfig2", {.par=&psconfig2}},

View file

@ -198,6 +198,13 @@ class irena_ifc(object):
def Flush(self): def Flush(self):
self._data.Flush() self._data.Flush()
def Sync(self, on=True):
if not self._data:
self._log("no data thread")
return
self._log(f"data.Sync: {self._data.Sync}{on}")
self._data.Sync = on
def Status(self, verbose=9): def Status(self, verbose=9):
if self._data: if self._data:
return self._data.Status(verbose) return self._data.Status(verbose)
@ -601,6 +608,44 @@ class irena_ifc(object):
except EOFError: except EOFError:
pass pass
class Keep_Alive_Schedule:
interval = 30
ioffset = 1
cmd = "e/in 'staying alive'"
clock_interval = 900
clock_args = {"fudge": True}
def __init__(self, cmd=None, interval=None):
if cmd:
self.cmd = cmd
if interval:
self.interval = interval
pass
def __call__(self, interval=None):
if interval:
self.interval = interval
t0 = time.time()
try:
while True:
sys.stderr.write(" \r")
print(_ifc.cmd(self.cmd))
sys.stderr.write(f"Pinging every {self.interval:.3g} seconds, type Ctrl-C to end\r")
t = time.time()
tping = self.interval - t % self.interval + self.ioffset
tclock = self.clock_interval - t % self.clock_interval
if tclock < tping:
time.sleep(tclock)
_ifc.set_clock(**self.clock_args)
tping -= tclock
if tping > 0.1:
time.sleep(tping)
except KeyboardInterrupt:
pass
def init_irena(scope, name="xRENA", prod=None, options="", long_options=[]): def init_irena(scope, name="xRENA", prod=None, options="", long_options=[]):
global _ifc, _ifc_uart, _opt global _ifc, _ifc_uart, _opt
_ifc = None _ifc = None

1
avr Submodule

@ -0,0 +1 @@
Subproject commit a7e45f235d59d5f8d815bf7daf9734e9ee0f2a2c

View file

@ -46,6 +46,7 @@ tek.verbosity = verbosity
while fmin + fres < fmax: while fmin + fres < fmax:
f = (fmin + fmax)/2 f = (fmin + fmax)/2
pulser.cmd(f"FREQ {f:.1f}") pulser.cmd(f"FREQ {f:.1f}")
tek.cmd("ACQ:NUMAVG 1")
tek.cmd("ACQ:NUMAVG 512") tek.cmd("ACQ:NUMAVG 512")
t = time.time() + t_settle t = time.time() + t_settle
phi = tek.cmd(f":MEASU:MEAS{i_phi}:VAL?")[1] phi = tek.cmd(f":MEASU:MEAS{i_phi}:VAL?")[1]

105
dorn.py
View file

@ -20,7 +20,7 @@ def HK_fmt(s, i, n, d):
def HK3_fmt(s, i, n, d): def HK3_fmt(s, i, n, d):
return f"""{i}. {n} return f"""{i}. {n}
T = {d[5]:6.2f} °C" GND = {d[0]:6.3f} V, T = {d[5]:6.2f} °C, GND = {d[0]:6.3f} V,
Vff = {d[1]:6.3f} V, Vnn = {d[2]:6.3f} V, Vpp = {d[3]:6.3f} V, Vdig = {d[4]:6.3f} V, Vff = {d[1]:6.3f} V, Vnn = {d[2]:6.3f} V, Vpp = {d[3]:6.3f} V, Vdig = {d[4]:6.3f} V,
Vcc = {d[6]:6.3f} V, Vss = {d[7]:6.3f} V. Vcc = {d[6]:6.3f} V, Vss = {d[7]:6.3f} V.
""" """
@ -47,9 +47,24 @@ def HK7_SETH_fmt(s, i, n, d):
return f"""{i}. {n} return f"""{i}. {n}
na = {repr(d[:4])} na = {repr(d[:4])}
Text = {d[6]:.1f} °C, Text = {d[6]:.1f} °C,
Ibias = {d[4]:.1f} nA. Ibias = {d[4]:.1f} nA,
Ibias = {d[7]:.1f} nA, Vbias = {d[5]:.1f} V. Ibias = {d[7]:.1f} nA, Vbias = {d[5]:.1f} V.
""" """
def HK3_LEIA_fmt(s, i, n, d):
return f"""{i}. {n}
Tadc = {d[0]:6.2f} °C,
Vadc = {d[1]:6.3f} V,
VbiasD = {d[7]:6.2f} V,
Vbias2 = {d[6]:6.1f} V,
Vpp = {d[3]:6.3f} V, Vnn = {d[2]:6.3f} V,
Vcc = {d[5]:6.3f} V, Vss = {d[4]:6.3f} V.
"""
def HK4_LEIA_fmt(s, i, n, d):
return f"""{i}. {n}
Ibias1 = {d[3]:.1f} nA, Ibias2 = {d[2]:.1f} nA, IbiasD = {d[0]:.1f} nA,
VbiasG = {d[1]:.1f} V, Vbias1 = {d[4]:.1f} V,
Tpa0 = {d[5]:6.2f} °C, Tpa1= {d[6]:6.2f} °C, Tpa2 = {d[7]:6.2f} °C.
"""
class DORN_CONFIG: class DORN_CONFIG:
# stis_ana_core 2×24 ch # stis_ana_core 2×24 ch
@ -154,11 +169,12 @@ class DORN_CONFIG:
# ! change the class attribute .HK # ! change the class attribute .HK
self.HK[4] = ("HK PA", self.HK4_SETH, HK4_SETH_fmt) self.HK[4] = ("HK PA", self.HK4_SETH, HK4_SETH_fmt)
self.HK[7] = ("HK_PWR", self.HK7_SETH, HK7_SETH_fmt) self.HK[7] = ("HK_PWR", self.HK7_SETH, HK7_SETH_fmt)
self.BGO = [(0,3), (0,12), (0,20), (1,3), (1,12), (1,20)]
HK4_AHBGO = [[ HK4_AHBGO = [[
("Tbgo₁", (degC, {})), ("Tbgo₁", (degC, {})),
("Tbgo₂", (degC, {})), ("Tbgo₂", (degC, {})),
("Vbias", -1/0.047), ("Vbias1", -1/0.047),
("Tbgo₃", (degC, {})), ("Tbgo₃", (degC, {})),
("Ibias₁", 10470/470 * 51/1051 * 100), ("Ibias₁", 10470/470 * 51/1051 * 100),
("Ibias₂", 10470/470 * 51/1051 * 100), ("Ibias₂", 10470/470 * 51/1051 * 100),
@ -170,9 +186,56 @@ class DORN_CONFIG:
# ! change the class attribute .HK # ! change the class attribute .HK
self.HK[4] = ("HK PA", self.HK4_AHBGO, HK4_AHBGO_fmt) self.HK[4] = ("HK PA", self.HK4_AHBGO, HK4_AHBGO_fmt)
# calib 2025-11-25
Fluke_cal = 1/0.862
# SN2 dac, 14*HK3H, VbiasD
VbiasD_SN2 = [
[ 64, 0.51, 0.5 * Fluke_cal ],
[ 960, 1.85, 1.6 * Fluke_cal ],
[ 1984, 3.36, 2.9 * Fluke_cal ],
[ 4992, 7.85, 6.7 * Fluke_cal ],
[ 9984, 15.27, 13.1 * Fluke_cal ],
[ 14976, 22.56, 19.3 * Fluke_cal ],
[ 19968, 29.91, 25.6 * Fluke_cal ],
[ 20992, 31.42, 26.9 * Fluke_cal ],
[ 21440, 32.06, 27.5 * Fluke_cal ],
[ 21952, 32.83, 28.0 * Fluke_cal ],
[ 24960, 37.36, 28.6 * Fluke_cal ],
]
VbiasD_a = 0.033
VbiasD_b = 0.9918
HK3_LEIA = [[
("Tadc", (degC, {})),
("Vadc", 2.0),
("Vnn", 2.5, ("Vpp", -1.5)),
("Vpp", 2.0),
("Vss", 2.5, ("Vcc", -1.5)),
("Vcc", 2.0),
("Vbias2", -1/0.022 * 66.6/75.2),
("VbiasD", -14 * VbiasD_b - VbiasD_a),
]]
HK4_LEIA = [[
("IbiasD", 100., -1.4),
("VbiasG", 46.3, ("Vref", -45.3)),
("Ibias2", 10470/470 * 51/1051 * 100, -71.0),
("Ibias1", 10470/470 * 51/1051 * 100, -52.0),
("Vbias1", -1/0.047 * 44.7/48.5),
("Tpa0", (degC, {})),
("Tpa1", (degC, {})),
("Tpa2", (degC, {})),
]]
def leia(self):
self.VREF = (3.342,)
self.slices=(0,)
self.HK[3] = ("HK_AD", self.HK3_LEIA, HK3_LEIA_fmt)
self.HK[4] = ("HK_PA", self.HK4_LEIA, HK4_LEIA_fmt)
CONFIG = DORN_CONFIG() CONFIG = DORN_CONFIG()
def hk(sl, what="print", data=None): def hk(sl=0, what="print", data=None):
if not data: if not data:
ecmd("alt/stream/off") ecmd("alt/stream/off")
_ifc.menable() _ifc.menable()
@ -187,25 +250,26 @@ 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 = []
VV = {"Vref": CONFIG.Vref(sl)}
for a in range(8): for a in range(8):
V = {} V = {}
ddata.append(V) ddata.append(V)
@ -227,19 +291,20 @@ def hk(sl, what="print", data=None):
else: else:
data[a][c] *= Vref*H[1] data[a][c] *= Vref*H[1]
V[H[0]] = data[a][c] V[H[0]] = data[a][c]
VV.update(V)
for c in range(8): for c in range(8):
H = HK[c] H = HK[c]
if len(H) > 2: if len(H) > 2:
if isinstance(H[2], tuple): if isinstance(H[2], tuple):
data[a][c] += V[H[2][0]] * H[2][1] data[a][c] += VV[H[2][0]] * H[2][1]
else: else:
data[a][c] += H[2] data[a][c] += H[2]
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 +314,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
@ -331,7 +396,7 @@ def enable_trigger(sl, triggers, det=False, sa=False):
i = 2 if sa else 0 if det else 1 i = 2 if sa else 0 if det else 1
dorn_config(0x008 | i, triggers, slice=sl) dorn_config(0x008 | i, triggers, slice=sl)
def nsamples(sl, n=None, m=None, **slice): def nsamples(sl, n=None, m=None):
if n is None: if n is None:
return dorn_config(0x00b, slice=sl) return dorn_config(0x00b, slice=sl)
if m is None: if m is None:
@ -640,3 +705,15 @@ def mem_op(addr=None, hist=None, bank=None, data=None, read=None, clear=None, ba
dorn_config(base+1, h, "mem data high") dorn_config(base+1, h, "mem data high")
dh = h dh = h
dorn_config(base, d & 0xffff, "mem data write") dorn_config(base, d & 0xffff, "mem data write")
def VbiasD(V):
a = 0.48
b = 95.97
if V < 0:
V = -V
if V>32:
raise valueError(f"VbiasD too large {V}V > 32V")
d = int(0x10000/b*(V-a) + 32)
if d<0:
d = 0
ecmd(f"v dac={d}", verb=True)

View file

@ -6,7 +6,7 @@ import sys, getopt
oo,ff = getopt.getopt(sys.argv[1:], "saw:n:c:", oo,ff = getopt.getopt(sys.argv[1:], "saw:n:c:",
["seth", "ahbgo", "what=", "slice=", "channels="]) ["seth", "ahbgo", "what=", "slice=", "channels="])
what="print" what="pretty"
sl = None sl = None
ch = list(range(8)) ch = list(range(8))
@ -22,17 +22,23 @@ for o,v in oo:
if o=="-c" or o=="--channels": if o=="-c" or o=="--channels":
ch = list(map(int, v.split(","))) ch = list(map(int, v.split(",")))
T = 0 def hk_file(f):
for fn in ff: T = 0
with open(fn) as f: for l in f:
for l in f: if l[:2] == "H ":
if l[:2] == "H ": T = int(l.split()[1])
T = int(l.split()[1]) continue
continue if not T:
if not T: continue
continue s, h = dorn.hk(sl, what=what, data=l)
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, s, c, h[c])
print(T, c, h[c])
if not ff:
hk_file(sys.stdin)
else:
for fn in ff:
with open(fn) as f:
hk_file(f)

2
flash_IRENA/CRONGD4.RC Normal file
View file

@ -0,0 +1,2 @@
@s/if !ssp_dma: s/exit
@nm/count/clear/float

8
flash_LEIA/CRON.RC Normal file
View file

@ -0,0 +1,8 @@
@clock/short
@v S=sec%12
@s/if hk_mes>1: v hk_count=1
@s/if !S: nm/cou/re/cl/fl; s/exit
@s/if S&1: s/exit
@s/if S&2: pres/inj; s/exit
@s/if S&4: v hk_count=1; s/exit
@s/if S&8: dorn/fifo/strobe/inj 0x10; s/exit

12
flash_LEIA/DORN.RC Normal file
View file

@ -0,0 +1,12 @@
@v/cache iter
@s/for 24: s/exe 'DORNCC.RC' 0, i, 0x10000
@dorn/l3 [0,4,0] -4404
@dorn/l3 [0,4,1] 10830
@dorn/l3 [0,4,2] -23912
@dorn/l3 [0,4,3] 0x7fff (overflow: 45271)
@dorn/fifo/enable/inj 0xdb1
@dorn/enable/samples/inj 0
@v $T = 0
@dorn/enable/t1/inj $T
@dorn/enable/t2/inj $T / 0x10000 + $T * 0x100
@dorn/enable/t3/inj $T / 0x100

30
flash_LEIA/DORNCC.RC Normal file
View file

@ -0,0 +1,30 @@
@v $C = 24*$1 + $2
@s/if !Z[$C]: v Z[$C]=8
@dorn/thr [$1,$2] Z[$C]
@s/if !$3: v $3 = 0x10000
@v $A[0] = -1203
@v $A[1] = -1203
@v $A[2] = -1203
@v $A[3] = -1186
@v $A[4] = -39
@v $A[5] = 1709
@v $A[6] = 2000
@v $A[7] = 1125
@v $X = 0
@s/for 7: v $Y=$A[7-i]*$3/0x10000; v $X=$X-$Y; dorn/a [$1,$2,7-i] $Y
@dorn/a [$1,$2,0] $X
@v $A[0] = 0
@v $A[1] = 0
@v $A[2] = 0
@v $A[3] = 0
@v $A[4] = 2000
@v $A[5] = 970
@v $A[6] = -1082
@v $A[7] = -1888
@v $X = 0
@s/for 7: v $Y=$A[i]*$3/0x10000; v $X=$X-$Y; dorn/b [$1,$2,i] $Y
@dorn/b [$1,$2,7] $X
@dorn/l3 [$1,$2,0] -3686
@dorn/l3 [$1,$2,1] 16027
@dorn/l3 [$1,$2,2] 12898
@dorn/l3 [$1,$2,3] 24618

10
flash_LEIA/INIT.RC Normal file
View file

@ -0,0 +1,10 @@
@sleep 1
@var/set verb=3
@var/set script_cron_prio = 3
@var/set dac=0
@s/if product==0xee0a: altera/file "NMLEIAV1.RBF"
@s/if errno>=500: s/exit
@s/if product==0xee0c: altera/file "NMLEIAV2.RBF"
@s/if errno>=500: s/exit
@e/eval "s/exe 'SN%d.RC'", serial
@s/exe "DORN.RC"

BIN
flash_LEIA/NMLEIAV1.RBF Normal file

Binary file not shown.

BIN
flash_LEIA/NMLEIAV2.RBF Normal file

Binary file not shown.

7
flash_LEIA/README.TXT Normal file
View file

@ -0,0 +1,7 @@
FAT12 2MByte Filesystem for NMAHEPAM
INIT.RC script loaded at startup
NMAHEPAM.RBF Altera FPGA bitfile, Cyclone 10CL025
CRON.RC cron script, to to HK every Minute
SN14.RC unit config
I2C.RC SETH magnetometer and accelerometer config

2
flash_LEIA/SN16.RC Normal file
View file

@ -0,0 +1,2 @@
@v bate_hash = 0x29ef
pres/read/verify

2
flash_LEIA/SN2.RC Normal file
View file

@ -0,0 +1,2 @@
@v bate_hash = 0x3921
pres/read/verify

View file

@ -7,7 +7,7 @@
@s/if S&1: i2c/run; s/exit @s/if S&1: i2c/run; s/exit
@s/if S&2: pres/inj; s/exit @s/if S&2: pres/inj; s/exit
@s/if S&4: v hk_count=1; s/exit @s/if S&4: v hk_count=1; s/exit
dorn/fifo/strobe/inj 0x30 @dorn/fifo/strobe/inj 0x30
@s/if sd_status & 0xc00: var sd_write_size=0 @s/if sd_status & 0xc00: var sd_write_size=0
@s/if ! sd_write_size: s/exe "MICROSD.RC" @s/if ! sd_write_size: s/exe "MICROSD.RC"
@s/if ! udp_rx_cmd: var udp_size=0 @s/if ! udp_rx_cmd: var udp_size=0

View file

@ -1,3 +1,3 @@
@s/if pres<8000 or pres>11000 or temp > 3432 or temp < 2432: s/exit @s/if pres<8000 or pres>11000 or temp > 3432 or temp < 2432: s/exit
s/exec "SAFE.RC" 3 s/exec "SAFE.RC" 3
@e not reached, spy file is closed @e not reached after three hits

View file

@ -1,29 +1,17 @@
@v/cache iter @v/cache iter
@s/for 24: s/exe 'DORNCC.RC' 0, i @s/for 24: s/exe 'DORNCC.RC' 0, i, 0x10000
@s/exe 'DORNCC.RC' 1, 0, 0x0f385 @s/for 24: s/exe 'DORNCC.RC' 1, i, 0x10000
@s/exe 'DORNCC.RC' 1, 1, 0x0f75d @s/exe 'DORNCC.RC' 0, 3, 0x0ea90
@s/exe 'DORNCC.RC' 1, 2, 0x0f13b @s/exe 'DORNCC.RC' 0, 12, 0x0e451
@s/exe 'DORNCC.RC' 1, 3, 0x0f635 @s/exe 'DORNCC.RC' 0, 20, 0x0dbe5
@s/exe 'DORNCC.RC' 1, 4, 0x0f914 @s/exe 'DORNCC.RC' 1, 3, 0x0f72d
@s/exe 'DORNCC.RC' 1, 5, 0x0f248 @s/exe 'DORNCC.RC' 1, 12, 0x10000
@s/exe 'DORNCC.RC' 1, 6, 0x10000 @s/exe 'DORNCC.RC' 1, 20, 0x0ed2b
@s/exe 'DORNCC.RC' 1, 7, 0x0fd86 @s/exe 'DORNCC.RC' 0, 4, 0xe38e
@s/exe 'DORNCC.RC' 1, 8, 0x0eb56 @dorn/l3 [0,4,0] -4404
@s/exe 'DORNCC.RC' 1, 9, 0x0f4af @dorn/l3 [0,4,1] 10830
@s/exe 'DORNCC.RC' 1, 10, 0x0f984 @dorn/l3 [0,4,2] -23912
@s/exe 'DORNCC.RC' 1, 11, 0x0fe83 @dorn/l3 [0,4,3] 0x7fff (overflow: 45271)
@s/exe 'DORNCC.RC' 1, 12, 0x0f507
@s/exe 'DORNCC.RC' 1, 13, 0x0f58b
@s/exe 'DORNCC.RC' 1, 14, 0x0ed1f
@s/exe 'DORNCC.RC' 1, 15, 0x0f0d1
@s/exe 'DORNCC.RC' 1, 16, 0x0ecb2
@s/exe 'DORNCC.RC' 1, 17, 0x0f4b3
@s/exe 'DORNCC.RC' 1, 18, 0x0fa8b
@s/exe 'DORNCC.RC' 1, 19, 0x0f43d
@s/exe 'DORNCC.RC' 1, 20, 0x0f442
@s/exe 'DORNCC.RC' 1, 21, 0x0f380
@s/exe 'DORNCC.RC' 1, 22, 0x0fae5
@s/exe 'DORNCC.RC' 1, 23, 0x0fb39
@dorn/fifo/enable/inj 0xdb3 @dorn/fifo/enable/inj 0xdb3
@s/for 2: dorn/enable[i]/samples/inj 0 @s/for 2: dorn/enable[i]/samples/inj 0
@v $T = 0x101808 @v $T = 0x101808

View file

@ -22,8 +22,8 @@
@v $A[6] = -1082 @v $A[6] = -1082
@v $A[7] = -1888 @v $A[7] = -1888
@v $X = 0 @v $X = 0
@s/for 7: v $Y=$A[7-i]*$3/0x10000; v $X=$X-$Y; dorn/b [$1,$2,7-i] $Y @s/for 7: v $Y=$A[i]*$3/0x10000; v $X=$X-$Y; dorn/b [$1,$2,i] $Y
@dorn/b [$1,$2,0] $X @dorn/b [$1,$2,7] $X
@dorn/l3 [$1,$2,0] -3686 @dorn/l3 [$1,$2,0] -3686
@dorn/l3 [$1,$2,1] 16027 @dorn/l3 [$1,$2,1] 16027
@dorn/l3 [$1,$2,2] 12898 @dorn/l3 [$1,$2,2] 12898

View file

@ -1,7 +1,7 @@
eth/source/ip 172.16.18.112 eth/source/ip 172.16.18.121
echo eth config SETH echo eth config SETH
@eth/dest/str/mac/ip/port 3c:97:0e:ce:30:48 172.16.18.110 1112 @eth/dest/str/mac/ip/port 3c:97:0e:ce:30:48 172.16.18.120 1112
@eth/dest/mes/mac/ip/port 3c:97:0e:ce:30:48 172.16.18.110 1113 @eth/dest/mes/mac/ip/port 3c:97:0e:ce:30:48 172.16.18.120 1113
@eth/init/full @eth/init/full
@s/if errno>=500: s/exit @s/if errno>=500: s/exit
@var/set eth_verbosity = 4 @var/set eth_verbosity = 4

View file

@ -3,8 +3,12 @@
@var/set script_cron_prio = 3 @var/set script_cron_prio = 3
sd/init sd/init
@var/set dac=0 @var/set dac=0
@s/exec "ETH.RC"
@s/if product!=0xee0c: s/exit @s/if product!=0xee0c: s/exit
altera/file "NMAHEPAM.RBF" altera/file "NMAHEPAM.RBF"
@s/if errno==852: altera/file "NMAHEPAM.RBF"
@s/if errno==852: altera/file "NMAHEPAM.RBF"
@s/if errno==852: altera/file "NMAHEPAM.RBF"
@s/if errno>=500: s/exit @s/if errno>=500: s/exit
@e/eval "s/exe 'SN%d.RC'", serial @e/eval "s/exe 'SN%d.RC'", serial
@s/exe "DORN.RC" @s/exe "DORN.RC"

View file

@ -1,16 +1,16 @@
@alt/stream/off @alt/stream/off
@s/exe "PRESSURE.RC" @s/exe "PRESSURE.RC"
var/set spi_min_qtime = 665 var spi_min_qtime = 665
@var/set udp_reset = 1000000 @var udp_reset = 1000000
@al/fifo/clear 1 @al/fifo/clear 1
@al/fifo/set 10 @al/fifo/set 10
@al/fifo/reset 0x1f0 @al/fifo/reset 0x1f0
@var/set sd_write_size = 0 @var sd_write_size = 0
@v/set sd_write_count = 0 @var sd_write_count = 0
@v/set udp_count = 0 @var udp_count = 0
@v/set udp_size = 0 @var udp_size = 0
@V W=600 @var W=600
@v/set R=-1 @var R=-1
@script/cron/none @script/cron/none
@var/cache ssp_dma spy_return second time hk_count hk_mes @var/cache ssp_dma spy_return second time hk_count hk_mes
@var/cache sd_status udp_rx_cmd udp_size enc altera @var/cache sd_status udp_rx_cmd udp_size enc altera

View file

@ -1,9 +1,9 @@
@var/cache pressure temp @var/cache pressure temp
@var F=4 @var F=4
@pres/read/verify pres/read/verify
@s/if errno >= 500: s/exit @s/if errno >= 500: s/exit
@pressure/spy/on @pressure/spy/on
script/spy "ASCENT.SPY" s/spy "ASCENT.SPY"
@var F=1 @var F=1
@var N=0 @var N=0
@var script_cron_prio=3 @var script_cron_prio=3

View file

@ -4,3 +4,10 @@
pres/read/verify pres/read/verify
@s/if errno >= 500: s/exit @s/if errno >= 500: s/exit
@v F=5 @v F=5
@v Z[11] = 15
@v Z[ 3] = 15
@v Z[12] = 15
@v Z[20] = 15
@v Z[27] = 15
@v Z[36] = 15
@v Z[44] = 15

View file

@ -2,3 +2,4 @@
eth/init/full eth/init/full
@s/if enc == 0xb: eth/rx/en @s/if enc == 0xb: eth/rx/en
@s/if enc == 0xf: var/set udp_size=R @s/if enc == 0xf: var/set udp_size=R
@v spi_min_q = 665

View file

@ -1,2 +1,2 @@
@pressure/inject @clock/short
@s/if sd_status & 0xc00: sd/init @s/if !(sec % M): nm/cou/clear/short

View file

@ -21,25 +21,25 @@ irena/nsamples 0 0x3f
irena/adcmask 0x02664 irena/adcmask 0x02664
irena/windows 2 5 8 irena/windows 2 5 8
echo Thresholds 100*mV high gain echo Thresholds 100*mV high gain
@var/set V=14000 @var/set mV=14000
@irena/l1t 0 1000*V 0x000 @irena/l1t 0 1000*mV 0x000
@irena/l1t 1 100*V 0x000 @irena/l1t 1 100*mV 0x000
@irena/l1t 2 100*V 0x001 @irena/l1t 2 100*mV 0x001
@irena/l1t 3 1000*V 0x000 @irena/l1t 3 1000*mV 0x000
@irena/l1t 4 1000*V 0x000 @irena/l1t 4 1000*mV 0x000
@irena/l1t 5 100*V 0x001 @irena/l1t 5 100*mV 0x001
@irena/l1t 6 100*V 0x001 @irena/l1t 6 100*mV 0x001
@irena/l1t 7 1000*V 0x000 @irena/l1t 7 1000*mV 0x000
@irena/l1t 8 1000*V 0x000 @irena/l1t 8 1000*mV 0x000
@irena/l1t 9 100*V 0x001 @irena/l1t 9 100*mV 0x001
@irena/l1t 10 100*V 0x001 @irena/l1t 10 100*mV 0x001
@irena/l1t 11 1000*V 0x000 @irena/l1t 11 1000*mV 0x000
@irena/l1t 12 1000*V 0x000 @irena/l1t 12 1000*mV 0x000
@irena/l1t 13 100*V 0x001 @irena/l1t 13 100*mV 0x001
@irena/l1t 14 100*V 0x000 @irena/l1t 14 100*mV 0x000
@irena/l1t 15 1000*V 0x000 @irena/l1t 15 1000*mV 0x000
@irena/l1t 16 1000*V 0x000 @irena/l1t 16 1000*mV 0x000
@irena/l1t 17 100*V 0x000 @irena/l1t 17 100*mV 0x000
@irena/l2t/ch=0/any=0x001/read=0x02664 All @irena/l2t/ch=0/any=0x001/read=0x02664 All
@irena/l2t/ch=1/disable @irena/l2t/ch=1/disable
@irena/l2t/ch=2/disable @irena/l2t/ch=2/disable

BIN
flash_alke/IRENA2TH.RBF Normal file

Binary file not shown.

Binary file not shown.

BIN
flash_tarena/TARENA.RBF Normal file

Binary file not shown.

View file

@ -191,5 +191,4 @@ if ifc.is_a("USB"):
try: try:
armlib._exec_file("irenarc.py", globals()) armlib._exec_file("irenarc.py", globals())
except IOError as e: except IOError as e:
sys.stderr.write(e) sys.stderr.write(repr(e))

View file

@ -467,7 +467,7 @@ function AHBGO_B() {
isMUONf="isAHBGOmuonB" isMUONf="isAHBGOmuonB"
} }
function jFETT() { function jFETTOLD() {
NC=9 NC=9
O1 = 1; thr[O1] = 45; ch[0] = O1; name[0]="O1" O1 = 1; thr[O1] = 45; ch[0] = O1; name[0]="O1"
O2 = 2; thr[O2] = 45; ch[1] = O2; name[1]="O2" O2 = 2; thr[O2] = 45; ch[1] = O2; name[1]="O2"
@ -492,6 +492,31 @@ function jFETT() {
PP[-1][3] = 0 PP[-1][3] = 0
} }
function jFETT() {
NC=9
O1 = 0; thr[O1] = 45; ch[0] = O1; name[0]="O1"
O2 = 3; thr[O2] = 45; ch[1] = O2; name[1]="O2"
O3 = 5; thr[O3] = 45; ch[2] = O3; name[2]="O3"
B1 = 6; thr[B1] = 45; ch[3] = B1; name[3]="B1"
B2 = 9; thr[B2] = 30; ch[4] = B2; name[4]="B2"
B3 = 11; thr[B3] = 30; ch[5] = B3; name[5]="B3"
N1 = 12; thr[N1] = 30; ch[6] = N1; name[6]="N1"
N2 = 15; thr[N2] = 30; ch[7] = N2; name[7]="N2"
N3 = 17; thr[N3] = 25; ch[8] = N3; name[8]="N3"
BB[O3][0] = -0.0212738 # ± 1.042e-05
BB[O3][1] = 0
BB[O3][2] = 25.3283 # ± 0.07168
BB[O3][3] = 0
BB[-1][0] = -0.0212738 # ± 1.042e-05
BB[-1][1] = 0
BB[-1][2] = 25.3283 # ± 0.07168
BB[-1][3] = 0
PP[-1][0] = -0.0353472 # +/- 5.721e-06
PP[-1][1] = 35.2581 # +/- 0.01238
PP[-1][2] = 0
PP[-1][3] = 0
}
function SOPA() { function SOPA() {
NC=9 NC=9
P1 = 1; thr[P1] = 45; ch[0] = P1; name[0]="P1" P1 = 1; thr[P1] = 45; ch[0] = P1; name[0]="P1"
@ -713,6 +738,10 @@ function ismuonMM() {
function isPHA(i) { function isPHA(i) {
if (!/^EI/) return 0; if (!/^EI/) return 0;
A = $(3*i+6)/mV A = $(3*i+6)/mV
if (A>10)
P = $(3*i+8)/mV/A
else
P = 0
if ($(3*i+7)<2) return 1; if ($(3*i+7)<2) return 1;
return 2 return 2
} }

View file

@ -2,7 +2,7 @@
END { print Itime } END { print Itime }
/^H/ { /^H / {
Time = $2 Time = $2
Diff = Time - Last Diff = Time - Last
if (Diff>0 && Diff<=120) Itime += Diff if (Diff>0 && Diff<=120) Itime += Diff

View file

@ -84,42 +84,7 @@ def CHAOS_NAMES():
{ "any": 0x100, "read": 0x3ffff }, # DL { "any": 0x100, "read": 0x3ffff }, # DL
] ]
class Keep_Alive_Schedule: Keep_Alive = armlib.Keep_Alive_Schedule(
interval = 30
ioffset = 1
cmd = "e/in 'staying alive'"
clock_interval = 900
clock_args = {"fudge": True}
def __init__(self, cmd=None, interval=None):
if cmd:
self.cmd = cmd
if interval:
self.interval = interval
pass
def __call__(self):
t0 = time.time()
try:
while True:
sys.stderr.write(" \r")
print(cmd(self.cmd))
sys.stderr.write(f"Pinging every {self.interval:.3g} seconds, type Ctrl-C to end\r")
t = time.time()
tping = self.interval - t % self.interval + self.ioffset
tclock = self.clock_interval - t % self.clock_interval
if tclock < tping:
time.sleep(tclock)
ifc.set_clock(**self.clock_args)
tping -= tclock
if tping > 0.1:
time.sleep(tping)
except KeyboardInterrupt:
pass
Keep_Alive = Keep_Alive_Schedule(
cmd = "e/in" cmd = "e/in"
" '%u.%u %u.%u mbar %d %d °C F=%u H=%u'," " '%u.%u %u.%u mbar %d %d °C F=%u H=%u',"
" pre/10, pre%10, pre[1]/10, pre[1]%10," " pre/10, pre%10, pre[1]/10, pre[1]%10,"

View file

@ -1,9 +1,9 @@
HW = { HW.update({
"NCH" : 18, "NCH" : 18,
"NPEEK" : 18, "NPEEK" : 18,
} })
def defaults(nch=18, ntr=6): def defaults(nch=18, ntr=6):
adcmask() adcmask()
@ -58,8 +58,10 @@ pulse_desy = [
pulse_desy.reverse() pulse_desy.reverse()
def shaper2u2(nch=18, ntr=6, **kk): def shaper2u2(nch=18, ntr=6, **kk):
HW["NCH"] = nch
global mV global mV
mV=14000 mV=14000
Var("mV", mV)
defaults(nch=nch, ntr=ntr) defaults(nch=nch, ntr=ntr)
pulse(range(nch), pulse2u2, **kk) pulse(range(nch), pulse2u2, **kk)
readconfig(nch=nch, ntr=ntr) readconfig(nch=nch, ntr=ntr)
@ -277,12 +279,11 @@ def TANOS():
readconfig() readconfig()
def Gd4(): def Gd4():
global mV shaper2u2()
mV=14000
readmask=0x6666 readmask=0x6666
adcmask(readmask) adcmask(readmask)
windows(2,3,4,5) windows(2,3,4,5)
for c in (0,3,4,7,8,11,12,15,16): for c in (0,3,4,7,8,11,12,15,16,17):
thres(c, 100*mV, mask=0) thres(c, 100*mV, mask=0)
for i in range(4): for i in range(4):
thres(4*i+1, 100*mV, mask=(1<<i)|(1<<(2*i+4))) thres(4*i+1, 100*mV, mask=(1<<i)|(1<<(2*i+4)))
@ -292,6 +293,27 @@ def Gd4():
l2trig(5, all=2, read=0) l2trig(5, all=2, read=0)
readconfig() readconfig()
def Gd4_2thr():
cmd("alt/file 'IRENA2TH.RBF'")
Script("IRENA.RC")
shaper2u2(nch=9)
readmask=0x0ff
adcmask(readmask)
windows(2,3,4,5)
for c in (8,17):
thres(c, 1000*mV, mask=0)
for i in range(4):
thres(2*i+0, 100*mV, mask=(1<<i)|(1<<(2*i+4)))
thres(2*i+1, 100*mV, mask=(1<<i)|(1<<(2*i+5)))
thres(2*i+9, 100*mV, mask=0);
thres(2*i+10, 100*mV, mask=0);
l2trig(i, any=1<<i, read=readmask)
l2trig(4, all=1, read=0)
l2trig(5, all=2, read=0)
readconfig()
Var("M", 3)
cmd("s/cron 'CRON.RC'")
def TRES(): def TRES():
shaper2u2() shaper2u2()
global mV, AH, BH, CH, AL, BL, CL global mV, AH, BH, CH, AL, BL, CL

View file

@ -43,296 +43,6 @@ def shaper2u2(nch=18, ntr=6, **kk):
pulse(range(nch), pulse2u2, **kk) pulse(range(nch), pulse2u2, **kk)
readconfig(nch=nch, ntr=ntr) readconfig(nch=nch, ntr=ntr)
def ADAMPROTO():
shaper2u2()
adcmask(0x003f0)
thres(4, 20*mV, 0x002)
thres(7, 20*mV, 0x004)
thres(8, 20*mV, 0x008)
l2trig(0, any=2, read=0x3ffff)
l2trig(1, any=4, read=0x3ffff)
l2trig(2, any=8, read=0x3ffff)
def LGRDM():
global mV
global A1, A2, A3, B1, B2, C1, C2
A1 = 6
A2 = 9
A3 = 13
B1 = 1
B2 = 10
C1 = 5
C2 = 14
mV=14000
adcmask(0x06662)
l2trig(0, any=1, read=0x06662)
for ch in range(18):
thres(ch, 12*mV)
for ch in (B1, B2, C1, C2,):
thres(ch, 3*mV)
for ch in (A2, A3,):
thres(ch, 9*mV)
for ch in (A1,):
thres(ch, 5*mV)
def TAT(thr=100):
global mV
mV=14000
global X1, C1, O1, X2, C2, O2
X1=9
C1=13
O1=5
X2=6
C2=10
O2=2
shaper2u2()
thres(O1, thr*mV, 0x003)
thres(X1, thr*mV, 0x005)
thres(C1, thr*mV, 0x009)
thres(O2, thr*mV, 0x011)
thres(X2, thr*mV, 0x021)
thres(C2, thr*mV, 0x041)
readmask = 0x02664
l2trig(0, any=2, read=readmask)
l2trig(1, any=4, read=readmask)
l2trig(2, any=8, read=readmask)
l2trig(3, any=16, read=readmask)
l2trig(4, any=32, read=readmask)
l2trig(5, any=64, read=readmask)
windows(2,5,8)
readconfig()
def MD3(thr=100):
global mV
global A1L, A1H, A2H, A2L, B1L, B1H, B2H, B2L, C1L, C1H, C2H, C2L
A1L, A1H, A2H, A2L, B1L, B1H, B2H, B2L, C1L, C1H, C2H, C2L = range(12)
mV=14000
shaper2u2(negate=True)
thres( 0, thr*mV, 1)
thres( 1, thr*mV, 1)
thres( 2, thr*mV, 2)
thres( 3, thr*mV, 2)
thres( 4, thr*mV, 4)
thres( 5, thr*mV, 4)
thres( 6, thr*mV, 8)
thres( 7, thr*mV, 8)
thres( 8, thr*mV,16)
thres( 9, thr*mV,16)
thres(10, thr*mV,32)
thres(11, thr*mV,32)
readmask = 0x00fff
l2trig(0, any=1, read=readmask)
l2trig(1, any=2, read=readmask)
l2trig(2, any=4, read=readmask)
l2trig(3, any=8, read=readmask)
l2trig(4, any=16, read=readmask)
l2trig(5, any=32, read=readmask)
windows(2,5,8)
readconfig()
def TANOS_NAMES():
global AH, AL, BH, BL, C1H, C1L, C2H, C2L, HH, HL
global D1, D2, E1, E2, F1, F2, G1, G2
global LG, HG, SG
global mV
global thr, l1
AH = 16
AL = 15
BH = 10
BL = 9
C1H = 4
C1L = 3
C2H = 7
C2L = 6
HH = 13
HL = 12
D1 = 14
D2 = 0
E1 = 1
E2 = 17
F1 = 11
F2 = 5
G1 = 8
G2 = 2
HG = (AH, BH, C1H, C2H, HH)
LG = (AL, BL, C1L, C2L, HL)
SG = (D1, D2, E1, E2, F1, F2, G1, G2)
mV = 14000
thr=[100]*18
l1=[0]*18
thr[AH ] = 8; l1[AH ] = 0x001
thr[AL ] = 5; l1[AL ] = 0x001
thr[BH ] = 5; l1[BH ] = 0x001
thr[BL ] = 5; l1[BL ] = 0x001
thr[C1H] = 5; l1[C1H] = 0x001
thr[C1L] = 5; l1[C1L] = 0x001
thr[C2H] = 6; l1[C2H] = 0x001
thr[C2L] = 5; l1[C2L] = 0x001
thr[HH ] = 8; l1[HH ] = 0x001
thr[HL ] = 5; l1[HL ] = 0x001
thr[D1 ] = 15; l1[D1 ] = 0x001
thr[D2 ] = 20; l1[D2 ] = 0x001
thr[E1 ] = 13; l1[E1 ] = 0x001
thr[E2 ] = 14; l1[E2 ] = 0x001
thr[F1 ] = 10; l1[F1 ] = 0x001
thr[F2 ] = 15; l1[F2 ] = 0x001
thr[G1 ] = 14; l1[G1 ] = 0x001
thr[G2 ] = 18; l1[G2 ] = 0x001
for c in (AH,HH):
l1[c] |= 0x002
for c in (C1H,C2H):
l1[c] |= 0x004
l1[HH] |= 0x008
for c in LG:
l1[c] |= 0x010
for c in HG:
l1[c] |= 0x020
for c in SG:
l1[c] |= 0x040
def TANOS_cold_thr():
TANOS_NAMES()
for c in range(18): cmd("v Z[%d]=%d" % (c, thr[c]*mV))
cmd("sc/exe 'THRES.RC' 0")
for c in range(18): cmd("echo/info 'thr[%d] %%d', Z[%d]/mV" %(c,c))
def Keep_Alive(interval=60.0, cmd=messages):
try:
while True:
cmd()
sys.stderr.write("Pinging every %g seconds, type Ctrl-C to end\r" % interval)
time.sleep(interval)
except KeyboardInterrupt:
pass
def TANOS():
TANOS_NAMES()
shaper2u2()
readmask = 0x3ffff
adcmask(readmask)
windows(2,4,6,8)
for c in range(18):
thres(c, thr[c]*mV, l1[c])
l2trig(0, any=0x001, read=readmask)
l2trig(1, any=0x010, read=readmask)
l2trig(2, any=0x020, read=readmask)
l2trig(3, any=0x040, read=readmask)
l2trig(4, all=0x002, read=readmask)
l2trig(5, any=0x040, none=0x006, read=readmask)
readconfig()
def Gd4():
global mV
mV=14000
readmask=0x6666
adcmask(readmask)
windows(2,3,4,5)
for c in (0,3,4,7,8,11,12,15,16):
thres(c, 100*mV, mask=0)
for i in range(4):
thres(4*i+1, 100*mV, mask=(1<<i)|(1<<(2*i+4)))
thres(4*i+2, 100*mV, mask=(1<<i)|(1<<(2*i+5)))
l2trig(i, any=1<<i, read=readmask)
l2trig(4, all=1, read=0)
l2trig(5, all=2, read=0)
readconfig()
def TRES():
shaper2u2()
global mV, AH, BH, CH, AL, BL, CL
mV=14000
CL, CH, BL, BH, AL, AH = (9,10,12,13,15,16)
readmask=0x1b600
adcmask(readmask)
windows(2,5,7,10)
for c in range(18):
if c not in (AH, BH, CH, AL, BL, CL):
thres(c, 100*mV, mask=0)
thres(AH, 20*mV, 0x11)
thres(AL, 10*mV, 0x21)
thres(BH, 20*mV, 0x12)
thres(BL, 10*mV, 0x22)
thres(CH, 20*mV, 0x14)
thres(CL, 10*mV, 0x24)
l2trig(0, any=1, read=readmask)
l2trig(1, any=2, read=readmask)
l2trig(2, any=4, read=readmask)
l2trig(3, any=0x10, read=readmask)
l2trig(4, any=0x20, read=readmask)
l2trig(5, all=0x3ff, none=0x3ff, read=0)
readconfig()
def RADBC():
shaper2u2()
global mV, A, B, C, D
mV=14000
A, B, C, D = (1,2,13,14)
readmask=0x06006
adcmask(readmask)
windows(2,5,7,10)
for c in range(18):
if c not in (A, B, C, D):
thres(c, 100*mV, mask=0)
thres(A, 25*mV, 0x1)
thres(B, 20*mV, 0x2)
thres(C, 180*mV, 0x4)
thres(D, 20*mV, 0x8)
l2trig(0, any=1, read=readmask)
l2trig(1, any=2, read=readmask)
l2trig(2, any=4, read=readmask)
l2trig(3, any=8, read=readmask)
l2trig(4, all=0x3ff, none=0x3ff, read=0)
l2trig(5, all=0x3ff, none=0x3ff, read=0)
readconfig()
def AHEPAM_CHERENKOV():
shaper2u2()
pulse((16,17), pulse2u2neg)
global mV, BC, B1, B2, B3, H1, H2, H3, H4, PMT, readmask
mV=14000
BC, B1, B2, B3, H1, H2, H3, H4, PMT = (1, 2, 5, 6, 14, 13, 10, 9, 17)
readmask=0x36666
adcmask(readmask)
windows(2,5,7,10)
for c in range(18):
thres(c, 100*mV, mask=0)
thres(BC, 22*mV, 0x001)
thres(B1, 18*mV, 0x002)
thres(B2, 18*mV, 0x002)
thres(B3, 18*mV, 0x002)
thres(H1, 15*mV, 0x014)
thres(H2, 15*mV, 0x024)
thres(H3, 15*mV, 0x044)
thres(H4, 15*mV, 0x084)
thres(PMT, 5*mV, 0x008)
l2trig(0, any=1, read=readmask)
l2trig(1, any=2, read=readmask)
l2trig(2, any=4, read=readmask)
l2trig(3, any=8, read=readmask)
l2trig(4, any=5, read=readmask)
l2trig(5, any=6, read=readmask)
readconfig()
def AHEPAM_MUONS():
AHEPAM_CHERENKOV()
thres(BC, 45*mV, 0x001)
thres(B1, 45*mV, 0x002)
thres(B2, 45*mV, 0x002)
thres(B3, 45*mV, 0x002)
thres(H1, 30*mV, 0x014)
thres(H2, 30*mV, 0x024)
thres(H3, 30*mV, 0x044)
thres(H4, 30*mV, 0x084)
thres(PMT, 200*mV, 0x008)
l2trig(0, any=5, read=readmask)
l2trig(1, any=6, read=readmask)
l2trig(2, any=0x11, read=readmask)
l2trig(3, any=0x41, read=readmask)
l2trig(4, any=0x12, read=readmask)
l2trig(5, any=8, read=readmask)
nsamples(63,0xc)
readconfig()
def execfile(fn): def execfile(fn):
armlib._exec_file(fn, globals()) armlib._exec_file(fn, globals())
@ -352,7 +62,7 @@ def jFETT(threshold=50):
global mV, O1, O2, O3, B1, B2, B3, N1, N2, N3 global mV, O1, O2, O3, B1, B2, B3, N1, N2, N3
mV=14000 mV=14000
O1, O2, O3, B1, B2, B3, N1, N2, N3 = 1, 2, 4, 7, 8, 10, 13, 14, 16 O1, O2, O3, B1, B2, B3, N1, N2, N3 = 1, 2, 4, 7, 8, 10, 13, 14, 16
readmask = 0x16596 readmask = 0x3ffff
adcmask(readmask) adcmask(readmask)
windows(2,3,4,5) windows(2,3,4,5)
for c in range(18): for c in range(18):
@ -386,7 +96,7 @@ def SOPA(threshold=50):
l2trig(5, all=0x3ff, none=0x3ff, read=0) l2trig(5, all=0x3ff, none=0x3ff, read=0)
readconfig() readconfig()
def jfett_pulser(amplitudes=(0.1, 0.2, 0.4, 0.8, 1.6, 3.2), t=600, tsamples=0, fn=None, ns=32): def jfett_pulser(amplitudes=(0.1, 0.2, 0.4, 0.8, 1.6, 3.2), t=15*60, tsamples=0, fn=None, ns=32):
from time import sleep from time import sleep
make_pulser() make_pulser()
pu.cmd("OUTPUT ON") pu.cmd("OUTPUT ON")
@ -394,7 +104,7 @@ def jfett_pulser(amplitudes=(0.1, 0.2, 0.4, 0.8, 1.6, 3.2), t=600, tsamples=0, f
pu.set_highlevel(amp) pu.set_highlevel(amp)
print(pu.set_highlevel(), file=sys.stderr) print(pu.set_highlevel(), file=sys.stderr)
sleep(0.1) sleep(0.1)
cmd("e/i 'agilent pa %.3f'" % amp) cmd(f"e/i 'agilent pa {amp:.3f}'")
if fn: if fn:
Start(fn % amp) Start(fn % amp)
enable() enable()

633
leia_stepper.py Normal file
View file

@ -0,0 +1,633 @@
import sys, armlib, struct, math, time
class bitnames(dict):
def str(self, b):
r = []
for k, m in self.items():
m = self.bits(m)
if (b & m) == m:
r.append(k)
b &= ~m
if not b:
break
if len(r)==1:
r = r[0]
return r
def bits(self, r, mask=False):
if isinstance(r, int):
return r
if isinstance(r, str):
return self.bits(self[r])
if isinstance(r, dict):
return sum([self.bits(rr) for rr in r if mask or r[rr]])
return sum(map(self.bits, r))
def mask_val(self, **aa):
return self.bits(aa, mask=True), self.bits(aa)
class leia_stepper:
class Stepper_Error(armlib.irena_ifc.IrenaError):
pass
def __init__(self, ifc):
if ifc:
self._connect(ifc)
def _connect(self, ifc):
self.ifc = ifc
self.ifc.cmd("spi/reset/ssel/rate 30")
print("LEIA stepper: ", self.id(), file=sys.stderr)
def _export(self, scope=None, prefix="stepper_"):
"""usage: ..._export(globals())
return a dict with all names in self that
do not begin with an '_'
and are not all uppercase.
The scope is updated with the dict.
"""
r = {
prefix+k: getattr(self, k)
for k in dir(self)
if k.upper() != k and k[0] != "_"
}
if scope:
scope.update(r)
return r
_verbose = 2
_cmd_prefix = "spi/step"
def cmd(self, cmd, arg=0, argh=None,
Error=False, retry=True,
eth_retry=False, sleep=False,
verbose=None):
if verbose is None:
verbose = self._verbose >= 2
c = ord(cmd[0])
arg2 = 0
if len(cmd)>1:
cc = f"{self._cmd_prefix} {cmd!r} 0x{arg:x}"
else:
if isinstance(arg, str):
arg = arg.encode()
if isinstance(arg, bytes):
arg = arg[0]
if len(arg) > 1:
arg2 = arg[1]
if argh is not None:
arg2 = argh
if arg & 0xff00:
cc = f"{self._cmd_prefix} {cmd!r} 0x{arg:x}"
else:
cc = f"{self._cmd_prefix} {cmd!r} 0x{arg:x} 0x{arg2:x}"
while True:
if sleep:
time.sleep(sleep)
r = self.ifc.cmd(cc, timeout=1000)
if r is None and eth_retry:
continue
if verbose:
print(cc, r, file=sys.stderr)
if self.ifc.cmdn(r) != 280:
if retry and self.ifc.cmdn(r) == 780 and r.split()[-1] == "130":
continue
raise self.Stepper_Error(r)
rr = r.split()
r1 = int(rr[2],0)
r = int(rr[3],0)
if retry and r1==0x45:
r2 = r & 0xff
if r2==0x53:
# "ES" SPI too slow or early
continue
r3 = r >> 8
if r2==0x45 and r3 != c:
# "EE" unknown command
continue
if r1 != c:
if Error:
r |= r1<<16
else:
rc = chr(r1)
if rc.isprintable():
raise self.Stepper_Error(f"{rc} {rr[3]}")
raise self.Stepper_Error(f"{rr[2]} {rr[3]}")
break
return r
def id(self):
n = self.cmd('v', 0xff, verbose=False) >> 8
return bytes(self.cmd('v', i, verbose=False) & 0xff for i in range(n)).decode()
CONFN = [
"magic",
"version",
"flags",
"period",
"slen",
"lmask",
"lval",
"step",
"enable",
"reset",
"dir",
"n_steps",
"dac_ramp",
"dac_step",
"adc_incr",
"adc_period",
"awake",
"ledoff",
"disable",
"dac_ref",
("padc", struct.Struct("<6B")),
("adc_ch", struct.Struct("<16B")),
("adc", struct.Struct("<16H")),
"dac",
"adc_idx",
"eewr_n",
"eewr_a",
("pads", struct.Struct("<42B"))
]
CONFM = b'\x1a\x1e'
CONFV = (1,)
CONFF = struct.Struct("<HBBHH6B3H6B6s16s")
STATF = struct.Struct(CONFF.format + "32sHBBH42s")
def confdict(self, b):
if len(b)==self.CONFF.size:
b = self.CONFF.unpack(b)
else:
b = self.STATF.unpack(b)
i = 0
bb = {}
for i, bbb in enumerate(b):
k = self.CONFN[i]
if isinstance(k, tuple):
bbb = list(k[1].unpack(bbb))
k = k[0]
bb[k] = bbb
return bb
def fromdict(self, b):
bb = []
for kk in self.CONFN:
k = kk
if isinstance(kk, tuple):
k = k[0]
if not k in b:
break
bbb = b[k]
if isinstance(kk, tuple):
bbb=kk[1].pack(*bbb)
bb.append(bbb)
try:
return self.CONFF.pack(*bb)
except:
pass
return self.STATF.pack(*bb)
def confbytes(self, b, a=0):
"from str, dict, list, or bytes: make conf bytes"
if isinstance(b, str):
b = self.readhex(b, a, unpack=True)
if isinstance(b, dict):
b = self.fromdict(b)
if isinstance(b, list):
bb = []
for i, bbb in enumerate(b):
if isinstance(bbb, list):
bbb = self.CONFN[i][1].pack(bbb)
bb.extend(bbb)
else:
bb.append(bbb)
try:
b = struct.pack(self.CONFF, *bb)
except:
b = struct.pack(self.STATF, *bb)
return b
def read_conf(self, stat=False, unpack=True):
b = []
while True:
r = self.cmd('x', len(b), Error=True, sleep=0.001)
if r & 0xff0000:
break
b.append(r & 0xff)
if not stat and len(b) >= self.CONFF.size:
break
b = bytes(b)
if unpack and b[:2]==self.CONFM and b[2] in self.CONFV:
return self.confdict(b)
return b
def read_eeprom(self, a=0, n=CONFF.size):
return bytes([self.cmd('x', aa | 0x800, sleep=0.001) & 0xff
for aa in range(a, a+n)])
def read_ram(self, a=0x100, n=0x800):
return bytes([self.cmd('y', aa, sleep=0.001) & 0xff
for aa in range(a, a+n)])
def read_rom(self, a=0, n=0x8000):
return bytes([self.cmd('y', aa|0x8000, sleep=0.001) & 0xff
for aa in range(a, a+n)])
def readhex(self, fn, a=0, unpack=False):
import intelhex
b = bytes(intelhex.IntelHex(fn).tobinarray())[4*a:]
if not unpack:
return b
return self.confdict(b)
def verify_conf(self, b, a=0):
f = self.confbytes(b, a)[:self.CONFF.size]
c = self.read_conf(unpack=False)[:self.CONFF.size]
return [(4*a+i, b, f[i]) for i, b in enumerate(c) if b != f[i]]
def dictdiff(self, a, b):
return [(k, a[k], b[k]) for k in a if a[k] != b[k]]
def get_confs(self, ihex="avr/leia.eeprom", eaddr=0):
self.conf = self.read_conf(unpack=True)
if ihex:
self.ihex = self.readhex(ihex, unpack=True)
if eaddr is not None:
self.econf = self.confdict(self.read_eeprom(eaddr))
print("eeprom → conf: ", self.dictdiff(self.econf, self.conf), file=sys.stderr)
if ihex:
print("ihex → conf: ", self.dictdiff(self.ihex, self.conf), file=sys.stderr)
def write_conf(self, b, a=0):
b = self.confbytes(b,a)
n = 0
for i, bb in enumerate(b):
self.cmd('X', i, bb)
n = i+1
return b[:n]
def write_eeprom(self, a=0, b=None):
if b is not None:
self.write_conf(b)
self.cmd('zW', 4*a, verbose=True)
while self.cmd('x', 83, verbose=True, Error=True) & 0xff00ff:
time.sleep(0.1)
return self.cmd('?', verbose=True)
ADC_V = {
"data": 0,
"mux": 1,
"idx": 2,
"incr": 3,
"period": 4,
"ADMUX": 5,
"ADCSRA": 6,
"ADCH": 7,
}
def adc(self, ch=0, what=None, val=None, enable=None, **aa):
"send one 'a' or 'A' command"
if what in self.ADC_V:
what = self.ADC_V[what]
for a in aa:
if what is not None or val is not None:
raise ValueError("multiple whatsits not supported")
what = self.ADC_V[a]
val = aa[a]
what = what or 0
if isinstance(val, float):
if what == self.ADC_V["period"]:
val = int(val/self.T0TICK + 0.5) # ms
else:
raise ValueError("float not supported for this whatsit")
if enable is not None:
if what and enable and val is not None:
raise ValueError("cannot enable and read a whatsit")
what != 0x80
what = (what << 4) | ch;
c = 'A' if val is not None or enable else 'a'
val = val or 0
r = self.cmd(c, val, what);
if not what & 0x70:
return r
if (r>>8) != what:
raise self.Stepper_Error(f"{c}, {val}, {what}{r}")
return r & 0xff
def dac(self, volt=None, dac=None, ramp=True, ms=None):
if ms is not None:
t = self.adc(what="period")*self.T0TICK
p = int(t * 64/ ms + 0.5)
if p < 1:
p = 1
if p > 1024:
p = 1024
self.cmd('P', p)
if self._verbose >= 1:
print(f"DAC ramp speed {t*64/p:.1f} ms/step", file=sys.stderr)
if dac is None:
if volt is None:
return self.cmd('d')
dac = int(volt/2.5*0x10000)
if dac < 0 or dac >= 0x10000:
raise ValueError(f"DAC voltage out of range {volt}, {dac}")
if not ramp:
self.cmd('P', 0)
old = self.cmd('D', dac)
if self._verbose >= 1:
print(f"DAC set to 0x{dac:04x}, old value: 0x{old:04x}",
file=sys.stderr)
def Temp(self, a, Vref, **aa):
a *= Vref/self.Vcc
return armlib.NTC(a, β=3940)
def AVR_Temp(self, a, Vref, **aa):
return a/64 * 2.5/Vref - 273
ADC_MUX = {
3: ("Iprim", 1.0, "A"),
8: ("NTC1", Temp, "°C"),
9: ("NTC2", Temp, "°C"),
10: ("NTC3", Temp, "°C"),
11: ("Temp", AVR_Temp, "°C"),
12: ("Vcc", 4.0, "V"),
17: ("Bandgap", 1.0, "V"),
18: ("GND", 1.0, "V"),
}
Vcc = 3.3
T0TICK = 0.0925925925925926
T1TICK = T0TICK/4
def read_adcs(self, chs=tuple(range(16)), update_vcc=True):
r = []
for ch in chs:
mux = self.cmd('a', 0, 0x10+ch)
if not mux & 0x40: # REFS0
r.append((ch, mux))
continue
Vref = 2.5 if mux & 0x80 else self.Vcc; # REFS1
a = self.cmd('a', 0, ch)
if not mux & 0x1f in self.ADC_MUX:
r.append((ch, mux, a))
continue
avg = not mux & 0x20
n = self.ADC_MUX[mux & 0x1f]
v = a
if mux & 0x20:
# ADLAR, single conversion
# !ADLAR: exponential average, τ=64 conversions
v &= 0xffc0
if isinstance(n[1], float):
v *= Vref/0x10000 * n[1]
else:
v = n[1](self, v, mux=mux, Vref=Vref)
r.append((ch, mux, a, n[0], v, n[2], Vref))
if (mux & 0xff) == 0xcc:
self.Vcc = v
for rr in r:
try:
ch, mux, a, n, v, u, Vref = rr
except:
continue
print(f"{ch:2d} 0x{mux:04x} 0x{a:04x} {n:7s} {v:6.3f} {u:5s} {'single' if mux & 0x20 else 'avg '} ({Vref:.2f} V)")
return r
def avrdude(self):
print(self.ifc.cmd("v spi_ssel = 0"), file=sys.stderr)
print(self.ifc.cmd("spi/reset"), file=sys.stderr)
try:
print("SPI reset for programming the AVR", file=sys.stderr)
print("Press ^C when done …", end="", file=sys.stderr)
while True:
sys.stderr.flush()
time.sleep(60)
print("", end="", file=sys.stderr)
except KeyboardInterrupt:
pass
print(" done.\n", self.ifc.cmd("spi/reset/ssel"), file=sys.stderr)
print("commit: ", self.id(), file=sys.stderr)
E_reset = {
None: 0,
"assert": 0x2000,
"home": 0x8000,
}
E_what = {
None: 0,
"reset": 0x10000,
"enable": 0x10100,
"led": 0x10200,
"sleep": 0x10300,
}
E_port = bitnames({
"ALL": 0x78,
"RESET": 0x08,
"ENABLE": 0x10,
"LEDON": 0x20,
"SLEEP": 0x40,
"NONE": 0x00,
})
E_mode = {
None: 0,
True: 0x51c00,
False: 0x51d00,
"emit": 0x01000,
"reset": 0x03000,
"init": 0x04000,
"home": 0x08000,
"assert": 0x21800,
"deassert":0x21400,
"enable": 0x51c00,
"disable": 0x51d00,
"ledoff": 0x51e00,
"sleep": 0x51f00,
"!enable": "disable",
"!disable": "enable",
"!ledoff": "disable",
"!sleep": "disable",
}
def enable(self, mode=None, what=None, bits=None, **aa):
"""spi/stepper 'r'"""
a = 0
# eqiv:
# what="reset", bits=("RESET")
# what="reset", RESET=1
# reset=("RESET")
# or any other whatsit
# (In case the port config jumpers were changed)
#
# sleep=True: assert SLEEP (clear bit)
# led=False: deassert LEDON (set bit)
# emit=False: do not change the port bits
# init=True: initialize the stepper
# reset = "assert": assert RESET (clear port bit)
# reset = "home": start stepper with a reset pulse
if len(aa)==1:
k = list(aa.keys())[0]
if mode is None and aa[k] is False:
mode = self.E_mode["!"+k]
aa = None
elif mode is None and aa[k] is True:
mode = k
aa = None
elif what is None:
what = k
aa = aa[k]
if aa is True or aa is False:
aa = None
if aa:
if bits is None:
bits = aa
else:
raise ValueError("too many bits")
if what is None and mode is None:
mode = True
a |= self.E_what[what]
c = 'r'
if bits is not None:
bits = self.E_port.bits(bits)
if a & 0x10000:
c = 'R'
a |= bits & self.E_port.bits("ALL")
else:
raise ValueError("no what")
bits = self.E_port.str(a & 0xff)
if self.E_mode[mode] & a & 0x50f00:
raise ValueError("too many hows")
a |= self.E_mode[mode]
r = self.cmd(c, a & 0xffff)
old = self.E_port.str(r & 0xff)
port = self.E_port.str(r>>8 & self.E_port.bits("ALL"))
return mode, what, bits, old, port
MS = {
1: 0x02,
2: 0x0a,
4: 0x06,
8: 0x0e,
16: 0x04,
32: 0x0c,
-1: 0x00,
-2: 0x08,
}
def ms(self, n=1, ms=None, torque=False):
"""calculate microstepping bits
n: microsteps per step (1|2|4|8|16|32|-1|-2)
n: -1|-2: full torque
torque=True: n=1|2: full torque
"""
if ms is not None:
ms = (ms&1)<<3 | (ms&2)<<1 | (ms&4)>>1
else:
ms = self.MS[-n if torque else n]
return ms
def microstep(self, *a, emit=True, **aa):
"""set microstepping bits
*a, **aa: see: .ms()
"""
c = 'i'
if emit:
c = 'I'
ms = self.ms(*a, **aa)
ms |= (~ms & 0x0e)<<8
return self.cmd(c, ms)
def dir(self, d=None):
"""set/read direction
d = 0|1 (False|True)
higher bits are ignored
"""
if d is None:
return self.cmd('i')
return self.cmd('i', d&1 | (~d&1)<<8)
MIN_SPEED = 21
def speed(self, period=None):
"""set/read stepper cadence
period (int) in T1TICS = 23.148 µs
period (float) in ms
"""
if period is None:
r = self.cmd('q')
return r, r*self.T1TICK
if isinstance(period, float):
period = int(period/self.T1TICK) - 1
if period < self.MIN_SPEED:
period = self.MIN_SPEED
return self.cmd('Q', period)
LIMITS = bitnames(
ALL = ("LEDS", "FAULTS"),
FAULTS = ("FAULT1", "FAULT2"),
FAULT1 = 0x80,
FAULT2 = 0x20,
LEDS = ("LED1", "LED2"),
LED1 = 0x01,
LED2 = 0x02,
NONE = 0x00,
LOCK = (0x100, "ALL")
)
def limit(self, mask=None, val="ALL", **aa):
if isinstance(mask, dict):
aa = mask
if aa:
mask, val = self.LIMITS.mask_val(**aa)
else:
if mask is None:
b = self.cmd('m')
return self.LIMITS.str(b&0xff), self.LIMITS.str(b>>8)
mask = self.LIMITS.bits(mask)
val = self.LIMITS.bits(val)
if mask >= 0x100:
mask = 0
val &= 0xff
else:
val &= mask
return self.cmd('M', mask & 0xff, val)
def step(self, stepper=None, n=0, dir=None, cont=False,
reset=False, ms=None, dac=None, limit=None, speed=None):
if cont:
s = self.cmd('s')
if s:
return self.cmd("012"[stepper], dir)
if limit is not None:
self.limit(limit)
if dac is not None:
self.dac(dac)
if speed is not None:
self.speed(speed)
if ms:
self.microstep(n=ms)
if reset:
self.cmd('r', 0x8000)
if stepper is None:
if dir is not None:
self.dir(dir)
return self.cmd('S', n)
if not n:
return self.cmd('0')
nn = n & ~(n-1)
if n//nn < 0x100:
while not n & 1 and dir < 0xf0:
n >>= 1
dir += 16
return self.cmd("012"[stepper], dir, n)
return self.cmd('S', n)
self.cmd("012"[stepper], dir)

View file

@ -84,14 +84,14 @@ while True:
if port and fd==sock.fileno(): if port and fd==sock.fileno():
s = sock.accept() s = sock.accept()
logger("connection from %s\n" % repr(s[1])) logger("connection from %s\n" % repr(s[1]))
if len(sockets)>=10: try:
logger("too many connections %s\n" % repr(sockets)) sockets[sockets.index(None)] = s
s[0].send(b"too many connections, good bye\n") except ValueError:
s[0].close() if len(sockets)>=10:
else: logger("too many connections %s\n" % repr(sockets))
try: s[0].send(b"too many connections, good bye\n")
sockets[sockets.index(None)] = s s[0].close()
except ValueError: else:
sockets.append(s) sockets.append(s)
while not pipe and files: while not pipe and files:

View file

@ -2,7 +2,7 @@
export SSH_AUTH_SOCK=/home/falbala/stephan/.ssh/nm64/agent export SSH_AUTH_SOCK=/home/falbala/stephan/.ssh/nm64/agent
#rsync -av nm64data:/home/irena/eda/arm/nm64/data/ /data/falbala/nm64/data/kiel/ #rsync -av nm64data:/home/irena/eda/arm/nm64/data/ /data/falbala/nm64/data/kiel/
rsync -av --exclude '/*/' --exclude '*.xz' nm64kiel:/home/nm64kiel/nm64/arm/nm64/data/ /data/falbala/nm64/data/kiel/ rsync -av --exclude '/*/' --exclude '*.xz' nm64kiel:/home/nm64kiel/nm64/solo/eda/arm/nm64/data/ /data/falbala/nm64/data/kiel/
cd /home/falbala/stephan/solo/eda/arm/nm64/ cd /home/falbala/stephan/solo/eda/arm/nm64/
export TZ=UTC export TZ=UTC
ls $(date +'nm64/kiel/nm64_kiel_%Y-%m-%dT*Z.dat' -d -1day) $(date +'nm64/kiel/nm64_kiel_%Y-%m-%dT*Z.dat') | sed 's,.dat$,.nm_raw,' | xargs make 2>&1 ls $(date +'nm64/kiel/nm64_kiel_%Y-%m-%dT*Z.dat' -d -1day) $(date +'nm64/kiel/nm64_kiel_%Y-%m-%dT*Z.dat') | sed 's,.dat$,.nm_raw,' | xargs make 2>&1

View file

@ -8,7 +8,7 @@ def HK():
Vss = hk2mvolt("adc_Vmcsa")*(-0.002) Vss = hk2mvolt("adc_Vmcsa")*(-0.002)
Icc = hk2mvolt("adc_Ipcsa")*0.1 Icc = hk2mvolt("adc_Ipcsa")*0.1
Iss = hk2mvolt("adc_Imcsa")*(-0.1) Iss = hk2mvolt("adc_Imcsa")*(-0.1)
Vprim = hk2mvolt("adc_Vprim")*(0.011) Vprim = hk2mvolt("adc_Vprim")*(0.0163)
Vbias = hk2mvolt("adc_Vbias")*(-0.05) Vbias = hk2mvolt("adc_Vbias")*(-0.05)
Ibias = hk2mvolt("adc_Ibias")*0.0955 Ibias = hk2mvolt("adc_Ibias")*0.0955
Ibiasp = hk2mvolt("adc_dac")*0.0955 Ibiasp = hk2mvolt("adc_dac")*0.0955
@ -20,7 +20,7 @@ def HK():
return Vcc, Vss, Icc, Iss, Vprim, Vbias, Ibias, Ibiasp, Tntc7, Tntc8 return Vcc, Vss, Icc, Iss, Vprim, Vbias, Ibias, Ibiasp, Tntc7, Tntc8
def findnmahepam(): def findnmahepam():
findxrena(prod=(0xee0c,)) findxrena(prod=(0xee0c,0xee0a))
if connected_p(): if connected_p():
set_clock() set_clock()
messages() messages()
@ -52,33 +52,47 @@ def AHBGOa():
SSDe = SSDb SSDe = SSDb
default_config() default_config()
atriggers(1,TBITS(BGO)) atriggers(1,TBITS(BGO))
for c in SSDa+SSDb+SSDc: thres(1,c,8) for c in SSDa+SSDb+SSDc: thres(1,c,5)
for c in BGO: thres(1,c,8) for c in BGO: thres(1,c,5)
for c in SSDd+SSDe: thres(0,c,8) for c in SSDd+SSDe: thres(0,c,5)
def aenable(sl=None, hk=True, ev=True, **aa): def aenable(sl=None, hk=True, ev=True, what=None, **aa):
cmd("s/cron 'CRON.RC'") cmd("s/cron 'CRON.RC'")
fifo_enable(sl=sl, hk=hk, ev=ev, **aa) fifo_enable(sl=sl, hk=hk, ev=ev, **aa)
enable() enable(what=what)
def adisable(): def adisable():
cmd("s/cron/none") cmd("s/cron/none")
disable() disable()
Keep_alive = armlib.Keep_Alive_Schedule(
cmd="e/in"
" '%u.%u mbar %d.%d °C F=%u',"
" pre/10, pre%10,"
" (te-2731)/10, (te-2731)%10,"
" F"
)
if __name__=="__main__": if __name__=="__main__":
ifc,_oo = armlib.init_irena(scope = globals(), name = "AHEPAM", prod = (0xee0c,), ifc,_oo = armlib.init_irena(scope = globals(), name = "AHEPAM", prod = (0xee0c,0xee0a),
long_options=["seth", "ahbgo"]) long_options=["seth", "ahbgo", "leia"])
if ifc.is_a("USB"):
findnmahepam()
for o,v in _oo[0]: for o,v in _oo[0]:
if o=="--seth": if o=="--seth":
dorn.CONFIG.seth() dorn.CONFIG.seth()
armlib.set_prompt("SETH") armlib.set_prompt("SETH")
ifc._stream_control=0x000a
if o=="--ahbgo": if o=="--ahbgo":
dorn.CONFIG.ahbgo() dorn.CONFIG.ahbgo()
armlib.set_prompt("AHBGO") armlib.set_prompt("AHBGO")
if o=="--leia":
dorn.CONFIG.leia()
armlib.set_prompt("LEIA")
import leia_stepper
st = leia_stepper.leia_stepper(ifc)
ifc._stream_fifos = 'hk1/f1/f2/f3' ifc._stream_fifos = 'hk1/f1/f2/f3'
if ifc.is_a("USB"):
findnmahepam()
from dorn import * from dorn import *
dorn._connect(ifc) dorn._connect(ifc)
ifc._stream_reset |= 0x000c ifc._stream_reset |= 0x000c

0
pressure.awk Normal file → Executable file
View file

View file

@ -83,13 +83,13 @@ int script_execute_fd(int fd, struct command *cmd)
unsigned int locals[36]; unsigned int locals[36];
unsigned int labels[NLABELS]; unsigned int labels[NLABELS];
memset(labels, 0, sizeof(labels)); memset(labels, 0, sizeof(labels));
unsigned int *old_locals = local_variables;
if (local_variables) if (local_variables)
memcpy(locals, local_variables, sizeof(locals)); memcpy(locals, local_variables, sizeof(locals));
else else
memset(locals, 0, sizeof(locals)); memset(locals, 0, sizeof(locals));
if (cmd && cmd->cmd && *cmd->cmd && cmd->csize) if (cmd && cmd->cmd && *cmd->cmd && cmd->csize)
parse_parameters(cmd, locals); parse_parameters(cmd, locals);
unsigned int *old_locals = local_variables;
while ((n=file_gets(fd, scmd_buf, sizeof(scmd_buf)))) { while ((n=file_gets(fd, scmd_buf, sizeof(scmd_buf)))) {
char sres[MSG_SIZE]; char sres[MSG_SIZE];
local_variables = locals; local_variables = locals;

3
ssp.c
View file

@ -29,6 +29,7 @@ unsigned int ssp_dma_size;
unsigned int ssp_min_size = 1; unsigned int ssp_min_size = 1;
unsigned int ssp_block_idle = 256; unsigned int ssp_block_idle = 256;
unsigned int ssp_block_size = 3; unsigned int ssp_block_size = 3;
unsigned int ssp_nobuffer_count;
unsigned int ssp_get_status(void) unsigned int ssp_get_status(void)
{ {
@ -139,6 +140,8 @@ static void ssp_isr(void)
// Try again. // Try again.
if (!j->buf_count) { if (!j->buf_count) {
if (get_new_buffer(j->buf_start)) { if (get_new_buffer(j->buf_start)) {
SSPIMSC = 0;
ssp_nobuffer_count++;
VICVectAddr = 0; VICVectAddr = 0;
return; return;
} }

1
ssp.h
View file

@ -21,6 +21,7 @@ extern unsigned int ssp_lastword;
extern unsigned int ssp_dma_size; extern unsigned int ssp_dma_size;
extern unsigned int ssp_block_idle; extern unsigned int ssp_block_idle;
extern unsigned int ssp_block_size; extern unsigned int ssp_block_size;
extern unsigned int ssp_nobuffer_count;
enum ssp_flags { enum ssp_flags {
ssp_compress = 1, ssp_compress = 1,

View file

@ -13,6 +13,8 @@ arena._connect(ifc)
if ifc.is_a("USB"): if ifc.is_a("USB"):
findarena() findarena()
lasc.lasc_init(ifc)
def enable(what="usb/f3/hk"): def enable(what="usb/f3/hk"):
Cmd("altera/fifo/set 8") Cmd("altera/fifo/set 8")
Cmd("altera/fifo/reset 0x080") Cmd("altera/fifo/reset 0x080")
@ -128,29 +130,29 @@ lasc.LA.update({a: 1<<i for i,a in enumerate(LAch)})
def IPLOT(lasc=None): def IPLOT(lasc=None):
if not lasc: if not lasc:
lasc = (LAread(),) lasc = (lasc.LAread(),)
LASCplot(*lasc, what=LAch) lasc.LASCplot(*lasc, what=LAch)
LAdata=None LAdata=None
def taLAsingle(trig="RD"): def taLAsingle(trig="RD"):
if trig[0]=='~' or trig[0]=='!': if trig[0]=='~' or trig[0]=='!':
LASCsingle(trig[1:], edge=False) lasc.LASCsingle(trig[1:], edge=False)
else: else:
LASCsingle(trig) lasc.LASCsingle(trig)
def taLAread(): def taLAread():
global LAdata global LAdata
LAdata = LAread() LAdata = lasc.LAread()
return LAdata return LAdata
def taLAplot(d=None, what=LAch): def taLAplot(d=None, what=LAch):
if not d: if not d:
d = LAdata d = LAdata
LASCplot(d, None, what=what) lasc.LASCplot(d, None, what=what)
def taLAprint(fn="la.ps", what=LAch): def taLAprint(fn="la.ps", what=LAch):
LASCplot(LAdata, None, what=what, term=""" lasc.LASCplot(LAdata, None, what=what, term="""
set term post enhanced solid color set term post enhanced solid color
set out "%s" set out "%s"
""" % fn) """ % fn)

2
udp.c
View file

@ -161,6 +161,8 @@ int udp_write_stream(void *buf)
return 0; return 0;
case 1: case 1:
break; break;
case 3:
return 1;
default: default:
if (udp_stream_reset if (udp_stream_reset
&& dropped_tick && dropped_tick

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,7 +214,11 @@ 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)