In [2]:
import sys
sys.path.append("..")
import splitwavepy as s

import scipy
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
from scipy import stats

In [3]:
p = s.Pair()

In [4]:
p.split(30,8)
p.plot()



In [5]:
scipy.stats.spearmanr(p.data[0],p.data[1])


Out[5]:
SpearmanrResult(correlation=-0.12861787149048864, pvalue=0.0042308003499197579)

In [6]:
scipy.stats.spearmanr(p.data[1],p.data[1])


Out[6]:
SpearmanrResult(correlation=1.0, pvalue=0.0)

In [14]:
w = signal.ricker(500,12)
# signal.minimum_phase?

In [15]:
plt.plot(w)
plt.show()



In [17]:
m = signal.minimum_phase(w)

In [18]:
plt.plot(m)
plt.show()



In [21]:
signal.resample?

In [23]:
M = np.fft.fft(m)

In [25]:
plt.plot(M)
plt.show(M.imag)


/Users/glyjw/anaconda/envs/py35/lib/python3.5/site-packages/numpy/core/numeric.py:531: ComplexWarning: Casting complex values to real discards the imaginary part
  return array(a, dtype, copy=False, order=order)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-25-d0518a271428> in <module>()
      1 plt.plot(M)
----> 2 plt.show(M.imag)

/Users/glyjw/anaconda/envs/py35/lib/python3.5/site-packages/matplotlib/pyplot.py in show(*args, **kw)
    250     """
    251     global _show
--> 252     return _show(*args, **kw)
    253 
    254 

/Users/glyjw/anaconda/envs/py35/lib/python3.5/site-packages/ipykernel/pylab/backend_inline.py in show(close, block)
     39         # only call close('all') if any to close
     40         # close triggers gc.collect, which can be slow
---> 41         if close and Gcf.get_all_fig_managers():
     42             matplotlib.pyplot.close('all')
     43 

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

In [34]:
fig, ax = plt.subplots(nrows=1,ncols=4)
W = np.fft.fft(w)
ax[0].plot(w)
ax[0].set_title('Time domain Signal')
ax[1].plot(np.abs(W)**2)
ax[1].set_title('Power Spectrum')
ax[2].plot(np.abs(W))
ax[2].set_title('Amplitude Spectrum')
ax[3].plot(np.angle(W))
ax[3].set_title('Phase Spectrum')
plt.show()



In [33]:
np.fft?

In [36]:
signal.wiener?

In [48]:
def test(*args,**kwargs):
    for x in kwargs:
        print(kwargs[x])

In [49]:
test(z='monkey')


monkey

In [41]:
A = {'monkey':'willy'}

In [42]:
A


Out[42]:
{'monkey': 'willy'}

In [45]:
A?

In [ ]: