-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
68 lines (48 loc) · 2.89 KB
/
Copy pathmain.py
File metadata and controls
68 lines (48 loc) · 2.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import numpy as np
import matplotlib.pyplot as plt
import dataPull as dataP
import DepConvLib.primaryConvolve as na
import azureComparePython as azurePlots
#this program is usefull for conceptualizing how the gaussian is changing with energy
#keep in mind the values that are greater than zero are used in the convolution with the theory data
###Imports the variables from dataPull.py
expereimentValues = dataP.expereimentValues
uncertainty = dataP.uncertainty
neutronEnergyList = dataP.neutronEnergyList
theoryValuesList = dataP.theoryValuesList
neutronEnergyList = np.array(neutronEnergyList)
#creates a uniform energy axis inorder to ensure gaussian is normalized
uniformNeutronEnergyList = dataP.uniformNeutronEnergyList
interpTheory = dataP.interpTheory
interpExperimental = dataP.interpExperiment
#imports the 2d Gaussian matrix from dataPull.py
#matrixGaussian = dataP.matrixGaussianFunc(dataP.shortUniformNeutronEnergyList)
###
#testMatrix = dataP.matrixGaussianFunc(neutronEnergyList)
testTheory = na.convolution_2d_changing_kernel(theoryValuesList, dataP.gaussian, uniformNeutronEnergyList, 2)
#uses the convolv function in newApproach.py to caluculate the points at a specifc index for the 2d gaussian matrix
#theoryPlotPoints = na.convolution_2d_changing_kernel(theoryValuesList, matrixGaussian, uniformNeutronEnergyList)
#expereimentPlotPoints = na.convolution_2d_changing_kernel(interpExperimental, matrixGaussian, uniformNeutronEnergyList)
# Set up the figure, axis, and plot element
fig, ax = plt.subplots()
# plots the theory values from the excel doc
#line, = ax.plot(uniformNeutronEnergyList, interpTheory, color = "blue" , label ="Theory No Convolution", linewidth = 3)
# plots the theory values convolved with the gaussian matrix
#plots the interped experimental data
ax.plot(dataP.neutronEnergyList, dataP.expereimentValuesList,"o", color ="red" , label = "Experimental Data")
#ax.plot(uniformNeutronEnergyList, theoryPlotPoints, color = "black" , label = "Python Based Convolution", linewidth = 2, marker = "x")
#plots the experimental data convolved with the gaussian matrix
#ax.plot(uniformNeutronEnergyList, expereimentPlotPoints, color= "green", label = "Experimental Convolution", linewidth = 2)
ax.plot(azurePlots.azureLabEnergy, azurePlots.azureCrossSec[3], color="green", label = "Azure Based Convolution", linewidth = 2, marker = "x")
#plots the theory values without interp and convolved with energy dependance
ax.plot(neutronEnergyList, testTheory, color = "blue", label="Python Convolution Theory")
#Plots the theory values without a convolution
ax.plot(neutronEnergyList, theoryValuesList, color="purple", label="Theory/No Convolution")
ax.set_yscale('log')
#Plot formating
plt.legend(loc="upper left", fontsize = 24)
plt.tick_params(axis='both', which='major', labelsize=20)
plt.xlabel("Lab Frame Energy (MeV)",fontsize = 20)
plt.ylabel("Yield (Unit Less)",fontsize = 20)
plt.xlim(0.3, 0.5)
plt.show()