In [1]:
import dmdd
import numpy as np
%matplotlib inline


WARNING:root:pymultinest not imported!
WARNING:root:DMDD_MAIN_PATH environment variable not defined, defaulting to:   ~/.dmdd

In [2]:
reload(dmdd)


Out[2]:
<module 'dmdd' from 'dmdd/__init__.pyc'>

This cell demonstrates that dRdQ_AM has the same value as dRdQ at day 0 and day 365, when the v_lag is = 220.


In [6]:
print dmdd.dRdQ_AM(Q = [100.], sigma_si = 75.5)
print dmdd.rate_UV.dRdQ(Q = np.asarray([100.]), sigma_si = 75.5)
print dmdd.dRdQ_AM(Q = [100.], sigma_si = 75.5, time = 365)


[  2.80527965e-17]
[  2.80527965e-17]
[  2.80527965e-17]

This cell demonstates the rate_UV.dRdQ can recieve multiple Qs and return them as an array. The following cell shows the same thing, but for dRdQ_AM.


In [7]:
dmdd.rate_UV.dRdQ(Q = np.array([50., 60., 70., 80., 90., 100.]), sigma_si = 75.5)

# demonstrats that rate_UV.dRdQ can take multiple Q's


Out[7]:
array([  3.41365358e-12,   8.46638177e-13,   1.77757110e-13,
         2.84875973e-14,   2.61626746e-15,   2.80527965e-17])

In [8]:
dmdd.dRdQ_AM(Q = [10., 30., 50., 100.], sigma_si = 75.5, time = 0)
# demonstrates that dRdQ_AM can take multiple Q's as a list


Out[8]:
array([  3.36242431e-10,   3.99546567e-11,   3.41365358e-12,
         2.80527965e-17])

This cell is showing the relative progression of rate over various times for fixed parameters.


In [10]:
print dmdd.dRdQ_AM(Q = [100.], sigma_si = 75.5, time = 50)
print dmdd.dRdQ_AM(sigma_si = 75.5, time = 100)
print dmdd.dRdQ_AM(sigma_si = 75.5, time = 150)
print dmdd.dRdQ_AM(sigma_si = 75.5, time = 200)
print dmdd.dRdQ_AM(sigma_si = 75.5, time = 250)
print dmdd.dRdQ_AM(sigma_si = 75.5, time = 300)
print dmdd.dRdQ_AM(sigma_si = 75.5, time = 350)


[  4.82670411e-17]
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-10-0b423515c327> in <module>()
      1 print dmdd.dRdQ_AM(Q = [100.], sigma_si = 75.5, time = 50)
----> 2 print dmdd.dRdQ_AM(sigma_si = 75.5, time = 100)
      3 print dmdd.dRdQ_AM(sigma_si = 75.5, time = 150)
      4 print dmdd.dRdQ_AM(sigma_si = 75.5, time = 200)
      5 print dmdd.dRdQ_AM(sigma_si = 75.5, time = 250)

/Users/katelynneese/dmddACT/dmdd/dmdd.pyc in dRdQ_AM(mass, sigma_si, sigma_anapole, Q, time, element, vlag_mean, v_amplitude)
     81     #print type(v_lag) #vlag must be a number not an array
     82 
---> 83     rate_QT = rate_UV.dRdQ(Q = energy, v_lag = v_lag, mass = mass, sigma_si = sigma_si, sigma_anapole = sigma_anapole, element = element)
     84 
     85     "Return a 1D array with the rate based on the time and energy given"

rate_UV.pyx in rate_UV.dRdQ (dmdd/rate_UV.c:14430)()

ValueError: Buffer has wrong number of dimensions (expected 1, got 0)

Demonstration of integral function


In [4]:
dmdd.integral(1., 100., 0., 365., sigma_si = 75.5)


Out[4]:
2.9231845333250124e-06

Testing integral function for a known integral with an exact value of 1/6 .


In [3]:
def funct1(Q,time, sigma_si, sigma_anapole, mass, element, v_amplitude):
    return (Q**2)*(time)
#have to define like this due to the way integral is defined, but still returns correct answer

