-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgaussianAnim.py
41 lines (35 loc) · 1.77 KB
/
gaussianAnim.py
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
import numpy as np
import matplotlib.pyplot as plt
import dataPull as dataP
import primaryConvolve as na
#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.matrixGaussian
###
#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(interpTheory, matrixGaussian, uniformNeutronEnergyList)
expereimentPlotPoints = na.convolution_2d_changing_kernel(interpExperimental, matrixGaussian, uniformNeutronEnergyList)
# Set up the figure, axis, and plot element
fig, ax = plt.subplots()
x = neutronEnergyList
# plots the theory values from the excel doc
line, = ax.plot(uniformNeutronEnergyList, interpTheory, color = "blue")
# plots the theory values convolved with the gaussian matrix
ax.plot(uniformNeutronEnergyList, theoryPlotPoints, color = "black")
#plots the interped experimental data
ax.plot(uniformNeutronEnergyList, interpExperimental, color ="red")
#plots the experimental data convolved with the gaussian matrix
ax.plot(uniformNeutronEnergyList, expereimentPlotPoints, color= "green")
ax.set_yscale('linear')
plt.show()