@@ -233,7 +233,7 @@ def extractRidges(self, parThresh=4, parMinD=3):
233
233
234
234
# Extract ridges
235
235
print ('Extracting ridges' )
236
- self .ridges = _extractRidges (self .S0 [:int ( self .Nfft / 2 ) , :], parThresh , parMinD )
236
+ self .ridges = _extractRidges (self .S0 [:self .Nfft // 2 , :], parThresh , parMinD )
237
237
238
238
239
239
def plotStokes (self , cmocean = False ):
@@ -259,10 +259,10 @@ def plotStokes(self, cmocean=False):
259
259
N = np .size (self .t )
260
260
fig , ax = plt .subplots (ncols = 3 , figsize = (12 , 5 ), sharey = True )
261
261
262
- im0 = ax [0 ].imshow (self .S1n [:int ( self .Nfft / 2 ) , :], origin = 'lower' , interpolation = 'none' , aspect = 'auto' ,cmap = cmap , extent = [int (self .t .min ()), int (self .t .max ()), 0 , self .f [int ( self .Nfft / 2 - 1 ) ]], vmin = - 1 , vmax = + 1 )
262
+ im0 = ax [0 ].imshow (self .S1n [:self .Nfft // 2 , :], origin = 'lower' , interpolation = 'none' , aspect = 'auto' ,cmap = cmap , extent = [int (self .t .min ()), int (self .t .max ()), 0 , self .f [self .Nfft // 2 - 1 ]], vmin = - 1 , vmax = + 1 )
263
263
264
- im1 = ax [1 ].imshow (self .S2n [:int ( self .Nfft / 2 ) , :], origin = 'lower' , interpolation = 'none' , aspect = 'auto' ,cmap = cmap , extent = [int (self .t .min ()), int (self .t .max ()), 0 , self .f [int ( self .Nfft / 2 - 1 ) ]], vmin = - 1 , vmax = + 1 )
265
- im2 = ax [2 ].imshow (self .S3n [:int ( self .Nfft / 2 ) , :], origin = 'lower' , interpolation = 'none' , aspect = 'auto' ,cmap = cmap , extent = [int (self .t .min ()), int (self .t .max ()), 0 , self .f [int ( self .Nfft / 2 - 1 ) ]], vmin = - 1 , vmax = + 1 )
264
+ im1 = ax [1 ].imshow (self .S2n [:self .Nfft // 2 , :], origin = 'lower' , interpolation = 'none' , aspect = 'auto' ,cmap = cmap , extent = [int (self .t .min ()), int (self .t .max ()), 0 , self .f [self .Nfft // 2 - 1 ]], vmin = - 1 , vmax = + 1 )
265
+ im2 = ax [2 ].imshow (self .S3n [:self .Nfft // 2 , :], origin = 'lower' , interpolation = 'none' , aspect = 'auto' ,cmap = cmap , extent = [int (self .t .min ()), int (self .t .max ()), 0 , self .f [self .Nfft // 2 - 1 ]], vmin = - 1 , vmax = + 1 )
266
266
267
267
# adjust figure
268
268
fig .subplots_adjust (left = 0.05 , top = 0.8 , right = 0.99 , wspace = 0.05 )
@@ -340,10 +340,10 @@ def plotRidges(self, quivertdecim=10, cmocean=False):
340
340
341
341
N = np .size (self .t )
342
342
fig , ax = plt .subplots (ncols = 3 , figsize = (12 , 5 ), sharey = True )
343
- im0 = ax [0 ].imshow (self .S0 [:int ( self .Nfft / 2 ) , :], interpolation = 'none' , origin = 'lower' , aspect = 'auto' ,cmap = cmap_S0 , extent = [int (self .t .min ()), int (self .t .max ()), 0 , self .f [int ( self .Nfft / 2 - 1 ) ]])
343
+ im0 = ax [0 ].imshow (self .S0 [:self .Nfft // 2 , :], interpolation = 'none' , origin = 'lower' , aspect = 'auto' ,cmap = cmap_S0 , extent = [int (self .t .min ()), int (self .t .max ()), 0 , self .f [self .Nfft // 2 - 1 ]])
344
344
345
345
346
- im1 = ax [1 ].quiver (self .t [::int (self .spacing )][::quivertdecim ], self .f [:int (self .Nfft / 2 )], np .real (ori [:int ( self .Nfft / 2 ) , ::quivertdecim ]), (np .imag (ori [:int ( self .Nfft / 2 ) , ::quivertdecim ])), theta [:int ( self .Nfft / 2 ) , ::quivertdecim ], clim = [- np .pi / 2 , np .pi / 2 ], cmap = cmap_theta , headaxislength = 0 ,headlength = 0.001 , pivot = 'middle' ,width = 0.005 , scale = 15 )
346
+ im1 = ax [1 ].quiver (self .t [::int (self .spacing )][::quivertdecim ], self .f [:int (self .Nfft / 2 )], np .real (ori [:self .Nfft // 2 , ::quivertdecim ]), (np .imag (ori [:self .Nfft // 2 , ::quivertdecim ])), theta [:self .Nfft // 2 , ::quivertdecim ], clim = [- np .pi / 2 , np .pi / 2 ], cmap = cmap_theta , headaxislength = 0 ,headlength = 0.001 , pivot = 'middle' ,width = 0.005 , scale = 15 )
347
347
348
348
for r in self .ridges :
349
349
points = np .array ([self .t [::self .spacing ][r [1 ]], self .f [r [0 ]]]).T .reshape (- 1 , 1 , 2 )
@@ -371,7 +371,6 @@ def plotRidges(self, quivertdecim=10, cmocean=False):
371
371
cbar1 .ax .xaxis .set_ticks_position ('top' )
372
372
373
373
cbarax2 = fig .add_axes ([0.686 , 0.83 , 0.303 , 0.03 ])
374
- print ("-----Bug line im2-----\n {0}" .format (im2 ))
375
374
cbar2 = fig .colorbar (im2 , cax = cbarax2 , ticks = [- np .pi / 4 , 0 , np .pi / 4 ], orientation = 'horizontal' )
376
375
cbar2 .ax .set_xticklabels ([r'$-\frac{\pi}{4}$' , r'$0$' , r'$\frac{\pi}{4}$' ])
377
376
cbar2 .ax .xaxis .set_ticks_position ('top' )
@@ -384,7 +383,7 @@ def plotRidges(self, quivertdecim=10, cmocean=False):
384
383
ax [0 ].set_ylabel ('Frequency [Hz]' )
385
384
386
385
ax [0 ].set_title ('Time-Frequency energy density' , y = 1.14 )
387
-
386
+
388
387
ax [1 ].set_title ('Instantaneous orientation' , y = 1.14 )
389
388
ax [2 ].set_title ('Instantaneous ellipticity' , y = 1.14 )
390
389
0 commit comments