mupp: simplify the python example to a single <python> block.

Use the new coll[]/collErr[] interface so sigmaSC-vs-temp-py.txt computes both
SigmaSC_10 and SigmaSC_150 in one block instead of one block per collection.
Collection 0 is addressed by index (coll[0]) and collection 1 by name
(coll['...Tscan.db']) to show both addressing modes. Output is unchanged.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-27 14:04:03 +02:00
parent 3abdace782
commit a575d7398e
+15 -12
View File
@@ -6,24 +6,27 @@ loadPath ./
load YBCO-40nm-FC-E3p8keV-B10mT-Tscan.db # collection 0
load YBCO-40nm-FC-E3p8keV-B150mT-Tscan.db # collection 1
# B=10mT
select 0
# declare the python variables (one block for all of them, see below)
var SigmaSC_10 = python
var SigmaSC_10Err = python
<python>
import numpy as np
SigmaSC_10 = np.sqrt(abs(np.array(Sigma)**2-0.11**2))
SigmaSC_10Err = np.sqrt((np.array(Sigma)*np.array(SigmaErr))**2+(0.11*0.0025)**2)/np.array(SigmaSC_10)
</python>
# B=150mT
select 1
var SigmaSC_150 = python
var SigmaSC_150Err = python
# a single python block can serve several collections: address each one
# explicitly via coll[]/collErr[], either by index (coll[0], B=10mT) or by name
# (coll['...Tscan.db'], B=150mT). Both addressing modes are shown here.
<python>
import numpy as np
SigmaSC_150 = np.sqrt(abs(np.array(Sigma)**2-0.075**2))
SigmaSC_150Err = np.sqrt((np.array(Sigma)*np.array(SigmaErr))**2+(0.075*0.0025)**2)/np.array(SigmaSC_150)
# B=10mT -> collection 0, addressed by index
s10 = np.array(coll[0]['Sigma'])
se10 = np.array(collErr[0]['Sigma'])
SigmaSC_10 = np.sqrt(abs(s10**2-0.11**2))
SigmaSC_10Err = np.sqrt((s10*se10)**2+(0.11*0.0025)**2)/SigmaSC_10
# B=150mT -> collection 1, addressed by name
s150 = np.array(coll['YBCO-40nm-FC-E3p8keV-B150mT-Tscan.db']['Sigma'])
se150 = np.array(collErr['YBCO-40nm-FC-E3p8keV-B150mT-Tscan.db']['Sigma'])
SigmaSC_150 = np.sqrt(abs(s150**2-0.075**2))
SigmaSC_150Err = np.sqrt((s150*se150)**2+(0.075*0.0025)**2)/SigmaSC_150
</python>
# link variables to collections