In [1]:
import sys
sys.path.append("..")
import splitwavepy as sw

import scipy
import numpy as np
import matplotlib.pyplot as plt

In [2]:
def window_scan(pair,widths,offsets,**kwargs):
    """
    Returns a list of EigenM measurements.
    
    trials all combinations of *offsets* and *widths* windows
    """    
    
    if not isinstance(pair,sw.Pair):
        raise Exception('pair must be a Pair')
        
    if not isinstance(offsets,np.ndarray):
        raise Exception('offsets must be a numpy.array')
    
    if not isinstance(widths,np.ndarray):
        raise Exception('widths must be a numpy.ndarray')
    
    # populate a lis of measurements
    listM=[]
    for w in widths:
        for o in offsets:
            listM.append(sw.EigenM(pair,window=sw.Window(w,o,**kwargs)))
            
    return listM

In [3]:
p = sw.Pair(fast=45,lag=2.3,delta=0.1)

In [4]:
widths = np.arange(51,151,25)
offsets = np.arange(-40,60,20)

In [5]:
listM = window_scan(p,widths,offsets)

In [6]:
import matplotlib.gridspec as gridspec

fig = plt.figure(figsize=(12,6)) 
nwid = widths.size
noff = offsets.size
gs = gridspec.GridSpec(nwid,noff)
v = np.linspace(0, 50, 26, endpoint=True)

for ii in range(nwid):
    for jj in range(noff):
        ax = plt.subplot(gs[ii,jj])
        m = listM[ii*noff+jj]
        ax.contourf(m.tlags,m.degs,m.lam1/m.lam2,v,cmap='magma',extend='max')

plt.show()


/Users/glyjw/anaconda/envs/py35/lib/python3.5/site-packages/numpy/ma/core.py:6385: MaskedArrayFutureWarning: In the future the default for ma.minimum.reduce will be axis=0, not the current None, to match np.minimum.reduce. Explicitly pass 0 or None to silence this warning.
  return self.reduce(a)
/Users/glyjw/anaconda/envs/py35/lib/python3.5/site-packages/numpy/ma/core.py:6385: MaskedArrayFutureWarning: In the future the default for ma.maximum.reduce will be axis=0, not the current None, to match np.maximum.reduce. Explicitly pass 0 or None to silence this warning.
  return self.reduce(a)

In [7]:
stkm = sw.eigval.stack(listM)


---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-7-63e54c0b3bef> in <module>()
----> 1 stkm = sw.eigval.stack(listM)

TypeError: 'module' object is not callable

In [ ]:
nwid = widths.size
noff = offsets.size

In [ ]:
for ii in range(nwid):
    for jj in range(noff):
#         print(ii*nwid)
#         print(jj*noff)
        print(ii,jj,ii*noff + jj)

In [ ]: