From a575d7398ea9508e9f182a07ec7ec3db4ea41204 Mon Sep 17 00:00:00 2001 From: Andreas Suter Date: Wed, 27 May 2026 14:04:03 +0200 Subject: [PATCH] mupp: simplify the python example to a single 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 --- doc/examples/mupp/sigmaSC-vs-temp-py.txt | 27 +++++++++++++----------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/doc/examples/mupp/sigmaSC-vs-temp-py.txt b/doc/examples/mupp/sigmaSC-vs-temp-py.txt index d970fd1ee..41059e2a1 100644 --- a/doc/examples/mupp/sigmaSC-vs-temp-py.txt +++ b/doc/examples/mupp/sigmaSC-vs-temp-py.txt @@ -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 - -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) - - -# 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. 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 # link variables to collections