Skip to content

Commit

Permalink
Uncomment postprocessing of spectrogram output in lofar function
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrolisboa committed Apr 30, 2020
1 parent 1385a96 commit b5f65fb
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions poseidon/signal/lofar.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import warnings
from __future__ import division
from scipy.signal import decimate, hanning, convolve, spectrogram
import numpy as np
Expand Down Expand Up @@ -51,7 +52,7 @@ def apply_on_spectre(xs):

def lofar(data, fs, n_pts_fft=1024, n_overlap=0,
spectrum_bins_left=None, **tpsw_args):

if not isinstance(data, np.ndarray):
raise NotImplementedError

Expand All @@ -65,15 +66,15 @@ def lofar(data, fs, n_pts_fft=1024, n_overlap=0,
axis=0,
scaling='spectrum',
mode='magnitude')
# power = np.absolute(power)
# power = power / tpsw(power)#, **tpsw_args)
# power = np.log10(power)
# power[power < -0.2] = 0
power = np.absolute(power)
power = power / tpsw(power)#, **tpsw_args)
power = np.log10(power)
power[power < -0.2] = 0

# if spectrum_bins_left is None:
# spectrum_bins_left = power.shape[0]*0.8
# power = power[:spectrum_bins_left, :]
# freq = freq[:spectrum_bins_left]
if spectrum_bins_left is None:
spectrum_bins_left = power.shape[0]*0.8
power = power[:spectrum_bins_left, :]
freq = freq[:spectrum_bins_left]

return np.transpose(power), freq, time

Expand Down

0 comments on commit b5f65fb

Please sign in to comment.