So we can import the package in the usual way, use setup.py
development mode. Here we are following directions here. In the base directory, run:
find . -name '*.pyc' -delete
python setup.py develop
We should now be able to import parts of the package in the usual way using an import statement
In [1]:
from freqdemod.demodulate import Signal
Execute the the first line below if you want the plots to show inline. If instead you want each plot to display in a separate pop-up window, then don't execute the first line. Set up plotting defaults so the plots will look nice inline:
In [7]:
%matplotlib inline
import numpy as np
import matplotlib.pylab as plt
font = {'family' : 'serif',
'weight' : 'normal',
'size' : 20}
plt.rc('font', **font)
plt.rcParams['figure.figsize'] = 8, 6
In [8]:
import matplotlib.pyplot as plt
import numpy as np
import wave
import sys
spf = wave.open('output.wav','r')
# Extract Raw Audio from Wav File
signal = spf.readframes(-1)
signal = np.fromstring(signal, 'Int16')
fs = spf.getframerate()
t = np.linspace(0, len(signal)/fs, num=len(signal))
plt.figure(facecolor='w')
plt.title('Signal Wave...')
plt.plot(t,signal)
plt.ylabel('amplitude [a.u.]')
plt.xlabel('time [s]')
plt.show()
In [9]:
1.0/fs
Out[9]:
In [10]:
S = Signal(signal,"V","a.u.",1.0/fs)
S.binarate("end")
S.window(tw=10.0E-3)
S.fft()
S.filter(bw=0.1E3)
S.ifft()
S.trim()
S.fit(dt_chunk_target=0.50E-3)
In [8]:
S.plot_signal()
S.plot_fft(autozoom="no")
S.plot_fft(autozoom="yes")
S.plot_phase()
S.plot_phase_fit()
In [ ]: