In [1]:
from pylayers.measures.vna.E5072A import *
from pylayers.measures.exploith5 import *
from matplotlib import cm
from numpy.fft import * 
from pylayers.antprop.aarray import *
%matplotlib inline

In [2]:
M=Mesh5()

In [3]:
M.dir()


mes_8_4_15janv.h5
mes_4_8.h5
measDec.h5
MIMO_8_4_14janv_V2.h5
mesMIMO_4_8.h5
calMIMO.h5
mimocal.h5
mimocal8_4_V1.h5
calMIMO_4_8.h5
mesMIMO.h5

In [4]:
M = Mesh5('mesMIMO.h5')

In [12]:
M.read(1,ix=[0,0,0,0])

In [16]:
%matplotlib notebook
M.mes.plot()


The second measurement run has been done on 18 January by mamadou. It corresponds to a displacement along the 'x' axis with 10 measurement different location. The MIMO configuration was 4x8. The transmitting antenna center was [1.6,5.2,1.6] and the orientation along the x axis. The calibration set was 3, correseponding to 1000Hz for IF and Np = 801.


In [6]:
for r in range(4):
    for t in range(8):
        M.read(1,ix=[0, 0, 0, 0],calibrate=True)
        C11=Tchannel()
        C11.y  = M.mes.y[0,r,t,:]
        C11.x  = M.mes.x
        C11.plot(typ=['l20'])


/home/uguen/anaconda/lib/python2.7/site-packages/matplotlib/pyplot.py:516: RuntimeWarning: More than 20 figures have been opened. Figures created through the pyplot interface (`matplotlib.pyplot.figure`) are retained until explicitly closed and may consume too much memory. (To control this warning, see the rcParam `figure.max_open_warning`).
  max_open_warning, RuntimeWarning)

In [9]:
M


Out[9]:
-------------------------------------
              Parameters             
-------------------------------------
Directory  : /home/mbalde/Pylayers_project/meas/mes_8_4_15janv.h5
-------------------------------------
Index : [0, 0, 0, 0]
Position : [ 0.  0.  0.]

 Measurement calibrated : Yes
cal1

		1	1.8	2.2	Fri Jan 15 17:36:49 2016	Mamadou	['CN27' 'CN29' 'RF-OPT' 'OPT-RF' 'CN3']	MIMO calibration RF-OPT  801 pt	S21	8	4	100	MIMO_8_4_14janv_V2	1	201	1000	16	

		10	1.8	2.2	Fri Jan 15 17:36:24 2016	Mamadou	['CN27' 'CN29' 'RF-OPT' 'OPT-RF' 'CN3']	MIMO calibration RF-OPT  801 pt	S21	8	4	100	MIMO_8_4_14janv_V2	1	201	300000	16	

		11	1.8	2.2	Fri Jan 15 17:36:12 2016	Mamadou	['CN27' 'CN29' 'RF-OPT' 'OPT-RF' 'CN3']	MIMO calibration RF-OPT  801 pt	S21	8	4	100	MIMO_8_4_14janv_V2	1	401	300000	16	

		12	1.8	2.2	Fri Jan 15 17:36:37 2016	Mamadou	['CN27' 'CN29' 'RF-OPT' 'OPT-RF' 'CN3']	MIMO calibration RF-OPT  801 pt	S21	8	4	100	MIMO_8_4_14janv_V2	1	801	300000	16	

		2	1.8	2.2	Fri Jan 15 17:37:14 2016	Mamadou	['CN27' 'CN29' 'RF-OPT' 'OPT-RF' 'CN3']	MIMO calibration RF-OPT  801 pt	S21	8	4	100	MIMO_8_4_14janv_V2	1	401	1000	16	

		3	1.8	2.2	Fri Jan 15 17:37:02 2016	Mamadou	['CN27' 'CN29' 'RF-OPT' 'OPT-RF' 'CN3']	MIMO calibration RF-OPT  801 pt	S21	8	4	100	MIMO_8_4_14janv_V2	1	801	1000	16	

		4	1.8	2.2	Fri Jan 15 17:37:40 2016	Mamadou	['CN27' 'CN29' 'RF-OPT' 'OPT-RF' 'CN3']	MIMO calibration RF-OPT  801 pt	S21	8	4	100	MIMO_8_4_14janv_V2	1	201	70000	16	

		5	1.8	2.2	Fri Jan 15 17:37:27 2016	Mamadou	['CN27' 'CN29' 'RF-OPT' 'OPT-RF' 'CN3']	MIMO calibration RF-OPT  801 pt	S21	8	4	100	MIMO_8_4_14janv_V2	1	401	70000	16	

		6	1.8	2.2	Fri Jan 15 17:38:06 2016	Mamadou	['CN27' 'CN29' 'RF-OPT' 'OPT-RF' 'CN3']	MIMO calibration RF-OPT  801 pt	S21	8	4	100	MIMO_8_4_14janv_V2	1	801	70000	16	

		7	1.8	2.2	Fri Jan 15 17:37:53 2016	Mamadou	['CN27' 'CN29' 'RF-OPT' 'OPT-RF' 'CN3']	MIMO calibration RF-OPT  801 pt	S21	8	4	100	MIMO_8_4_14janv_V2	1	201	100000	16	

		8	1.8	2.2	Fri Jan 15 17:38:31 2016	Mamadou	['CN27' 'CN29' 'RF-OPT' 'OPT-RF' 'CN3']	MIMO calibration RF-OPT  801 pt	S21	8	4	100	MIMO_8_4_14janv_V2	1	401	100000	16	

		9	1.8	2.2	Fri Jan 15 17:38:18 2016	Mamadou	['CN27' 'CN29' 'RF-OPT' 'OPT-RF' 'CN3']	MIMO calibration RF-OPT  801 pt	S21	8	4	100	MIMO_8_4_14janv_V2	1	801	100000	16	

mes10
 time : Mon Jan 18 17:22:23 2016
 author : mamadou
 comment : measurement of MIMO 8X4 70cm over X
 axes : []
 axesn : []
 nr : 4
 nt : 8
 nmeas : 1
 pant : [ 1.6  5.2  1.6]
 vant : [ 1.  0.  0.]
 gcal : cal1
 ical : 3

mes11
 time : Mon Jan 18 17:25:57 2016
 author : mamadou
 comment : measurement of MIMO 8X4 70cm over X
 axes : []
 axesn : []
 nr : 4
 nt : 8
 nmeas : 1
 pant : [ 1.6  5.2  1.6]
 vant : [ 1.  0.  0.]
 gcal : cal1
 ical : 3

mes12
 time : Mon Jan 18 17:28:15 2016
 author : mamadou
 comment : measurement of MIMO 8X4 70cm over X
 axes : []
 axesn : []
 nr : 1
 nt : 1
 nmeas : 1
 pant : [ 1.6  5.2  1.6]
 vant : [ 1.  0.  0.]
 gcal : cal1
 ical : 3

mes13
 time : Mon Jan 18 17:40:56 2016
 author : mamadou
 comment : measurement of MIMO 8X4 70cm over X
 axes : []
 axesn : []
 nr : 1
 nt : 1
 nmeas : 1
 pant : [ 1.6  5.2  1.6]
 vant : [ 1.  0.  0.]
 gcal : cal1
 ical : 3

mes14
 time : Mon Jan 18 17:43:30 2016
 author : mamadou
 comment : measurement of MIMO 8X4 70cm over X
 axes : []
 axesn : []
 nr : 1
 nt : 1
 nmeas : 1
 pant : [ 1.6  5.2  1.6]
 vant : [ 1.  0.  0.]
 gcal : cal1
 ical : 3

mes15
 time : Mon Jan 18 17:45:45 2016
 author : mamadou
 comment : measurement of MIMO 8X4 70cm over X
 axes : []
 axesn : []
 nr : 1
 nt : 1
 nmeas : 100
 pant : [ 1.6  5.2  1.6]
 vant : [ 1.  0.  0.]
 gcal : cal1
 ical : 3

mes2
 time : Mon Jan 18 09:41:52 2016
 author : mamadou
 comment : test
 axes : ['x']
 axesn : [10]
 nr : 4
 nt : 8
 nmeas : 1
 pant : [ 1.6  5.2  1.6]
 vant : [ 1.  0.  0.]
 gcal : cal1
 ical : 3

mes3
 time : Mon Jan 18 15:52:04 2016
 author : mamadou
 comment : measurement of MIMO 8X4 70cm over X
 axes : ['x']
 axesn : [10]
 nr : 4
 nt : 8
 nmeas : 1
 pant : [ 1.6  5.2  1.6]
 vant : [ 1.  0.  0.]
 gcal : cal1
 ical : 3

mes4
 time : Mon Jan 18 16:43:15 2016
 author : mamadou
 comment : measurement of MIMO 8X4 70cm over X
 axes : []
 axesn : []
 nr : 4
 nt : 8
 nmeas : 1
 pant : [ 1.6  5.2  1.6]
 vant : [ 1.  0.  0.]
 gcal : cal1
 ical : 3

mes5
 time : Mon Jan 18 16:48:36 2016
 author : mamadou
 comment : measurement of MIMO 8X4 70cm over X
 axes : []
 axesn : []
 nr : 4
 nt : 8
 nmeas : 1
 pant : [ 1.6  5.2  1.6]
 vant : [ 1.  0.  0.]
 gcal : cal1
 ical : 12

mes6
 time : Mon Jan 18 16:50:41 2016
 author : mamadou
 comment : measurement of MIMO 8X4 70cm over X
 axes : []
 axesn : []
 nr : 4
 nt : 8
 nmeas : 1
 pant : [ 1.6  5.2  1.6]
 vant : [ 1.  0.  0.]
 gcal : cal1
 ical : 12

mes7
 time : Mon Jan 18 16:57:20 2016
 author : mamadou
 comment : measurement of MIMO 8X4 70cm over X
 axes : []
 axesn : []
 nr : 4
 nt : 8
 nmeas : 1
 pant : [ 1.6  5.2  1.6]
 vant : [ 1.  0.  0.]
 gcal : cal1
 ical : 3

mes8
 time : Mon Jan 18 16:58:42 2016
 author : mamadou
 comment : measurement of MIMO 8X4 70cm over X
 axes : []
 axesn : []
 nr : 4
 nt : 8
 nmeas : 1
 pant : [ 1.6  5.2  1.6]
 vant : [ 1.  0.  0.]
 gcal : cal1
 ical : 3

mes9
 time : Mon Jan 18 17:02:29 2016
 author : mamadou
 comment : measurement of MIMO 8X4 70cm over X
 axes : []
 axesn : []
 nr : 4
 nt : 8
 nmeas : 1
 pant : [ 1.6  5.2  1.6]
 vant : [ 1.  0.  0.]
 gcal : cal1
 ical : 3

In [32]:
M.read(6,ix=[0, 0, 0, 0])

C22=Tchannel()
C22.y  = M.mes.y[0,1,1,:]
C22.x  = M.mes.x

In [25]:
#C22.plot(typ=['l20'])


Out[25]:
(<matplotlib.figure.Figure at 0x7f7eadd7d150>,
 array([[<matplotlib.axes._subplots.AxesSubplot object at 0x7f7eadd9db10>]], dtype=object))

In [14]:
C11.plot(typ=['l20'])


Out[14]:
(<matplotlib.figure.Figure at 0x7f6622f9a810>,
 array([[<matplotlib.axes._subplots.AxesSubplot object at 0x7f662884c390>]], dtype=object))

In [7]:
c11=C11.ift(ffts=1)


---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-7-6a8115706810> in <module>()
----> 1 c11=C11.ift(ffts=1)

/home/uguen/Documents/rch/devel/pylayers/pylayers/signal/bsignal.pyc in ift(self, Nz, ffts)
   3182         else:
   3183             #UH = self.symHz(Nz,scale='cir')
-> 3184             UH = self.symHz(Nz,scale='extract')
   3185         # Back in time
   3186         # UH is an FHsignal

/home/uguen/Documents/rch/devel/pylayers/pylayers/signal/bsignal.pyc in symHz(self, Nz, scale)
   3075             else:
   3076                 zh = np.zeros(Nz)
-> 3077                 UZ = np.concatenate((U, zh), 1)
   3078                 UZF = np.flipud(np.conjugate(UZ))
   3079         #

IndexError: axis 1 out of bounds [0, 1)

