forked from Stephan/irena-arm
Compare commits
79 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
52208e6161 | ||
|
|
87fc412d1b | ||
|
|
f908aa31d7 | ||
|
|
2debb5d65a | ||
|
|
4269bba81a | ||
|
|
a8d2f4c797 | ||
|
|
f7af6fb900 | ||
|
|
70cefb78d3 | ||
|
|
8539542690 | ||
|
|
bb8884d2ca | ||
|
|
57e99bf199 | ||
|
|
8ed1b837f0 | ||
|
|
4269bd8293 | ||
|
|
c5a8f7fef2 | ||
|
|
10f2815e5d | ||
|
|
dd879c5433 | ||
|
|
9aee6531e0 | ||
|
|
1310ad3e53 | ||
|
|
0c8591a6ef | ||
|
|
8220f10bcb | ||
|
|
122a9fb802 | ||
|
|
d5e4d19165 | ||
|
|
26d700bbad | ||
|
|
4c6bb8cb79 | ||
|
|
85b210b9e8 | ||
|
|
c18624c745 | ||
|
|
6269048394 | ||
|
|
934fecf35b | ||
|
|
36c011d26e | ||
|
|
cfa4107659 | ||
|
|
53c8767dea | ||
|
|
3e53d6695e | ||
|
|
2ae7187eeb | ||
|
|
98936fcad7 | ||
|
|
ee585c187e | ||
|
|
45f240f99c | ||
|
|
69831cac23 | ||
|
|
2513757ba3 | ||
|
|
0c4b6629f2 | ||
|
|
287e7b1aba | ||
|
|
c5a625e61f | ||
|
|
881609eca0 | ||
|
|
22adf761cb | ||
|
|
24f95cd5a7 | ||
|
|
783d82b83e | ||
|
|
7881b72b1b | ||
|
|
a22c05dc82 | ||
|
|
c69b231ddd | ||
|
|
8ff9eccb55 | ||
|
|
785f560e46 | ||
|
|
f077df1366 | ||
|
|
831342b7e6 | ||
|
|
de178db0a1 | ||
|
|
eb2c92e0e9 | ||
|
|
ac271696f5 | ||
|
|
7678ba7845 | ||
|
|
7258def910 | ||
|
|
b71770f57c | ||
|
|
d087cb4254 | ||
|
|
6e411b523b | ||
|
|
a4451ae8a8 | ||
|
|
022845e44a | ||
|
|
2d6507d126 | ||
|
|
f1ad213b11 | ||
|
|
2de6cb8de7 | ||
|
|
493e41a593 | ||
|
|
e940df4a7f | ||
|
|
bbceab82a7 | ||
|
|
9a125cd357 | ||
|
|
c2b723e3f6 | ||
|
|
f04b5ef9c5 | ||
|
|
e522a09084 | ||
|
|
7c4f82d462 | ||
|
|
30f6446a06 | ||
|
|
90edb57ac2 | ||
|
|
ac2b77791b | ||
|
|
0f32d27cb9 | ||
|
|
072a93c0e4 | ||
| 2db14b65ad |
58 changed files with 1686 additions and 483 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -19,3 +19,5 @@ nm64file
|
|||
mustang_scripts
|
||||
nm64/nm64
|
||||
ahepam/seth
|
||||
leia/
|
||||
irena/d3direna/
|
||||
|
|
|
|||
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
[submodule "avr"]
|
||||
path = avr
|
||||
url = ../irena-avr.git
|
||||
4
Makefile
4
Makefile
|
|
@ -76,6 +76,8 @@ ProductId-NMAHEPAM = 0x0c
|
|||
SerialNo-NMAHEPAM = 14
|
||||
ProductId-SETH = 0x0c
|
||||
SerialNo-SETH = 15
|
||||
ProductId-LEIA = 0x0c
|
||||
SerialNo-LEIA = 16
|
||||
|
||||
#sirena:
|
||||
ProductId-Torsten = 0x04
|
||||
|
|
@ -228,8 +230,10 @@ FATNAME_flash_TANOS=TANOS
|
|||
FATNAME_flash_CHAOS=CHAOS
|
||||
FATNAME_flash_µM=IRENAuM
|
||||
FATNAME_flash_NMAHEPAM=NMAHEPAM
|
||||
FATNAME_flash_LEIA=LEIA
|
||||
FATNAME=$(FATNAME_$(FLASH))
|
||||
|
||||
FATSIZE_flash_tarena=1M
|
||||
FATSIZE_flash_pirena=1M
|
||||
FATSIZE_flash_darena=1M
|
||||
FATSIZE_flash_erena=1M
|
||||
|
|
|
|||
|
|
@ -160,6 +160,7 @@ int main(int argc, const char * const * argv)
|
|||
n_counters = 25;
|
||||
if (!nl2)
|
||||
switch (nch) {
|
||||
case 9:
|
||||
case 18: nl2=6; break;
|
||||
default: nl2=8; break;
|
||||
}
|
||||
|
|
|
|||
60
ahepam/2025-07-24-seth-9-fit.gpt
Normal file
60
ahepam/2025-07-24-seth-9-fit.gpt
Normal 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
|
||||
}
|
||||
468
ahepam/2025-07-24-seth-9.fitlog
Normal file
468
ahepam/2025-07-24-seth-9.fitlog
Normal 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
|
||||
|
|
@ -1,5 +1,10 @@
|
|||
#!/usr/bin/gawk -i
|
||||
|
||||
@include "../pressure.awk"
|
||||
|
||||
/^EDB /{skip_ED++}
|
||||
skip_ED && /^ED / {next}
|
||||
|
||||
function isE(d,c) {
|
||||
if (!/^EDB?/ || $3!=d || $4!=c) return 0
|
||||
Ch = NDCh * d + c
|
||||
|
|
@ -30,10 +35,20 @@ function isEE() {
|
|||
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() {
|
||||
N = 0
|
||||
if (!/^EDB? /) return 0
|
||||
if (NE && ($2 > T0+20 || $2+20 < T0)) {
|
||||
if (NE && ($2 > T0+7 || $2+7 < T0)) {
|
||||
N = NE
|
||||
TE0 = T0
|
||||
save = $0
|
||||
|
|
@ -60,10 +75,7 @@ function isCC() {
|
|||
i = NDCh * $3 + $4
|
||||
ELINES[i] = $0
|
||||
NE++
|
||||
if (N) {
|
||||
if (TE0 < 0x40000000 && TLAST > 0xc0000000) EPOCH += 0x100000000
|
||||
TLAST = TE0
|
||||
}
|
||||
if (N) doEPOCH(TE0)
|
||||
return N
|
||||
}
|
||||
|
||||
|
|
@ -97,8 +109,10 @@ BEGIN {
|
|||
}
|
||||
|
||||
function isSETH() {
|
||||
if (/^H /) Time=$2
|
||||
tBGO=10
|
||||
if (!isCC()) return
|
||||
if (!Time) return
|
||||
EBGO0 = 0
|
||||
EBGO1 = 0
|
||||
EHETB = EE[11]
|
||||
|
|
@ -115,6 +129,8 @@ function isSETH() {
|
|||
}
|
||||
ETRIG0 = 0
|
||||
ETRIG1 = 0
|
||||
iTRIG0 = -1
|
||||
iTRIG1 = 48
|
||||
for (i in cTRIG) {
|
||||
if (EE[i] > ETRIG0) {
|
||||
ETRIG0 = EE[i]
|
||||
|
|
@ -129,18 +145,15 @@ function isSETH() {
|
|||
}
|
||||
|
||||
function doSETH() {
|
||||
printf "%.0f %g %g %g %g %d %g %d %g\n", TE0+EPOCH, \
|
||||
EBGO0, EBGO1, EHETB, EHETA, \
|
||||
iTRIG0, ETRIG0, iTRIG1, ETRIG1
|
||||
for (i in cBGO) printf " %g", EE[i]
|
||||
for (i in cBGO) printf " %g", EE[i+24]
|
||||
printf "\n"
|
||||
printf "%.0f %d %d %g %g %g %g %g %g\n", TE0+EPOCH, \
|
||||
iTRIG0, iTRIG1, ETRIG0, ETRIG1, \
|
||||
EHETB, EHETA, EBGO0, EBGO1
|
||||
}
|
||||
|
||||
function doSETHBGO() {
|
||||
printf "%.0f %g %g %g %g %d %g %d %g", TE0+EPOCH, \
|
||||
EBGO0, EBGO1, EHETB, EHETA, \
|
||||
iTRIG0, ETRIG0, iTRIG1, ETRIG1
|
||||
printf "%u %.0f %d %d %g %g %g %g %g %g", Time, TE0+EPOCH, \
|
||||
iTRIG0, iTRIG1, ETRIG0, ETRIG1, \
|
||||
EHETB, EHETA, EBGO0, EBGO1
|
||||
for (i in cBGO) printf " %g", EE[i]
|
||||
for (i in cBGO) printf " %g", EE[i+24]
|
||||
printf "\n"
|
||||
|
|
@ -292,7 +305,7 @@ function doS() {
|
|||
for (i in SLINES[d]) {
|
||||
$0 = SLINES[d][i]
|
||||
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++
|
||||
}
|
||||
|
|
@ -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 {
|
||||
NDCh = 24
|
||||
NCh = 48
|
||||
|
|
@ -360,15 +409,16 @@ BEGIN {
|
|||
}
|
||||
|
||||
function print_HIST(fn) {
|
||||
if (!NHCh) NHCh = NCh
|
||||
printf "mV" > fn
|
||||
for (i=0; i<NCh; i++) {
|
||||
for (i=0; i<NHCh; i++) {
|
||||
printf " %s", name[i] > fn
|
||||
}
|
||||
print "" > fn
|
||||
nx = int((maxV-minV)/resV)+1;
|
||||
for (xx=0; xx<nx; xx++) {
|
||||
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
|
||||
}
|
||||
print "" > fn
|
||||
|
|
@ -439,6 +489,12 @@ BEGIN {
|
|||
B3[d,c] = 12898 / 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) {
|
||||
|
|
|
|||
|
|
@ -4,10 +4,19 @@ include ../irena/libirena.make
|
|||
.PRECIOUS: %.dat %.AHA
|
||||
|
||||
%.AHA: %.dat ahepamfile
|
||||
./ahepamfile < $< > $@
|
||||
./ahepamfile $(CAT_BANANA) < $< > $@
|
||||
|
||||
%.Itime: %.AHA
|
||||
../irena/Itime.awk $< > $@
|
||||
|
||||
ifneq ($(BANANA),)
|
||||
CAT_BANANA := `cat $(BANANA)`
|
||||
endif
|
||||
|
||||
doScut=100
|
||||
|
||||
%.doS: %.AHA
|
||||
./AHEPAM.awk 'doS(){}' $< > $@
|
||||
./AHEPAM.awk 'doS(){}' doScut=$(doScut) $< > $@
|
||||
|
||||
%.AES: %.dat ahepamfile
|
||||
./ahepamfile < $< | grep '^[ES]' | grep -v 'X' | sort -nk2,2 -k1 > $@
|
||||
|
|
@ -25,6 +34,11 @@ include ../irena/libirena.make
|
|||
%.HDORN: %.AHA HDORN.awk
|
||||
./HDORN.awk 'isHDORN(){doHDORN()}' $< > $@
|
||||
|
||||
HDINST=--seth
|
||||
HDTYPE=cooked
|
||||
%.HD: %.AHA
|
||||
../dorn_hk.py $(HDINST) --what=$(HDTYPE) $< | tr -d '[],' > $@
|
||||
|
||||
SIGMA=600
|
||||
|
||||
%.HD4BIAS: %.HDORN
|
||||
|
|
@ -41,6 +55,9 @@ EE=E
|
|||
%.SETH: %.AHA
|
||||
./AHEPAM.awk 'isSETH(){doSETHBGO()}' $< > $@
|
||||
|
||||
%.seth_hist: %.AHA
|
||||
./AHEPAM.awk 'isSETH(){doSETHhist()}' $< > $@
|
||||
|
||||
CUT=P
|
||||
CUT_P=&&P>-0.398&&P<=-0.105
|
||||
CUT_nP=&&(P<=-0.398||P>-0.105)
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
if (ARG1 ne "") {
|
||||
Emin = "1100"
|
||||
Emax = "1300"
|
||||
Pmin = "-0.5"
|
||||
Pmax = "0.05"
|
||||
Emax = "1500"
|
||||
Pmin = "-0.6"
|
||||
Pmax = "0.1"
|
||||
fn = ARG1
|
||||
prefix = "seth/"
|
||||
suffix = ".ED"
|
||||
|
|
@ -25,6 +25,8 @@ a0 = 1200
|
|||
set fit errorvar results logfile bfn.".log"
|
||||
ptime = 0
|
||||
|
||||
set samples 10000
|
||||
set xra [Pmin:Pmax]
|
||||
set style data dot
|
||||
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
|
||||
|
|
|
|||
|
|
@ -1 +1,2 @@
|
|||
--banana=-1,-3686,16027,12898,24618
|
||||
--banana=4,-4404,10830,-23912,45271
|
||||
|
|
|
|||
1
altera.c
1
altera.c
|
|
@ -1048,6 +1048,7 @@ const struct keywords altera_variable_names[] = {
|
|||
{"ssp_block_size", {.par=&ssp_block_size}},
|
||||
{"ssp_write_ptr", {.par=&ssp_injection_write_ptr}},
|
||||
{"ssp_read_ptr", {.par=&ssp_injection_read_ptr}},
|
||||
{"ssp_nobuffer_count",{.par=&ssp_nobuffer_count}},
|
||||
{"alterastatus", {.par=&alterastatus}},
|
||||
{"altera2status", {.par=&altera2status}},
|
||||
{"psconfig2", {.par=&psconfig2}},
|
||||
|
|
|
|||
45
armlib.py
45
armlib.py
|
|
@ -198,6 +198,13 @@ class irena_ifc(object):
|
|||
def Flush(self):
|
||||
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):
|
||||
if self._data:
|
||||
return self._data.Status(verbose)
|
||||
|
|
@ -601,6 +608,44 @@ class irena_ifc(object):
|
|||
except EOFError:
|
||||
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=[]):
|
||||
global _ifc, _ifc_uart, _opt
|
||||
_ifc = None
|
||||
|
|
|
|||
1
avr
Submodule
1
avr
Submodule
|
|
@ -0,0 +1 @@
|
|||
Subproject commit a7e45f235d59d5f8d815bf7daf9734e9ee0f2a2c
|
||||
|
|
@ -46,6 +46,7 @@ tek.verbosity = verbosity
|
|||
while fmin + fres < fmax:
|
||||
f = (fmin + fmax)/2
|
||||
pulser.cmd(f"FREQ {f:.1f}")
|
||||
tek.cmd("ACQ:NUMAVG 1")
|
||||
tek.cmd("ACQ:NUMAVG 512")
|
||||
t = time.time() + t_settle
|
||||
phi = tek.cmd(f":MEASU:MEAS{i_phi}:VAL?")[1]
|
||||
|
|
|
|||
105
dorn.py
105
dorn.py
|
|
@ -20,7 +20,7 @@ def HK_fmt(s, i, n, d):
|
|||
|
||||
def HK3_fmt(s, i, n, d):
|
||||
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,
|
||||
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}
|
||||
na = {repr(d[:4])}
|
||||
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.
|
||||
"""
|
||||
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:
|
||||
# stis_ana_core 2×24 ch
|
||||
|
|
@ -154,11 +169,12 @@ class DORN_CONFIG:
|
|||
# ! change the class attribute .HK
|
||||
self.HK[4] = ("HK PA", self.HK4_SETH, HK4_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 = [[
|
||||
("Tbgo₁", (degC, {})),
|
||||
("Tbgo₂", (degC, {})),
|
||||
("Vbias", -1/0.047),
|
||||
("Vbias1", -1/0.047),
|
||||
("Tbgo₃", (degC, {})),
|
||||
("Ibias₁", 10470/470 * 51/1051 * 100),
|
||||
("Ibias₂", 10470/470 * 51/1051 * 100),
|
||||
|
|
@ -170,9 +186,56 @@ class DORN_CONFIG:
|
|||
# ! change the class attribute .HK
|
||||
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()
|
||||
|
||||
def hk(sl, what="print", data=None):
|
||||
def hk(sl=0, what="print", data=None):
|
||||
if not data:
|
||||
ecmd("alt/stream/off")
|
||||
_ifc.menable()
|
||||
|
|
@ -187,25 +250,26 @@ def hk(sl, what="print", data=None):
|
|||
if isinstance(data, str):
|
||||
# HDORN … data line
|
||||
if "x" in data:
|
||||
return
|
||||
return sl, None
|
||||
data = data.split()
|
||||
if data[0] != "HDORN":
|
||||
return
|
||||
return sl, None
|
||||
data = list(map(int, data[1:]))
|
||||
if sl is None:
|
||||
sl = data[0] & 3;
|
||||
if data[0] & 3 != sl:
|
||||
return None
|
||||
return sl, None
|
||||
if what=="data":
|
||||
return data
|
||||
return sl, data
|
||||
ND = CONFIG.n_adc()
|
||||
NV = ND
|
||||
data = [d & 0xfff for d in data]
|
||||
data = [data[ND*i+1:ND*i+1+NV] for i in range(8)]
|
||||
if what=="raw":
|
||||
return data
|
||||
return sl, data
|
||||
Vref = CONFIG.Vref(sl)/4096
|
||||
ddata = []
|
||||
VV = {"Vref": CONFIG.Vref(sl)}
|
||||
for a in range(8):
|
||||
V = {}
|
||||
ddata.append(V)
|
||||
|
|
@ -227,19 +291,20 @@ def hk(sl, what="print", data=None):
|
|||
else:
|
||||
data[a][c] *= Vref*H[1]
|
||||
V[H[0]] = data[a][c]
|
||||
VV.update(V)
|
||||
for c in range(8):
|
||||
H = HK[c]
|
||||
if len(H) > 2:
|
||||
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:
|
||||
data[a][c] += H[2]
|
||||
V[H[0]] = data[a][c]
|
||||
|
||||
if what=="cooked":
|
||||
return data
|
||||
return sl, data
|
||||
if what=="dict":
|
||||
return ddata
|
||||
return sl, ddata
|
||||
|
||||
r = []
|
||||
for a in range(8):
|
||||
|
|
@ -249,7 +314,7 @@ def hk(sl, what="print", data=None):
|
|||
|
||||
if what=="print":
|
||||
sys.stderr.write("".join(r))
|
||||
return r
|
||||
return sl, r
|
||||
|
||||
def dorn_config(a, v=None, mes=None, slice=0):
|
||||
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
|
||||
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:
|
||||
return dorn_config(0x00b, slice=sl)
|
||||
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")
|
||||
dh = h
|
||||
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)
|
||||
|
|
|
|||
18
dorn_hk.py
18
dorn_hk.py
|
|
@ -6,7 +6,7 @@ import sys, getopt
|
|||
oo,ff = getopt.getopt(sys.argv[1:], "saw:n:c:",
|
||||
["seth", "ahbgo", "what=", "slice=", "channels="])
|
||||
|
||||
what="print"
|
||||
what="pretty"
|
||||
sl = None
|
||||
ch = list(range(8))
|
||||
|
||||
|
|
@ -22,17 +22,23 @@ for o,v in oo:
|
|||
if o=="-c" or o=="--channels":
|
||||
ch = list(map(int, v.split(",")))
|
||||
|
||||
T = 0
|
||||
for fn in ff:
|
||||
with open(fn) as f:
|
||||
def hk_file(f):
|
||||
T = 0
|
||||
for l in f:
|
||||
if l[:2] == "H ":
|
||||
T = int(l.split()[1])
|
||||
continue
|
||||
if not T:
|
||||
continue
|
||||
h = dorn.hk(sl, what=what, data=l)
|
||||
s, h = dorn.hk(sl, what=what, data=l)
|
||||
if not h:
|
||||
continue
|
||||
for c in ch:
|
||||
print(T, c, h[c])
|
||||
print(T, s, 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
2
flash_IRENA/CRONGD4.RC
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
@s/if !ssp_dma: s/exit
|
||||
@nm/count/clear/float
|
||||
8
flash_LEIA/CRON.RC
Normal file
8
flash_LEIA/CRON.RC
Normal 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
12
flash_LEIA/DORN.RC
Normal 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
30
flash_LEIA/DORNCC.RC
Normal 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
10
flash_LEIA/INIT.RC
Normal 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
BIN
flash_LEIA/NMLEIAV1.RBF
Normal file
Binary file not shown.
BIN
flash_LEIA/NMLEIAV2.RBF
Normal file
BIN
flash_LEIA/NMLEIAV2.RBF
Normal file
Binary file not shown.
7
flash_LEIA/README.TXT
Normal file
7
flash_LEIA/README.TXT
Normal 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
2
flash_LEIA/SN16.RC
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
@v bate_hash = 0x29ef
|
||||
pres/read/verify
|
||||
2
flash_LEIA/SN2.RC
Normal file
2
flash_LEIA/SN2.RC
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
@v bate_hash = 0x3921
|
||||
pres/read/verify
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
@s/if S&1: i2c/run; s/exit
|
||||
@s/if S&2: pres/inj; 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_write_size: s/exe "MICROSD.RC"
|
||||
@s/if ! udp_rx_cmd: var udp_size=0
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
@s/if pres<8000 or pres>11000 or temp > 3432 or temp < 2432: s/exit
|
||||
s/exec "SAFE.RC" 3
|
||||
@e not reached, spy file is closed
|
||||
@e not reached after three hits
|
||||
|
|
|
|||
|
|
@ -1,29 +1,17 @@
|
|||
@v/cache iter
|
||||
@s/for 24: s/exe 'DORNCC.RC' 0, i
|
||||
@s/exe 'DORNCC.RC' 1, 0, 0x0f385
|
||||
@s/exe 'DORNCC.RC' 1, 1, 0x0f75d
|
||||
@s/exe 'DORNCC.RC' 1, 2, 0x0f13b
|
||||
@s/exe 'DORNCC.RC' 1, 3, 0x0f635
|
||||
@s/exe 'DORNCC.RC' 1, 4, 0x0f914
|
||||
@s/exe 'DORNCC.RC' 1, 5, 0x0f248
|
||||
@s/exe 'DORNCC.RC' 1, 6, 0x10000
|
||||
@s/exe 'DORNCC.RC' 1, 7, 0x0fd86
|
||||
@s/exe 'DORNCC.RC' 1, 8, 0x0eb56
|
||||
@s/exe 'DORNCC.RC' 1, 9, 0x0f4af
|
||||
@s/exe 'DORNCC.RC' 1, 10, 0x0f984
|
||||
@s/exe 'DORNCC.RC' 1, 11, 0x0fe83
|
||||
@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
|
||||
@s/for 24: s/exe 'DORNCC.RC' 0, i, 0x10000
|
||||
@s/for 24: s/exe 'DORNCC.RC' 1, i, 0x10000
|
||||
@s/exe 'DORNCC.RC' 0, 3, 0x0ea90
|
||||
@s/exe 'DORNCC.RC' 0, 12, 0x0e451
|
||||
@s/exe 'DORNCC.RC' 0, 20, 0x0dbe5
|
||||
@s/exe 'DORNCC.RC' 1, 3, 0x0f72d
|
||||
@s/exe 'DORNCC.RC' 1, 12, 0x10000
|
||||
@s/exe 'DORNCC.RC' 1, 20, 0x0ed2b
|
||||
@s/exe 'DORNCC.RC' 0, 4, 0xe38e
|
||||
@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 0xdb3
|
||||
@s/for 2: dorn/enable[i]/samples/inj 0
|
||||
@v $T = 0x101808
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@
|
|||
@v $A[6] = -1082
|
||||
@v $A[7] = -1888
|
||||
@v $X = 0
|
||||
@s/for 7: v $Y=$A[7-i]*$3/0x10000; v $X=$X-$Y; dorn/b [$1,$2,7-i] $Y
|
||||
@dorn/b [$1,$2,0] $X
|
||||
@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
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
eth/source/ip 172.16.18.112
|
||||
eth/source/ip 172.16.18.121
|
||||
echo eth config SETH
|
||||
@eth/dest/str/mac/ip/port 3c:97:0e:ce:30:48 172.16.18.110 1112
|
||||
@eth/dest/mes/mac/ip/port 3c:97:0e:ce:30:48 172.16.18.110 1113
|
||||
@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.120 1113
|
||||
@eth/init/full
|
||||
@s/if errno>=500: s/exit
|
||||
@var/set eth_verbosity = 4
|
||||
|
|
|
|||
|
|
@ -3,8 +3,12 @@
|
|||
@var/set script_cron_prio = 3
|
||||
sd/init
|
||||
@var/set dac=0
|
||||
@s/exec "ETH.RC"
|
||||
@s/if product!=0xee0c: s/exit
|
||||
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
|
||||
@e/eval "s/exe 'SN%d.RC'", serial
|
||||
@s/exe "DORN.RC"
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
@alt/stream/off
|
||||
@s/exe "PRESSURE.RC"
|
||||
var/set spi_min_qtime = 665
|
||||
@var/set udp_reset = 1000000
|
||||
var spi_min_qtime = 665
|
||||
@var udp_reset = 1000000
|
||||
@al/fifo/clear 1
|
||||
@al/fifo/set 10
|
||||
@al/fifo/reset 0x1f0
|
||||
@var/set sd_write_size = 0
|
||||
@v/set sd_write_count = 0
|
||||
@v/set udp_count = 0
|
||||
@v/set udp_size = 0
|
||||
@V W=600
|
||||
@v/set R=-1
|
||||
@var sd_write_size = 0
|
||||
@var sd_write_count = 0
|
||||
@var udp_count = 0
|
||||
@var udp_size = 0
|
||||
@var W=600
|
||||
@var R=-1
|
||||
@script/cron/none
|
||||
@var/cache ssp_dma spy_return second time hk_count hk_mes
|
||||
@var/cache sd_status udp_rx_cmd udp_size enc altera
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
@var/cache pressure temp
|
||||
@var F=4
|
||||
@pres/read/verify
|
||||
pres/read/verify
|
||||
@s/if errno >= 500: s/exit
|
||||
@pressure/spy/on
|
||||
script/spy "ASCENT.SPY"
|
||||
s/spy "ASCENT.SPY"
|
||||
@var F=1
|
||||
@var N=0
|
||||
@var script_cron_prio=3
|
||||
|
|
|
|||
|
|
@ -4,3 +4,10 @@
|
|||
pres/read/verify
|
||||
@s/if errno >= 500: s/exit
|
||||
@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
|
||||
|
|
|
|||
|
|
@ -2,3 +2,4 @@
|
|||
eth/init/full
|
||||
@s/if enc == 0xb: eth/rx/en
|
||||
@s/if enc == 0xf: var/set udp_size=R
|
||||
@v spi_min_q = 665
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
@pressure/inject
|
||||
@s/if sd_status & 0xc00: sd/init
|
||||
@clock/short
|
||||
@s/if !(sec % M): nm/cou/clear/short
|
||||
|
|
|
|||
|
|
@ -21,25 +21,25 @@ irena/nsamples 0 0x3f
|
|||
irena/adcmask 0x02664
|
||||
irena/windows 2 5 8
|
||||
echo Thresholds 100*mV high gain
|
||||
@var/set V=14000
|
||||
@irena/l1t 0 1000*V 0x000
|
||||
@irena/l1t 1 100*V 0x000
|
||||
@irena/l1t 2 100*V 0x001
|
||||
@irena/l1t 3 1000*V 0x000
|
||||
@irena/l1t 4 1000*V 0x000
|
||||
@irena/l1t 5 100*V 0x001
|
||||
@irena/l1t 6 100*V 0x001
|
||||
@irena/l1t 7 1000*V 0x000
|
||||
@irena/l1t 8 1000*V 0x000
|
||||
@irena/l1t 9 100*V 0x001
|
||||
@irena/l1t 10 100*V 0x001
|
||||
@irena/l1t 11 1000*V 0x000
|
||||
@irena/l1t 12 1000*V 0x000
|
||||
@irena/l1t 13 100*V 0x001
|
||||
@irena/l1t 14 100*V 0x000
|
||||
@irena/l1t 15 1000*V 0x000
|
||||
@irena/l1t 16 1000*V 0x000
|
||||
@irena/l1t 17 100*V 0x000
|
||||
@var/set mV=14000
|
||||
@irena/l1t 0 1000*mV 0x000
|
||||
@irena/l1t 1 100*mV 0x000
|
||||
@irena/l1t 2 100*mV 0x001
|
||||
@irena/l1t 3 1000*mV 0x000
|
||||
@irena/l1t 4 1000*mV 0x000
|
||||
@irena/l1t 5 100*mV 0x001
|
||||
@irena/l1t 6 100*mV 0x001
|
||||
@irena/l1t 7 1000*mV 0x000
|
||||
@irena/l1t 8 1000*mV 0x000
|
||||
@irena/l1t 9 100*mV 0x001
|
||||
@irena/l1t 10 100*mV 0x001
|
||||
@irena/l1t 11 1000*mV 0x000
|
||||
@irena/l1t 12 1000*mV 0x000
|
||||
@irena/l1t 13 100*mV 0x001
|
||||
@irena/l1t 14 100*mV 0x000
|
||||
@irena/l1t 15 1000*mV 0x000
|
||||
@irena/l1t 16 1000*mV 0x000
|
||||
@irena/l1t 17 100*mV 0x000
|
||||
@irena/l2t/ch=0/any=0x001/read=0x02664 All
|
||||
@irena/l2t/ch=1/disable
|
||||
@irena/l2t/ch=2/disable
|
||||
|
|
|
|||
BIN
flash_alke/IRENA2TH.RBF
Normal file
BIN
flash_alke/IRENA2TH.RBF
Normal file
Binary file not shown.
Binary file not shown.
BIN
flash_tarena/TARENA.RBF
Normal file
BIN
flash_tarena/TARENA.RBF
Normal file
Binary file not shown.
3
irena.py
3
irena.py
|
|
@ -191,5 +191,4 @@ if ifc.is_a("USB"):
|
|||
try:
|
||||
armlib._exec_file("irenarc.py", globals())
|
||||
except IOError as e:
|
||||
sys.stderr.write(e)
|
||||
|
||||
sys.stderr.write(repr(e))
|
||||
|
|
|
|||
|
|
@ -467,7 +467,7 @@ function AHBGO_B() {
|
|||
isMUONf="isAHBGOmuonB"
|
||||
}
|
||||
|
||||
function jFETT() {
|
||||
function jFETTOLD() {
|
||||
NC=9
|
||||
O1 = 1; thr[O1] = 45; ch[0] = O1; name[0]="O1"
|
||||
O2 = 2; thr[O2] = 45; ch[1] = O2; name[1]="O2"
|
||||
|
|
@ -492,6 +492,31 @@ function jFETT() {
|
|||
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() {
|
||||
NC=9
|
||||
P1 = 1; thr[P1] = 45; ch[0] = P1; name[0]="P1"
|
||||
|
|
@ -713,6 +738,10 @@ function ismuonMM() {
|
|||
function isPHA(i) {
|
||||
if (!/^EI/) return 0;
|
||||
A = $(3*i+6)/mV
|
||||
if (A>10)
|
||||
P = $(3*i+8)/mV/A
|
||||
else
|
||||
P = 0
|
||||
if ($(3*i+7)<2) return 1;
|
||||
return 2
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
END { print Itime }
|
||||
|
||||
/^H/ {
|
||||
/^H / {
|
||||
Time = $2
|
||||
Diff = Time - Last
|
||||
if (Diff>0 && Diff<=120) Itime += Diff
|
||||
|
|
|
|||
|
|
@ -84,42 +84,7 @@ def CHAOS_NAMES():
|
|||
{ "any": 0x100, "read": 0x3ffff }, # DL
|
||||
]
|
||||
|
||||
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):
|
||||
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(
|
||||
Keep_Alive = armlib.Keep_Alive_Schedule(
|
||||
cmd = "e/in"
|
||||
" '%u.%u %u.%u mbar %d %d °C F=%u H=%u',"
|
||||
" pre/10, pre%10, pre[1]/10, pre[1]%10,"
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
|
||||
|
||||
HW = {
|
||||
HW.update({
|
||||
"NCH" : 18,
|
||||
"NPEEK" : 18,
|
||||
}
|
||||
})
|
||||
|
||||
def defaults(nch=18, ntr=6):
|
||||
adcmask()
|
||||
|
|
@ -58,8 +58,10 @@ pulse_desy = [
|
|||
pulse_desy.reverse()
|
||||
|
||||
def shaper2u2(nch=18, ntr=6, **kk):
|
||||
HW["NCH"] = nch
|
||||
global mV
|
||||
mV=14000
|
||||
Var("mV", mV)
|
||||
defaults(nch=nch, ntr=ntr)
|
||||
pulse(range(nch), pulse2u2, **kk)
|
||||
readconfig(nch=nch, ntr=ntr)
|
||||
|
|
@ -277,12 +279,11 @@ def TANOS():
|
|||
readconfig()
|
||||
|
||||
def Gd4():
|
||||
global mV
|
||||
mV=14000
|
||||
shaper2u2()
|
||||
readmask=0x6666
|
||||
adcmask(readmask)
|
||||
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)
|
||||
for i in range(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)
|
||||
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():
|
||||
shaper2u2()
|
||||
global mV, AH, BH, CH, AL, BL, CL
|
||||
|
|
|
|||
296
irenarc-jfett.py
296
irenarc-jfett.py
|
|
@ -43,296 +43,6 @@ def shaper2u2(nch=18, ntr=6, **kk):
|
|||
pulse(range(nch), pulse2u2, **kk)
|
||||
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):
|
||||
armlib._exec_file(fn, globals())
|
||||
|
||||
|
|
@ -352,7 +62,7 @@ def jFETT(threshold=50):
|
|||
global mV, O1, O2, O3, B1, B2, B3, N1, N2, N3
|
||||
mV=14000
|
||||
O1, O2, O3, B1, B2, B3, N1, N2, N3 = 1, 2, 4, 7, 8, 10, 13, 14, 16
|
||||
readmask = 0x16596
|
||||
readmask = 0x3ffff
|
||||
adcmask(readmask)
|
||||
windows(2,3,4,5)
|
||||
for c in range(18):
|
||||
|
|
@ -386,7 +96,7 @@ def SOPA(threshold=50):
|
|||
l2trig(5, all=0x3ff, none=0x3ff, read=0)
|
||||
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
|
||||
make_pulser()
|
||||
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)
|
||||
print(pu.set_highlevel(), file=sys.stderr)
|
||||
sleep(0.1)
|
||||
cmd("e/i 'agilent pa %.3f'" % amp)
|
||||
cmd(f"e/i 'agilent pa {amp:.3f}'")
|
||||
if fn:
|
||||
Start(fn % amp)
|
||||
enable()
|
||||
|
|
|
|||
633
leia_stepper.py
Normal file
633
leia_stepper.py
Normal 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)
|
||||
|
|
@ -84,14 +84,14 @@ while True:
|
|||
if port and fd==sock.fileno():
|
||||
s = sock.accept()
|
||||
logger("connection from %s\n" % repr(s[1]))
|
||||
try:
|
||||
sockets[sockets.index(None)] = s
|
||||
except ValueError:
|
||||
if len(sockets)>=10:
|
||||
logger("too many connections %s\n" % repr(sockets))
|
||||
s[0].send(b"too many connections, good bye\n")
|
||||
s[0].close()
|
||||
else:
|
||||
try:
|
||||
sockets[sockets.index(None)] = s
|
||||
except ValueError:
|
||||
sockets.append(s)
|
||||
|
||||
while not pipe and files:
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
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 --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/
|
||||
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
|
||||
|
|
|
|||
36
nmahepam.py
36
nmahepam.py
|
|
@ -8,7 +8,7 @@ def HK():
|
|||
Vss = hk2mvolt("adc_Vmcsa")*(-0.002)
|
||||
Icc = hk2mvolt("adc_Ipcsa")*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)
|
||||
Ibias = hk2mvolt("adc_Ibias")*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
|
||||
|
||||
def findnmahepam():
|
||||
findxrena(prod=(0xee0c,))
|
||||
findxrena(prod=(0xee0c,0xee0a))
|
||||
if connected_p():
|
||||
set_clock()
|
||||
messages()
|
||||
|
|
@ -52,33 +52,47 @@ def AHBGOa():
|
|||
SSDe = SSDb
|
||||
default_config()
|
||||
atriggers(1,TBITS(BGO))
|
||||
for c in SSDa+SSDb+SSDc: thres(1,c,8)
|
||||
for c in BGO: thres(1,c,8)
|
||||
for c in SSDd+SSDe: thres(0,c,8)
|
||||
for c in SSDa+SSDb+SSDc: thres(1,c,5)
|
||||
for c in BGO: thres(1,c,5)
|
||||
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'")
|
||||
fifo_enable(sl=sl, hk=hk, ev=ev, **aa)
|
||||
enable()
|
||||
enable(what=what)
|
||||
|
||||
def adisable():
|
||||
cmd("s/cron/none")
|
||||
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__":
|
||||
ifc,_oo = armlib.init_irena(scope = globals(), name = "AHEPAM", prod = (0xee0c,),
|
||||
long_options=["seth", "ahbgo"])
|
||||
ifc,_oo = armlib.init_irena(scope = globals(), name = "AHEPAM", prod = (0xee0c,0xee0a),
|
||||
long_options=["seth", "ahbgo", "leia"])
|
||||
if ifc.is_a("USB"):
|
||||
findnmahepam()
|
||||
for o,v in _oo[0]:
|
||||
if o=="--seth":
|
||||
dorn.CONFIG.seth()
|
||||
armlib.set_prompt("SETH")
|
||||
ifc._stream_control=0x000a
|
||||
if o=="--ahbgo":
|
||||
dorn.CONFIG.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'
|
||||
if ifc.is_a("USB"):
|
||||
findnmahepam()
|
||||
from dorn import *
|
||||
dorn._connect(ifc)
|
||||
ifc._stream_reset |= 0x000c
|
||||
|
|
|
|||
0
pressure.awk
Normal file → Executable file
0
pressure.awk
Normal file → Executable file
2
script.c
2
script.c
|
|
@ -83,13 +83,13 @@ int script_execute_fd(int fd, struct command *cmd)
|
|||
unsigned int locals[36];
|
||||
unsigned int labels[NLABELS];
|
||||
memset(labels, 0, sizeof(labels));
|
||||
unsigned int *old_locals = local_variables;
|
||||
if (local_variables)
|
||||
memcpy(locals, local_variables, sizeof(locals));
|
||||
else
|
||||
memset(locals, 0, sizeof(locals));
|
||||
if (cmd && cmd->cmd && *cmd->cmd && cmd->csize)
|
||||
parse_parameters(cmd, locals);
|
||||
unsigned int *old_locals = local_variables;
|
||||
while ((n=file_gets(fd, scmd_buf, sizeof(scmd_buf)))) {
|
||||
char sres[MSG_SIZE];
|
||||
local_variables = locals;
|
||||
|
|
|
|||
3
ssp.c
3
ssp.c
|
|
@ -29,6 +29,7 @@ unsigned int ssp_dma_size;
|
|||
unsigned int ssp_min_size = 1;
|
||||
unsigned int ssp_block_idle = 256;
|
||||
unsigned int ssp_block_size = 3;
|
||||
unsigned int ssp_nobuffer_count;
|
||||
|
||||
unsigned int ssp_get_status(void)
|
||||
{
|
||||
|
|
@ -139,6 +140,8 @@ static void ssp_isr(void)
|
|||
// Try again.
|
||||
if (!j->buf_count) {
|
||||
if (get_new_buffer(j->buf_start)) {
|
||||
SSPIMSC = 0;
|
||||
ssp_nobuffer_count++;
|
||||
VICVectAddr = 0;
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
1
ssp.h
1
ssp.h
|
|
@ -21,6 +21,7 @@ extern unsigned int ssp_lastword;
|
|||
extern unsigned int ssp_dma_size;
|
||||
extern unsigned int ssp_block_idle;
|
||||
extern unsigned int ssp_block_size;
|
||||
extern unsigned int ssp_nobuffer_count;
|
||||
|
||||
enum ssp_flags {
|
||||
ssp_compress = 1,
|
||||
|
|
|
|||
16
tarena.py
16
tarena.py
|
|
@ -13,6 +13,8 @@ arena._connect(ifc)
|
|||
if ifc.is_a("USB"):
|
||||
findarena()
|
||||
|
||||
lasc.lasc_init(ifc)
|
||||
|
||||
def enable(what="usb/f3/hk"):
|
||||
Cmd("altera/fifo/set 8")
|
||||
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):
|
||||
if not lasc:
|
||||
lasc = (LAread(),)
|
||||
LASCplot(*lasc, what=LAch)
|
||||
lasc = (lasc.LAread(),)
|
||||
lasc.LASCplot(*lasc, what=LAch)
|
||||
|
||||
LAdata=None
|
||||
|
||||
def taLAsingle(trig="RD"):
|
||||
if trig[0]=='~' or trig[0]=='!':
|
||||
LASCsingle(trig[1:], edge=False)
|
||||
lasc.LASCsingle(trig[1:], edge=False)
|
||||
else:
|
||||
LASCsingle(trig)
|
||||
lasc.LASCsingle(trig)
|
||||
|
||||
def taLAread():
|
||||
global LAdata
|
||||
LAdata = LAread()
|
||||
LAdata = lasc.LAread()
|
||||
return LAdata
|
||||
|
||||
def taLAplot(d=None, what=LAch):
|
||||
if not d:
|
||||
d = LAdata
|
||||
LASCplot(d, None, what=what)
|
||||
lasc.LASCplot(d, None, what=what)
|
||||
|
||||
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 out "%s"
|
||||
""" % fn)
|
||||
|
|
|
|||
2
udp.c
2
udp.c
|
|
@ -161,6 +161,8 @@ int udp_write_stream(void *buf)
|
|||
return 0;
|
||||
case 1:
|
||||
break;
|
||||
case 3:
|
||||
return 1;
|
||||
default:
|
||||
if (udp_stream_reset
|
||||
&& dropped_tick
|
||||
|
|
|
|||
|
|
@ -181,6 +181,7 @@ class messagelog(asyncore.dispatcher):
|
|||
self.bind(("", port))
|
||||
self.logfile = None
|
||||
self.open_logfile(fn)
|
||||
self.Jobs = []
|
||||
|
||||
def writable(self):
|
||||
return False
|
||||
|
|
@ -213,6 +214,10 @@ class messagelog(asyncore.dispatcher):
|
|||
if self.sync>1:
|
||||
os.fsync(self.logfile.fileno())
|
||||
self.blocks += 1
|
||||
if self.Jobs:
|
||||
t = time.time()
|
||||
for j in self.Jobs:
|
||||
j.poll(t)
|
||||
|
||||
def Status(self, name):
|
||||
return "%s socket %s file %s blocks %d" % (name, repr(self), repr(self.logfile), self.blocks)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue