Commit 8314f67d authored by Iñaki Lara's avatar Iñaki Lara

23/09/2019

parents
Pipeline #60 failed with stages
This diff is collapsed.
from scipy.interpolate import griddata
import numpy as np
import sys
#
#This takes numbers displayed in https://atlas.web.cern.ch/Atlas/GROUPS/PHYSICS/PAPERS/SUSY-2018-32/figaux_03a.png, tessellate the input point set to 2-dimensional simplices, and interpolate linearly on each simplex.
#See for further info https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.griddata.html
#
#USAGE--------------------------------------------------------
#
#>> python<..> SLP_W.py x=[x_val] y=[y_val]
#>> [upper limit in fb]
#
# If the masses are outside ot the interpolated region the subroutine returns nan
#Data for interpolation------------------------------------
x=[110,135,160,185,210,235,310,335,360,385,410,435,485,
110,135,160,185,210,235,260,285,310,335,360,385,410,460,
135,160,185,210,235,260,285,310,335,385,410,435,485,
235,260,285,335,360,410,465,
185,210,235,260,310,335,360,385,410,435,485,
235,260,285,310,335,360,385,460,
285,335,360,385,435,485,
265,
485]
y=[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,
20.0,20.0,20.0,20.0,20.0,20.0,20.0,20.0,20.0,20.0,20.0,20.0,20.0,20.0,
40.0,40.0,40.0,40.0,40.0,40.0,40.0,40.0,40.0,40.0,40.0,40.0,40.0,
60.0,60.0,60.0,60.0,60.0,60.0,60.0,
100.0,100.0,100.0,100.0,100.0,100.0,100.0,100.0,100.0,100.0,100.0,
120.0,120.0,120.0,120.0,120.0,120.0,120.0,120.0,
140,140,140,140,140,140,
180,
200]
z=[6005.4,1527.1,674.6,368.7,172.6,202.3,91.4,81.2,60.6,52.4,47.9,43.5,34.1,
14303.6,2160.9,685.7,414.4,184.3,220.7,107.7,131.3,95.9,79.1,66.1,53.7,49.1,37.8,
6108.3,1342.0,473.7,215.5,206.1,113.7,124.1,92.2,82.4,49.6,54.2,47.1,33.1,
269.2,139.3,152.0,72.7,71.1,47.2,40.3,
2717.0,481.4,350.6,148.4,115.5,90.4,74.8,67.3,49.5,43.7,38.1,
616.3,301.3,200.8,161.6,103.9,91.5,64.1,45.8,
278.4,149.9,101.1,81.2,56.7,38.8,
2527.3,
49.9]
kx=5
ky=5
s=0
input_data=[0,0]
#--------------------------------------------------------------------------------------------
#Routine for input data----------------------------------------------------------------------
for arg in sys.argv:
if 'SLP_W.py'.lower() in arg.lower():
pass
elif arg.lower().split("=")[0]=="x".lower():
input_data[0]=arg.split("=")[1]
elif arg.lower().split("=")[0]=="y".lower():
input_data[1]=arg.split("=")[1]
else:
print("Unexpected argument: ",arg)
#--------------------------------------------------------------------------------------------
#Calculating value on input point------------------------------------------------------------
data=[]
for n,el in enumerate(x) :
data.append([x[n],y[n]])
result=griddata(data, z, (input_data), method='linear')
#---------------------------------------------------------------------------------------------
#Output through Stdout
print(result)
from scipy.interpolate import griddata
import numpy as np
import sys
#
#This takes numbers displayed in https://atlas.web.cern.ch/Atlas/GROUPS/PHYSICS/PAPERS/SUSY-2018-32/figaux_03b.png , tessellate the input point set to 2-dimensional simplices, and interpolate linearly on each simplex.
#See for further info https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.griddata.html
#
#USAGE--------------------------------------------------------
#
#>> python<..> SLP_sne.py x=[x_val] y=[y_val]
#>> [upper limit in fb]
#
# If the masses are outside ot the interpolated region the subroutine returns nan
#Data for interpolation------------------------------------
x=[120,480,700,880,980,
120,840,940,1040,
380,480,580,700,780,880,980,
240,860,940,1060,
280,360,380,480,580,700,780,880,980,
380,860,960,1060,
380,480,580,700,780,880,1000,
540,860,960,1060,
480,580,700,790,910,
660,740,860,
700,780,920]
y=[0.0,0.0,0.0,0.0,0.0,
40,40,40,40,
100,100,100,100,100,100,100,
140,140,140,140,
180,180,180,180,180,180,180,180,180,
220,220,220,220,
280,280,280,280,280,280,280,
340,340,340,340,
400,400,400,400,400,
440,440,440,
500,500,500]
z=[183.0,1.6,1.0,0.8,0.7,
2858.0,0.8,0.7,0.7,
3.6,1.9,1.3,1.0,0.8,0.7,0.7,
1030.1,0.8,0.7,0.7,
999.7,24.8,8.8,2.8,1.7,1.1,0.9,0.8,0.7,
21.6,0.9,0.8,0.7,
646.5,8.9,2.7,1.6,1.1,0.9,0.7,
7.4,1.1,0.9,0.7,
802.5,7.9,2.2,1.5,1.1,
7.9,2.4,1.5,
7.4,2.5,1.5]
kx=5
ky=5
s=0
input_data=[0,0]
#--------------------------------------------------------------------------------------------
#Routine for input data----------------------------------------------------------------------
for arg in sys.argv:
if 'SLP_sne.py'.lower() in arg.lower():
pass
elif arg.lower().split("=")[0]=="x".lower():
input_data[0]=arg.split("=")[1]
elif arg.lower().split("=")[0]=="y".lower():
input_data[1]=arg.split("=")[1]
else:
print("Unexpected argument: ",arg)
#--------------------------------------------------------------------------------------------
#Calculating value on input point------------------------------------------------------------
data=[]
for n,el in enumerate(x) :
data.append([x[n],y[n]])
result=griddata(data, z, (input_data), method='linear')
#---------------------------------------------------------------------------------------------
#Output through Stdout
print(result)
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
from scipy.interpolate import griddata
import numpy as np
import sys
import matplotlib.pyplot as plt
import math
#
#See for further info https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.griddata.html
#
#USAGE--------------------------------------------------------
#
#>> python<..> trigg_bino.py x=[x_val] y=[y_val] channel=[]
#>> [efficiency]
#
# If the masses are outside ot the interpolated region the subroutine returns nan
#Data for interpolation------------------------------------
x=[60,150,350,700,
150,350,700,
350,700]
y=[60,60,60,60,
150,150,150,
350,350]
z_aI=[0.1068,0.4566,0.9503,0.9967,
0.8655,0.9818,0.9993,
0.9992,0.9999]
z_bI=[0.0804,0.449,0.903,0.988,
0.7141,0.928,0.988,
0.9879,0.9972]
z_cI=[0.0938,0.4594,0.8817,0.9757,
0.6566,0.8824,0.9751,
0.9279,0.9742]
z_dI=[0.0294,0.3770,0.8681,0.9811,
0.35,0.8322,0.9834,
0.8792,0.9775]
z_eI=[0.0524,0.4205,0.833,0.985,
0.3735,0.8961,0.9828,
0.7128,0.9854]
#································
z_aII=[0.1068,0.419,0.9559,0.9985,
0.8655,0.9836,0.999,
0.9992,0.9999]
z_bII=[0.0804,0.3712,0.9233,0.9929,
0.7141,0.9226,0.9931,
0.9879,0.9971]
z_cII=[0.0938,0.3787,0.8928,0.9836,
0.6566,0.8545,0.9823,
0.9279,0.9813]
z_dII=[0.0294,0.3046,0.9832,0.9801,
0.35,0.9006,0.9829,
0.8792,0.9767]
z_eII=[0.0524,0.3066,0.9287,0.9938,
0.3735,0.8571,0.9949,
0.7128,0.9977]
#································
z_aIII=[0.1068,0.468,0.9429,0.9952,
0.8655,0.9664,0.9978,
0.9992,0.9997]
z_bIII=[0.0804,0.3956,0.9044,0.987,
0.7141,0.9879,0.9897,
0.9879,0.998]
z_cIII=[0.0938,0.4561,0.9011,0.9812,
0.6566,0.8976,0.9796,
0.9279,0.9825]
z_dIII=[0.0294,0.356,0.9224,0.9833,
0.35,0.8882,0.9833,
0.8792,0.9836]
z_eIII=[0.0524,0.3219,0.9311,0.9887,
0.3735,0.8958,0.9925,
0.7128,0.9955]
kx=5
ky=5
s=0
input_data=[0,0]
Z={'ai':z_aI,'bi':z_bI,'ci':z_cI,'di':z_dI,'ei':z_eI,'aii':z_aII,'bii':z_bII,'cii':z_cII,'dii':z_dII,'eii':z_eII,'aiii':z_aIII,'biii':z_bIII,'ciii':z_cIII,'diii':z_dIII,'eiii':z_eIII}
#--------------------------------------------------------------------------------------------
#Routine for input data----------------------------------------------------------------------
for arg in sys.argv:
if 'trigg_bino.py'.lower() in arg.lower():
pass
elif arg.lower().split("=")[0]=="x".lower():
input_data[0]=arg.split("=")[1]
elif arg.lower().split("=")[0]=="y".lower():
input_data[1]=arg.split("=")[1]
elif arg.lower().split("=")[0]=="channel".lower():
channel=arg.split("=")[1].lower()
else:
print("Unexpected argument: ",arg)
#--------------------------------------------------------------------------------------------
#Calculating value on input point------------------------------------------------------------
data=[]
result={}
I_method='linear'
#I_method='nearest'
#I_method='cubic'
for n,el in enumerate(x) :
data.append([x[n],y[n]])
result['ai']=griddata(data, z_aI, (input_data), method=I_method)
result['bi']=griddata(data, z_bI, (input_data), method=I_method)
result['ci']=griddata(data, z_cI, (input_data), method=I_method)
result['di']=griddata(data, z_dI, (input_data), method=I_method)
result['ei']=griddata(data, z_eI, (input_data), method=I_method)
result['aii']=griddata(data, z_aII, (input_data), method=I_method)
result['bii']=griddata(data, z_bII, (input_data), method=I_method)
result['cii']=griddata(data, z_cII, (input_data), method=I_method)
result['dii']=griddata(data, z_dII, (input_data), method=I_method)
result['eii']=griddata(data, z_eII, (input_data), method=I_method)
result['aiii']=griddata(data, z_aIII, (input_data), method=I_method)
result['biii']=griddata(data, z_bIII, (input_data), method=I_method)
result['ciii']=griddata(data, z_cIII, (input_data), method=I_method)
result['diii']=griddata(data, z_dIII, (input_data), method=I_method)
result['eiii']=griddata(data, z_eIII, (input_data), method=I_method)
#---------------------------------------------------------------------------------------------
#Output through Stdout
print(result[channel])
#if False:
if True:
grid_x, grid_y = np.mgrid[50:700:2, 50:400:2]
#v_method='linear'
#v_method='cubic'
#print(len(data),len(z))
z_test=float(0)*grid_x
x_test=[]
y_test=[]
z_test_X=[]
for key in result:
spl = griddata(data, Z[key], (grid_x, grid_y), method=I_method)
for n,el in enumerate(grid_x):
for m,elm in enumerate(grid_x[n]):
x_test.append(grid_x[n][m])
y_test.append(grid_y[n][m])
if grid_y[n][m]+60<grid_x[n][m]:
# if float(spl[n][m])>0.0:
z_test[n][m]=(float(spl[n][m]))
# z_test[n][m]=math.log(float(spl[n][m]))
else:
z_test[n][m]=(spl[n][m])
# z_test[n][m]=math.log(spl[n][m])
# z_test[n][m]=0
z_test_X.append(z_test[n][m])
fig, ax = plt.subplots()
data_P={'x_test':x_test,'y_test':y_test,'z_test':z_test_X}
#print(data)
plt.scatter('x_test', 'y_test',c= 'z_test',data=data_P, zorder=0)
#plt.imshow(spl.T, extent=(100,600,0,300), origin='lower')
plt.ylabel('m_Bino [GeV]')
plt.xlabel('m_Wino [GeV]')
cbar = plt.colorbar()
cbar.set_label("effT")
plt.savefig('effT_'+key+'.eps', format='eps', dpi=200)
# plt.show()
from scipy.interpolate import griddata
import numpy as np
import sys
#
#This takes numbers displayed in https://atlas.web.cern.ch/Atlas/GROUPS/PHYSICS/PAPERS/SUSY-2016-24/figaux_31b.png , tessellate the input point set to 2-dimensional simplices, and interpolate linearly on each simplex.
#See for further info https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.griddata.html
#
#USAGE--------------------------------------------------------
#
#>> python<..> limit_sneuLSP.py x=[x_val] y=[y_val]
#>> [upper limit in fb]
#
# If the masses are outside ot the interpolated region the subroutine returns nan
#Data for interpolation------------------------------------
x=[90,190,240,340,390,440,490,540,590,640,690,
90,
90,
140,
190,240,340,390,440,490,540,590,640,690,
190,
190,240,290,340,
240,290,340,390,440,490,540,590,640,690,
290,340,390,440,
340,440,490,540,590,640,690,
390,440,490,540,
440,490,690]
y=[0,0,0,0,0,0,0,0,0,0,0,
20,
40,
80,
100,100,100,100,100,100,100,100,100,100,
120,
140,140,140,140,
200,200,200,200,200,200,200,200,200,200,
240,240,240,240,
300,300,300,300,300,300,300,
340,340,340,340,
400,400,400]
z=[1276.3,15.6,7.3,0.5,0.4,0.3,0.3,0.3,0.3,0.2,0.2,
56785.2,
19884.3,
197.8,
35.6,13.4,0.5,0.4,0.4,0.3,0.3,0.3,0.3,0.3,
85.6,
4221.6,3.7,1.2,0.6,
839.2,3.6,1.1,0.6,0.5,0.4,0.3,0.3,0.3,0.3,
755.0,3.3,0.9,0.6,
245.2,0.9,0.5,0.4,0.4,0.3,0.3,
250.2,2.8,0.9,0.5,
90.3,3.0,0.3]
kx=5
ky=5
s=0
input_data=[0,0]
#--------------------------------------------------------------------------------------------
#Routine for input data----------------------------------------------------------------------
for arg in sys.argv:
if 'limit_sneuLSP.py'.lower() in arg.lower():
pass
elif arg.lower().split("=")[0]=="x".lower():
input_data[0]=arg.split("=")[1]
elif arg.lower().split("=")[0]=="y".lower():
input_data[1]=arg.split("=")[1]
else:
print("Unexpected argument: ",arg)
#--------------------------------------------------------------------------------------------
#Calculating value on input point------------------------------------------------------------
data=[]
for n,el in enumerate(x) :
data.append([x[n],y[n]])
result=griddata(data, z, (input_data), method='linear')
#---------------------------------------------------------------------------------------------
#Output through Stdout
print(result)
from scipy.interpolate import griddata
import numpy as np
import sys
#
#This takes numbers displayed in https://atlas.web.cern.ch/Atlas/GROUPS/PHYSICS/PAPERS/SUSY-2016-24/figaux_31b.png , tessellate the input point set to 2-dimensional simplices, and interpolate linearly on each simplex.
#See for further info https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.griddata.html
#
#USAGE--------------------------------------------------------
#
#>> python<..> limit_sneuLSP.py x=[x_val] y=[y_val]
#>> [upper limit in fb]
#
# If the masses are outside ot the interpolated region the subroutine returns nan
#Data for interpolation------------------------------------
x=[100,150,200,250,300,350,400,450,500,550,600,
125,175,225,275,325,375,425,475,525,575,625,
150,
175,200,250,300,350,400,450,500,550,600,
200,220,
225,275,325,375,425,475,525,575,625,
250,
250,275,300,350,400,450,500,550,600,
325,375,425,475,525,575,625,
350,400,450,500,550,600]
y=[0,0,0,0,0,0,0,0,0,0,0,
50,50,50,50,50,50,50,50,50,50,50,
75,
100,100,100,100,100,100,100,100,100,100,
125,125,
150,150,150,150,150,150,150,150,150,
175,
200,200,200,200,200,200,200,200,200,
250,250,250,250,250,250,250,
300,300,300,300,300,300]
z=[1199,18.3,9.2,3.5,2.0,1.9,1.9,1.9,1.9,1.9,1.5,
666,21.2,7.1,3.3,2.0,2.0,1.9,1.7,1.6,1.6,1.5,
173,
90.6,514,8.7,3.0,2.0,2.0,2.0,1.7,1.6,1.5,
75.1,19.5,
71.6,13.9,3.4,2.0,2.1,2.1,1.7,1.6,1.5,
71.3,
2991,49.9,31.3,5.9,2.1,1.9,1.9,1.6,1.6,
50.3,9.3,2.8,2.2,2.0,1.7,1.8,
10602,20.1,4.4,2.1,1.9,1.8]
kx=5
ky=5
s=0
input_data=[0,0]
#--------------------------------------------------------------------------------------------
#Routine for input data----------------------------------------------------------------------
for arg in sys.argv:
if 'limit_sneuLSP.py'.lower() in arg.lower():
pass
elif arg.lower().split("=")[0]=="x".lower():
input_data[0]=arg.split("=")[1]
elif arg.lower().split("=")[0]=="y".lower():
input_data[1]=arg.split("=")[1]
else:
print("Unexpected argument: ",arg)
#--------------------------------------------------------------------------------------------
#Calculating value on input point------------------------------------------------------------
data=[]
for n,el in enumerate(x) :
data.append([x[n],y[n]])
result=griddata(data, z, (input_data), method='linear')
#---------------------------------------------------------------------------------------------
#Output through Stdout
print(result)
#from scipy.interpolate import RectBivariateSpline
from scipy.interpolate import griddata
import matplotlib.pyplot as plt
import numpy as np
import math
x=[90,190,240,340,390,440,490,540,590,640,690,
90,
90,
140,
190,240,340,390,440,490,540,590,640,690,
190,
190,240,290,340,
240,290,340,390,440,490,540,590,640,690,
290,340,390,440,
340,440,490,540,590,640,690,
390,440,490,540,
440,490,690]
y=[0,0,0,0,0,0,0,0,0,0,0,
20,
40,
80,
100,100,100,100,100,100,100,100,100,100,
120,
140,140,140,140,
200,200,200,200,200,200,200,200,200,200,
240,240,240,240,
300,300,300,300,300,300,300,
340,340,340,340,
400,400,400]
z=[1276.3,15.6,7.3,0.5,0.4,0.3,0.3,0.3,0.3,0.2,0.2,
56785.2,
19884.3,
197.8,
35.6,13.4,0.5,0.4,0.4,0.3,0.3,0.3,0.3,0.3,
85.6,
4221.6,3.7,1.2,0.6,
839.2,3.6,1.1,0.6,0.5,0.4,0.3,0.3,0.3,0.3,
755.0,3.3,0.9,0.6,
245.2,0.9,0.5,0.4,0.4,0.3,0.3,
250.2,2.8,0.9,0.5,
90.3,3.0,0.3]
kx=3
ky=3
s=0
grid_x, grid_y = np.mgrid[100:700:2, 0:300:2]
input_data=[300,50]
#print(grid_x)
#print('\n\n')
#print(grid_y)
data=[]
for n,el in enumerate(x) :
data.append([x[n],y[n]])
v_method='linear'
#v_method='cubic'
#print(len(data),len(z))
spl = griddata(data, z, (grid_x, grid_y), method=v_method)
print(griddata(data, z, (input_data), method='cubic'))
#spl = RectBivariateSpline(x, y, z, kx=3, ky=3)
z_test=float(0)*grid_x
x_test=[]
y_test=[]
z_test_X=[]
#print(spl)
for n,el in enumerate(grid_x):
for m,elm in enumerate(grid_x[n]):
x_test.append(grid_x[n][m])
y_test.append(grid_y[n][m])
if grid_y[n][m]+50<grid_x[n][m]:
# if float(spl[n][m])>0.0:
z_test[n][m]=(float(spl[n][m]))
# z_test[n][m]=math.log(float(spl[n][m]))
else:
z_test[n][m]=(spl[n][m])
# z_test[n][m]=math.log(spl[n][m])
# z_test[n][m]=10602
z_test_X.append(z_test[n][m])
fig, ax = plt.subplots()
data={'x_test':x_test,'y_test':y_test,'z_test':z_test_X}
#print(data)
plt.scatter('x_test', 'y_test',c= 'z_test',data=data, zorder=0)
#plt.imshow(spl.T, extent=(100,600,0,300), origin='lower')
plt.ylabel('m_sneu [GeV]')