diff options
author | andreas128 <Andreas> | 2017-05-10 20:17:26 +0100 |
---|---|---|
committer | andreas128 <Andreas> | 2017-05-10 20:17:26 +0100 |
commit | 5ddca73652c9671b23eb096a18267e5dcce93a0c (patch) | |
tree | 9924416eb4b84c890b332bcdac411064e77a9e30 /src/dab_util.py | |
parent | 92b5073fe3bc0aaac0eecc1647ca3176d204df89 (diff) | |
download | ODR-StaticPrecorrection-5ddca73652c9671b23eb096a18267e5dcce93a0c.tar.gz ODR-StaticPrecorrection-5ddca73652c9671b23eb096a18267e5dcce93a0c.tar.bz2 ODR-StaticPrecorrection-5ddca73652c9671b23eb096a18267e5dcce93a0c.zip |
Add function to get transmission frame index
Diffstat (limited to 'src/dab_util.py')
-rw-r--r-- | src/dab_util.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/dab_util.py b/src/dab_util.py index fa52015..2b23812 100644 --- a/src/dab_util.py +++ b/src/dab_util.py @@ -2,6 +2,7 @@ import numpy as np import scipy import matplotlib.pyplot as plt import fftconvolve +import src.dabconst as dabconst c = {} c["bw"]=1536000 @@ -77,3 +78,11 @@ def get_phase(ampl_1, ampl_2, a_out, a_in): idxs = (np.abs(a_in) > ampl_1) & (np.abs(a_in) < ampl_2) ratio = np.angle(a_out[idxs], deg=True) - np.angle(a_in[idxs], deg=True) return ratio.mean(), ratio.var() + +def get_transmission_frame_indices(n_frames, offset, rate = 2048000): + tm1 = dabconst.tm1(rate) + indices = [tm1.S_F * i + offset for i in range(n_frames)] + return indices + +def fromfile(filename, offset, length): + return np.memmap(filename, dtype=np.complex64, mode='r', offset=64/8*offset, shape=length) |