Commit 9504b793 authored by Dave Flogeras's avatar Dave Flogeras
Browse files

Add an option to set spectrogram N-segment.

There is no one size fits all for various sample-rates, so we'll make it
configurable.
parent b1524eeb
...@@ -30,6 +30,10 @@ parser.add_argument( '-b', '--binder-threshold', type=float, ...@@ -30,6 +30,10 @@ parser.add_argument( '-b', '--binder-threshold', type=float,
help='Binder threshold [default=0.02]', default=0.02, help='Binder threshold [default=0.02]', default=0.02,
metavar='threshold' ) metavar='threshold' )
parser.add_argument( '-N', '--spectrogram-nsegment', type=int,
help='Set the segment size, in points, of the spectrogram [default=1024]',
default=1024 )
args = parser.parse_args() args = parser.parse_args()
...@@ -55,7 +59,8 @@ if args.highpass_filter: ...@@ -55,7 +59,8 @@ if args.highpass_filter:
y = scipy.signal.filtfilt( b, a, y ) y = scipy.signal.filtfilt( b, a, y )
f,t,spec = scipy.signal.spectrogram( y, fs, f,t,spec = scipy.signal.spectrogram( y, fs,
noverlap=0.5, nfft=1024, noverlap=0.5,
nperseg=args.spectrogram_nsegment,
mode='magnitude' ) mode='magnitude' )
ax2 = pp.subplot( 312 ) ax2 = pp.subplot( 312 )
ax2.pcolormesh( t,f,spec,shading='auto' ) ax2.pcolormesh( t,f,spec,shading='auto' )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment