The FM demodulation technique we use is called polar discrimination, from [1]
import os, sys
nb_dir = os.path.split(os.getcwd())[0]
if nb_dir not in sys.path:
sys.path.append(nb_dir)
%matplotlib inline
%load_ext autoreload
%autoreload 2
import numpy as np
from directdemod import fmDemod
The following is a result if the array 'a' is undergone FM demodulation,
a = np.array([1+1j, 2-2j, 3+3j, 4-4j, 5+5j, 6-6j])
fm = fmDemod.fmDemod(storeState = False)
print(fm.demod(a))
[-1.57079633 1.57079633 -1.57079633 1.57079633 -1.57079633]
If we do it in parts,
a1 = np.array([1+1j, 2-2j, 3+3j])
a2 = np.array([4-4j, 5+5j, 6-6j])
fm = fmDemod.fmDemod(storeState = False)
print(fm.demod(a1))
print(fm.demod(a2))
[-1.57079633 1.57079633] [ 1.57079633 -1.57079633]
Instead of 5 values, we got 4. We lost one value because of chunking. It can be solved by using flag 'storeState = True'
a1 = np.array([1+1j, 2-2j, 3+3j])
a2 = np.array([4-4j, 5+5j, 6-6j])
fm = fmDemod.fmDemod(storeState = True)
print(fm.demod(a1))
print(fm.demod(a2))
[-1.57079633 1.57079633] [-1.57079633 1.57079633 -1.57079633]
Now we see that this indeed solves the chunking problem
FM demodulation introduces a one sample delay, this must be taken into consideration. The solution to chunking is provided by enabling the flag 'storeState = True'