In [11]:
c11.plot(typ=['v'])
plt.xlim(0,50)
#plt.ylim(-160,-40)


Out[11]:
(0, 50)

In [7]:
f,a=M.mes.plot()


---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-8-622e184346c8> in <module>()
----> 1 f,a=M.mes.plot()

TypeError: 'NoneType' object is not iterable
Traceback (most recent call last):

  File "/home/uguen/anaconda/lib/python2.7/site-packages/ipykernel/ipkernel.py", line 175, in do_execute
    shell.run_cell(code, store_history=store_history, silent=silent)

  File "/home/uguen/anaconda/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 2729, in run_cell
    self.events.trigger('post_execute')

  File "/home/uguen/anaconda/lib/python2.7/site-packages/IPython/core/events.py", line 74, in trigger
    func(*args, **kwargs)

  File "/home/uguen/anaconda/lib/python2.7/site-packages/ipykernel/pylab/backend_inline.py", line 113, in flush_figures
    return show(True)

  File "/home/uguen/anaconda/lib/python2.7/site-packages/ipykernel/pylab/backend_inline.py", line 42, in show
    matplotlib.pyplot.close('all')

  File "/home/uguen/anaconda/lib/python2.7/site-packages/matplotlib/pyplot.py", line 641, in close
    _pylab_helpers.Gcf.destroy_all()

  File "/home/uguen/anaconda/lib/python2.7/site-packages/matplotlib/_pylab_helpers.py", line 96, in destroy_all
    gc.collect(1)

KeyboardInterrupt

In [18]:
del TD
for  k in range(1):
    M.read(6,ix=[k,0,0,0,0])
    try:
        TD = np.concatenate((TD,M.mes.y),axis=0)
    except:
        TD = M.mes.y

In [19]:
C11=Tchannel()
C11.y  = TD[:,2,2,:]
C11.x  = M.mes.x

In [20]:
TD.shape


Out[20]:
(1, 4, 8, 801)

In [21]:
C11.y.shape


Out[21]:
(1, 801)

In [22]:
fig=plt.figure(figsize=(20,10))
U=C11.plot(iy=-1,figsize=(20,20))


<matplotlib.figure.Figure at 0x7fa632820c10>

In [24]:
plt.figure(figsize=(10,10))
for t in range(1):
    u = 10*np.log10(np.abs(C11.y[t,:]))
    plt.plot(M.mes.x,u)



In [18]:
type(M.mes)


Out[18]:
pylayers.antprop.channel.Tchannel

In [64]:
TD.shape


Out[64]:
(10, 4, 8, 801)

In [25]:
fGHz = M.mes.x

In [26]:
df=fGHz[1]-fGHz[0]

In [27]:
t = np.linspace(-1/(2*df),1/(2*df),len(fGHz))

In [79]:



Out[79]:
2000.0

In [29]:
plt.figure(figsize=(10,10))
U=fftshift(fft(np.conj(TD[:,3,7,:]),axis=1))
for k in range(1):
    plt.plot(np.abs(U[k,:]),'o-')
    plt.xlim(400,500)



In [91]:
TD.shape


Out[91]:
(10, 4, 8, 801)

In [97]:
plt.subplot?

In [30]:
imin=400
imax=460
k = 0 
plt.figure(figsize=(20,15))
for ir in range(4):
    for it in range(8):
        k = k+1
        U=fftshift(fft(np.conj(TD[:,ir,it,:]),axis=1))
        #
        plt.subplot(4,8,k)
        plt.imshow(10*np.log10(np.abs(U[:,imin:imax])),interpolation='nearest',extent=[t[imin],t[imax],-0.35,0.35],cmap=cm.jet)
        plt.axis('auto')
plt.tight_layout()
plt.colorbar()


Out[30]:
<matplotlib.colorbar.Colorbar instance at 0x7fa62bb2f3f8>

In [80]:
plt.imshow?

In [78]:
plt.plot(fftshift(np.abs(U[0,:])))
plt.xlim(300,500)


Out[78]:
(300, 500)

In [22]:
plt.imshow(np.abs(fftshift(U,axis=1))[350:450,:])


---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-22-ce30ec290d8f> in <module>()
----> 1 plt.imshow(np.abs(fftshift(U,axis=1))[350:450,:])

