In [6]:
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline

In [ ]:
x = np.linspace(0, 10, 101)*1e-6

In [37]:
length = 10e-6
samplingRate = 1e9
sigma = 10e-7
amp = 1
freq = 1.e6
numPts = np.round(length*samplingRate)
timePts = (1.0/samplingRate)*np.arange(numPts)
realpulse = amp*(np.cos(2*np.pi*timePts*freq)).astype(np.complex)
imagpulse = -1j*amp*(np.sin(2*np.pi*timePts*freq)).astype(np.complex)
plt.plot(timePts, realpulse, timePts, np.imag(imagpulse))


//anaconda/lib/python3.4/site-packages/numpy/core/numeric.py:462: ComplexWarning: Casting complex values to real discards the imaginary part
  return array(a, dtype, copy=False, order=order)
Out[37]:
[<matplotlib.lines.Line2D at 0x107321470>,
 <matplotlib.lines.Line2D at 0x1073217b8>]

In [32]:



//anaconda/lib/python3.4/site-packages/numpy/core/numeric.py:462: ComplexWarning: Casting complex values to real discards the imaginary part
  return array(a, dtype, copy=False, order=order)
Out[32]:
[<matplotlib.lines.Line2D at 0x1061af7f0>]

In [31]:
pulse


Out[31]:
array([ 1.00000000+0.j,  0.99666593+0.j,  0.98668594+0.j, ...,
        0.97012660+0.j,  0.98668594+0.j,  0.99666593+0.j])

In [22]:
np.cos(2.*np.pi*timePts)


Out[22]:
array([ 1.,  1.,  1., ...,  1.,  1.,  1.])

In [30]:
timePts


Out[30]:
array([  0.00000000e+00,   1.00000000e-09,   2.00000000e-09, ...,
         9.99700000e-06,   9.99800000e-06,   9.99900000e-06])

In [ ]: