pdf_list = []
times = np.linspace(0, 365, 366) #365 days to test
#test all days at same energies, where energy = 3
for i,time in enumerate(times):
    value = dmdd.PDF(Q=[5.], time=time, element = 'xenon', mass = 50.,
                                sigma_si= 75.5, sigma_anapole = 0.,
                                Qmin = np.asarray([5.]), Qmax = np.asarray([10.]),
                                Tmin = 0, Tmax = 365)
    pdf_list.append(value)
    
plt.plot(times, pdf_list)
plt.xlabel("Time in Days")
plt.ylabel("Predicted PDF SI Model")
plt.title("Predicted PDF over Time for SI Model")


#PDF values show correct annual modulation for events over time (not normalized)


pdf_list = []
times = np.linspace(0, 365, 366) #365 days to test
#test all days at same energies, where energy = 3
for i,time in enumerate(times):
    value = dmdd.PDF(Q=[5.], time=time, element = 'xenon', mass = 50.,
                                sigma_si= 0., sigma_anapole = 44.25,
                                Qmin = np.asarray([5.]), Qmax = np.asarray([10.]),
                                Tmin = 0, Tmax = 365)
    pdf_list.append(value)
    
plt.plot(times, pdf_list)
plt.xlabel("Time in Days")
plt.ylabel("Predicted PDF")
plt.title("Predicted PDF over Time for Anapole Model")


"""
Explanation: Testing PDF function in dmdd over time for SI and Anapole
On the colormaps near Q = 0, the pdf function seems to be predicting the wrong number of events for the SI and anapole models. SI should have more events in the end of the graph (days 200-350) and anapole should have more events in the beginning of the graph (days 50-150).
These graphs agree with the histogram plots that have annual modulation as well as the line graphs that I made over the summer. The SI model experiences a lower probability from days t=50-150 and a higher probability from t=200-350, and the anapole model is opposite. However this disagrees with the values 
Note: I had to do this with an unnormalized PDF, as the integral function wouldn't work from the notebook for some reason.
End of explanation
"""


# shortcut for scattering models corresponding to rates coded in rate_UV:
anapole_model = dmdd.UV_Model('Anapole', ['mass','sigma_anapole'])
SI_model = dmdd.UV_Model('SI', ['mass','sigma_si'])

print 'model: {}, parameters: {}.'.format(anapole_model.name, anapole_model.param_names)
print 'model: {}, parameters: {}.'.format(SI_model.name, SI_model.param_names)

# intialize an Experiment with XENON target, to be passed to Simulation_AM:

xe = dmdd.Experiment('1xe', 'xenon', 5, 80, 1000, dmdd.eff.efficiency_unit, energy_resolution=True)

xe_lowQ = dmdd.Experiment('1xe', 'xenon', 5, 10, 1000, dmdd.eff.efficiency_unit, energy_resolution=True)

si_PDF = dmdd.Simulation_AM('SI', xe_lowQ, SI_model, 
                        {'mass':50.,'sigma_si':75.5}, Qmin = np.asarray([5.]), 
                        Qmax = np.asarray([10.]), 
                        Tmin = 0, Tmax = 365, sigma_si = 75.5, 
                        element = 'xenon', force_sim = True)

#make cross section particularly large to generate more events
#max pdf value is about 1.74


pdf_list = []
times = np.linspace(0, 365, 366) #365 days to test
#test all days at same energies, where energy = 3
for i,time in enumerate(times):
    value = dmdd.PDF(Q=[5.], time=time, element = 'xenon', mass = 50.,
                                sigma_si= 75.5, sigma_anapole = 0.,
                                Qmin = np.asarray([5.]), Qmax = np.asarray([10.]),
                                Tmin = 0, Tmax = 365)
    pdf_list.append(value)
plt.figure(2)
plt.plot(times, pdf_list)
plt.xlabel("Time in Days")
plt.ylabel("Predicted PDF SI Model")
plt.title("Predicted PDF over Time for SI Model")


#PDF values show correct annual modulation for events over time (not normalized)

anapole_PDF = dmdd.Simulation_AM('Anapole', xe_lowQ, anapole_model, 
                        {'mass':50.,'sigma_anapole':44.25}, Qmin = np.asarray([5.]), 
                        Qmax = np.asarray([10.]), 
                        Tmin = 0, Tmax = 365, sigma_anapole = 44.25, 
                        element = 'xenon', force_sim = True)

#make cross section particularly large to generate more events
#max pdf value is about 1.74

pdf_list = []
times = np.linspace(0, 365, 366) #365 days to test
#test all days at same energies, where energy = 3
for i,time in enumerate(times):
    value = dmdd.PDF(Q=[5.], time=time, element = 'xenon', mass = 50.,
                                sigma_si= 0., sigma_anapole = 44.25,
                                Qmin = np.asarray([5.]), Qmax = np.asarray([10.]),
                                Tmin = 0, Tmax = 365)
    pdf_list.append(value)
plt.figure(2)
plt.plot(times, pdf_list)
plt.xlabel("Time in Days")
plt.ylabel("Predicted PDF")
plt.title("Predicted PDF over Time for Anapole Model")


"""
Explanation: Testing graphing without a normalized PDF function
The following cell tests graphing a theory plot without normalizing the PDF function. If it displays correctly now, then the problem is likely the normalization, not the PDF function or the colormap graph. If it still displays incorrectly, the problem is with the colormap.
End of explanation
"""