TypeError: fftshift() got an unexpected keyword argument 'axis'

In [ ]:
M.plot(cmd='ir')

In [114]:
from  pylayers.antprop.aarray import  *
A1 = AntArray(N=[100,1,1,1],min=[-0.035,0,0,0],max=[0.035,0,0,0])

In [115]:
A1


Out[115]:
Antenna Array : 
Arrayof Gauss
N : [100   1   1   1]
dm : [ 0.00070707  0.          0.          0.        ]
Antenna type : Array
------------------------
 Sc : []
fmin : 2.40GHz
fmax : 2.40GHz
step : None
Nf : 1
-----------------------
      evaluated        
-----------------------
Ntheta : 90
Nphi : 181
   f = 2.40 GHz 
   theta = 88.99 (degrees) 
   phi = 0.00  (degrees) 

In [117]:
A1.p.shape


Out[117]:
(3, 100)

In [120]:
A1 = AntArray(N=[100,1,1,1],max=[0.035,0,0,0],min=[-0.035,0,0,0],mode='grid')

In [122]:
A1.p


Out[122]:
array([[-0.035     , -0.03429293, -0.03358586, -0.03287879, -0.03217172,
        -0.03146465, -0.03075758, -0.03005051, -0.02934343, -0.02863636,
        -0.02792929, -0.02722222, -0.02651515, -0.02580808, -0.02510101,
        -0.02439394, -0.02368687, -0.0229798 , -0.02227273, -0.02156566,
        -0.02085859, -0.02015152, -0.01944444, -0.01873737, -0.0180303 ,
        -0.01732323, -0.01661616, -0.01590909, -0.01520202, -0.01449495,
        -0.01378788, -0.01308081, -0.01237374, -0.01166667, -0.0109596 ,
        -0.01025253, -0.00954545, -0.00883838, -0.00813131, -0.00742424,
        -0.00671717, -0.0060101 , -0.00530303, -0.00459596, -0.00388889,
        -0.00318182, -0.00247475, -0.00176768, -0.00106061, -0.00035354,
         0.00035354,  0.00106061,  0.00176768,  0.00247475,  0.00318182,
         0.00388889,  0.00459596,  0.00530303,  0.0060101 ,  0.00671717,
         0.00742424,  0.00813131,  0.00883838,  0.00954545,  0.01025253,
         0.0109596 ,  0.01166667,  0.01237374,  0.01308081,  0.01378788,
         0.01449495,  0.01520202,  0.01590909,  0.01661616,  0.01732323,
         0.0180303 ,  0.01873737,  0.01944444,  0.02015152,  0.02085859,
         0.02156566,  0.02227273,  0.0229798 ,  0.02368687,  0.02439394,
         0.02510101,  0.02580808,  0.02651515,  0.02722222,  0.02792929,
         0.02863636,  0.02934343,  0.03005051,  0.03075758,  0.03146465,
         0.03217172,  0.03287879,  0.03358586,  0.03429293,  0.035     ],
       [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
         0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
         0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
         0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
         0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
         0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
         0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
         0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
         0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
         0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
         0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
         0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
         0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
         0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
         0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
         0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
         0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
         0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
         0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
         0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
       [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
         0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
         0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
         0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
         0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
         0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
         0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
         0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
         0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
         0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
         0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
         0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
         0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
         0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
         0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
         0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
         0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
         0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
         0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
         0.        ,  0.        ,  0.        ,  0.        ,  0.        ]])

In [12]:
A1 = AntArray(N=[1000,1,1,1],max=[0.35,0,0,0],min=[-0.35,0,0,0],mode='grid')

In [15]:
A1.p.shape


Out[15]:
(3, 1000)

In [36]:
from numpy.linalg import svd
def sing_values():
    ir = 4
    it = 8
    npos = 5
    cpt = 0
    ipos = 6

    M = Mesh5('mesMIMO.h5')
    for  k in range(npos):
        M.read(ipos,ix=[k,0,0,0,0])
        try:
            TD = np.concatenate((TD,M.mes.y),axis=0)
        except:
            TD = M.mes.y
    fGHz = M.mes.x
    #M.read(2,ix=[99, 0, 0, 0])
    # TD.shape : (100, 4, 8, 801)
    TDm = np.sum(np.abs(TD),axis=0)/npos # mean of TD ; TDm.shape : (4, 8, 801)
    TDc = np.abs(TD)-TDm[None,...] # TD centered      ; TDc.shape : (85, 4, 8, 801)
    TDc2 = np.abs(TDc)**2 # square of TD centered     ; TDc2.shape : (85, 4, 8, 801)
    varTD = np.sum(TDc2,axis=0)/npos #variance of TD  ; varTD.shape : (4, 8, 801)

    # Friis formula with gain antenna around 12dB
    FS = -(32.4+20*np.log10(fGHz)+20*np.log10(5.435))+12

    #Singular values of the channel matrix
    TDs = np.swapaxes(TD,1,3)
    TDss = np.swapaxes(TDs,2,3)
    U,S,V= svd(TDss)
    
    #M.read(2,ix=[1, 0, 0, 0])

    for  k in range(npos):
        M.read(ipos,ix=[k,0,0,0,0])
        try:
            TD = np.concatenate((TD,M.mes.y),axis=0)
        except:
            TD = M.mes.y
    fGHz = M.mes.x

    sns.set_style("darkgrid")
    plt.ion()
    mu0  = np.mean(S[:npos,:,0],axis=0)
    mu1  = np.mean(S[:npos,:,1],axis=0)
    mu2  = np.mean(S[:npos,:,2],axis=0)
    mu3  = np.mean(S[:npos,:,3],axis=0)
    s0 = np.sqrt(np.mean((S[:npos,:,0]-mu0[None,:])**2,axis=0))
    s1 = np.sqrt(np.mean((S[:npos,:,1]-mu1[None,:])**2,axis=0))
    s2 = np.sqrt(np.mean((S[:npos,:,2]-mu2[None,:])**2,axis=0))
    s3 = np.sqrt(np.mean((S[:npos,:,3]-mu3[None,:])**2,axis=0))
    for k in range(npos):
        #First singular value
        plt.semilogy(fGHz,S[k,:,0],color='k',linewidth=.1)
        plt.semilogy(fGHz,mu0+1.96*s0,color='k',linewidth=1)
        plt.semilogy(fGHz,mu0-1.96*s0,color='k',linewidth=1)
        plt.semilogy(fGHz,mu0,color='k',marker='o',markevery=10,ms=3)

        #Second singular value
        plt.semilogy(fGHz,S[k,:,1],color='g',linewidth=.1)
        plt.semilogy(fGHz,mu1+1.96*s1,color='g',linewidth=1)
        plt.semilogy(fGHz,mu1-1.96*s1,color='g',linewidth=1)
        plt.semilogy(fGHz,mu1,color='k',marker='4',markevery=10,ms=3)

        #Third singular value
        plt.semilogy(fGHz,S[k,:,2],color='#ff4500',linewidth=.1)
        plt.semilogy(fGHz,mu2+1.96*s2,color='#ff4500',linewidth=1)
        plt.semilogy(fGHz,mu2-1.96*s2,color='#ff4500',linewidth=1)
        plt.semilogy(fGHz,mu2,color='k',marker='3',markevery=10,ms=3)

        #Fourth singular value
        plt.semilogy(fGHz,S[k,:,3],color='b',linewidth=.1)
        plt.semilogy(fGHz,mu3+1.96*s3,color='b',linewidth=1)
        plt.semilogy(fGHz,mu3-1.96*s3,color='b',linewidth=1)
        plt.semilogy(fGHz,mu3,color='k',marker='s',markevery=10,ms=3)

    plt.title(r'Evolution of singular values of the matrix $\mathbf{H}_{ij}(f)$ along a $\Delta_x=0.7m$',fontsize=14)
    plt.ylabel('Module (linear scale $\in [0,1]$)',fontsize=14)
    plt.xlabel('Frequency (GHz)',fontsize=14)
    plt.xlim(1.8,2.2)
    plt.legend(loc='best')
    plt.tight_layout()
    #plt.savefig('fig4.png')

In [37]:
%matplotlib inline
plt.figure(figsize=(10,10))
sing_values()



In [ ]: