# This is a comment
# Script: sigmaSC-vs-temp.txt

loadPath ./

load YBCO-40nm-FC-E3p8keV-B10mT-Tscan.db  # collection 0
load YBCO-40nm-FC-E3p8keV-B150mT-Tscan.db # collection 1

# declare the python variables (one block for all of them, see below)
var SigmaSC_10 = python
var SigmaSC_10Err = python
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
# 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
col 0 : SigmaSC_10    # error variable SigmaSC_10Err doesn't need to be given, it is automatically linked to SigmaSC_10
col 1 : SigmaSC_150

norm

select 0
x dataT
y SigmaSC_10

select 1
x dataT
y SigmaSC_150

savePath ./
plot SigmaSCVsTemp_py.pdf

macro SigmaSCVsTemp_py.C

# end