In [4]:
dmdd.integral(0, 1, 0, 1, function = funct1)


Out[4]:
0.16675008341675007

Model and experiment to be used in simulations


In [3]:
# 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)


model: Anapole, parameters: ['mass', 'sigma_anapole'].
model: SI, parameters: ['mass', 'sigma_si'].

In [4]:
# intialize an Experiment with XENON target, to be passed to Simulation_AM:
xe = dmdd.Experiment('1xe', 'xenon', 5, 150, 1000, dmdd.eff.efficiency_unit, energy_resolution=True)

Attempting to run Simulation_AM


In [11]:
xe = dmdd.Simulation_AM('AM_xenon', xe, SI_model, 
                        {'mass':50.,'sigma_si':75}, Qmin = np.asarray([5.]), 
                        Qmax = np.asarray([150.]), 
                        Tmin = 0, Tmax = 365, sigma_si = 75, 
                        element = 'xenon', force_sim = True)


Simulation data and/or pickle file does not exist. Forcing simulation.


---------------------------------------------------------------------------
KeyboardInterrupt                         Traceback (most recent call last)
<ipython-input-11-5729ae255812> in <module>()
      3                         Qmax = np.asarray([150.]),
      4                         Tmin = 0, Tmax = 365, sigma_si = 75,
----> 5                         element = 'xenon', force_sim = True)
      6 
      7 

/Users/katelynneese/dmddACT/dmdd/dmdd.pyc in __init__(self, name, experiment, model, parvals, Qmin, Qmax, element, sigma_si, sigma_anapole, mass, v_amplitude, Tmin, Tmax, path, force_sim, asimov, nbins_asimov, plot_nbins, plot_theory, silent)
   1085                 raise ValueError('Asimov simulations not yet implemented!')
   1086             else:
-> 1087                 Q = self.simulate_data()
   1088                 np.savetxt(self.datafile,Q)
   1089                 fout = open(self.picklefile,'wb')

/Users/katelynneese/dmddACT/dmdd/dmdd.pyc in simulate_data(self)
   1148                 if U < (PDF(Q_rand, T_rand, element = self.element, mass = self.mass,
   1149                                         sigma_si= self.sigma_si, sigma_anapole = self.sigma_anapole,
-> 1150                                         Qmin = np.asarray([self.Qmin]), Qmax = np.asarray([self.Qmax]), Tmin = self.Tmin, Tmax = self.Tmax)/env):
   1151                     #increment matches
   1152                     matches = matches + 1

/Users/katelynneese/dmddACT/dmdd/dmdd.pyc in PDF(Q, time, element, mass, sigma_si, sigma_anapole, Qmin, Qmax, Tmin, Tmax)
    117                     Tmin = Tmin, Tmax = Tmax,
    118                     element = element, sigma_si = sigma_si,
--> 119                     sigma_anapole = sigma_anapole, mass = mass)
    120 
    121     return drdq/norm #for now removed efficiency and made it 1

/Users/katelynneese/dmddACT/dmdd/dmdd.pyc in integral(Qmin, Qmax, Tmin, Tmax, Qpoints, Tpoints, function, sigma_si, sigma_anapole, mass, element, v_amplitude)
    102         for j,T in enumerate(T_box):
    103             a_sum = np.sum(function(Q = np.asarray(Q), time = T, sigma_si = sigma_si, sigma_anapole = sigma_anapole,
--> 104                                     mass = mass, element = element, v_amplitude = v_amplitude))
    105             total_sum.append(a_sum)
    106 

/Users/katelynneese/dmddACT/dmdd/dmdd.pyc in dRdQ_AM(mass, sigma_si, sigma_anapole, Q, time, element, vlag_mean, v_amplitude)
     81     #print type(v_lag) #vlag must be a number not an array
     82 
---> 83     rate_QT = rate_UV.dRdQ(Q = energy, v_lag = v_lag, mass = mass, sigma_si = sigma_si, sigma_anapole = sigma_anapole, element = element)
     84 
     85     "Return a 1D array with the rate based on the time and energy given"

KeyboardInterrupt: 

In [ ]: