mirror of
https://github.com/romanz/amodem.git
synced 2026-02-07 01:18:02 +08:00
fix imports
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
#!/usr/bin/env python
|
||||
import numpy as np
|
||||
import common
|
||||
import config
|
||||
import sigproc
|
||||
import wave
|
||||
|
||||
from . import common
|
||||
from . import config
|
||||
from . import sigproc
|
||||
from . import wave
|
||||
|
||||
Tsample = 1
|
||||
t = np.arange(int(Tsample * config.Fs)) * config.Ts
|
||||
|
||||
@@ -108,3 +108,9 @@ def icapture(iterable, result):
|
||||
|
||||
def take(iterable, n):
|
||||
return np.array(list(itertools.islice(iterable, n)))
|
||||
|
||||
|
||||
try:
|
||||
izip = itertools.izip
|
||||
except AttributeError:
|
||||
izip = zip # Python 3
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
''' Reed-Solomon CODEC. '''
|
||||
from reedsolo import rs_encode_msg, rs_correct_msg
|
||||
|
||||
import common
|
||||
from . import common
|
||||
|
||||
import logging
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import numpy as np
|
||||
import itertools
|
||||
|
||||
import sampling
|
||||
import sigproc
|
||||
from . import sampling
|
||||
from . import sigproc
|
||||
from . import common
|
||||
|
||||
|
||||
class Filter(object):
|
||||
@@ -33,4 +34,4 @@ class FreqLoop(object):
|
||||
self.gens.append(gen)
|
||||
|
||||
def __iter__(self):
|
||||
return itertools.izip(*self.gens)
|
||||
return common.izip(*self.gens)
|
||||
|
||||
@@ -8,21 +8,24 @@ import time
|
||||
import sys
|
||||
import os
|
||||
|
||||
import bitarray
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
import stream
|
||||
import sigproc
|
||||
import loop
|
||||
import train
|
||||
import common
|
||||
import config
|
||||
from . import stream
|
||||
from . import sigproc
|
||||
from . import loop
|
||||
from . import train
|
||||
from . import common
|
||||
from . import config
|
||||
from . import ecc
|
||||
|
||||
modem = sigproc.MODEM(config)
|
||||
|
||||
|
||||
if os.environ.get('PYLAB') == '1':
|
||||
import pylab
|
||||
import show
|
||||
from . import pylab
|
||||
from . import show
|
||||
WIDTH = np.floor(np.sqrt(len(modem.freqs)))
|
||||
HEIGHT = np.ceil(len(modem.freqs) / float(WIDTH))
|
||||
else:
|
||||
@@ -223,9 +226,6 @@ def receive(signal, freqs, gain=1.0):
|
||||
|
||||
|
||||
def decode(bits_iterator):
|
||||
import bitarray
|
||||
import ecc
|
||||
|
||||
def blocks():
|
||||
while True:
|
||||
bits = itertools.islice(bits_iterator, 8 * ecc.BLOCK_SIZE)
|
||||
|
||||
@@ -7,13 +7,14 @@ import time
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
import train
|
||||
import wave
|
||||
from . import train
|
||||
from . import wave
|
||||
|
||||
import common
|
||||
import config
|
||||
import sigproc
|
||||
import stream
|
||||
from . import common
|
||||
from . import config
|
||||
from . import sigproc
|
||||
from . import stream
|
||||
from . import ecc
|
||||
|
||||
modem = sigproc.MODEM(config)
|
||||
|
||||
@@ -66,7 +67,6 @@ def modulate(fd, bits):
|
||||
|
||||
|
||||
def main(args):
|
||||
import ecc
|
||||
log.info('Running MODEM @ {:.1f} kbps'.format(modem.modem_bps / 1e3))
|
||||
|
||||
# padding audio with silence
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import numpy as np
|
||||
from numpy import linalg
|
||||
|
||||
import common
|
||||
from config import Ts, Nsym
|
||||
from . import common
|
||||
from .config import Ts, Nsym
|
||||
|
||||
|
||||
class Filter(object):
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import time
|
||||
|
||||
import wave
|
||||
|
||||
|
||||
class Reader(object):
|
||||
|
||||
@@ -6,7 +6,7 @@ import logging
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
import config
|
||||
from . import config
|
||||
Fs = int(config.Fs) # sampling rate
|
||||
|
||||
bits_per_sample = 16
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
import os
|
||||
from cStringIO import StringIO
|
||||
try:
|
||||
from cStringIO import StringIO as BytesIO
|
||||
except ImportError:
|
||||
from io import BytesIO # Python 3
|
||||
|
||||
import numpy as np
|
||||
|
||||
from amodem import send
|
||||
|
||||
Reference in New Issue
Block a user