mirror of
https://github.com/romanz/amodem.git
synced 2026-02-06 16:48:06 +08:00
fix string formatting
This commit is contained in:
@@ -57,8 +57,8 @@ def FileType(mode, process=None):
|
||||
|
||||
|
||||
def main():
|
||||
fmt = ('Audio OFDM MODEM: {:.1f} kb/s ({:d}-QAM x {:d} carriers) '
|
||||
'Fs={:.1f} kHz')
|
||||
fmt = ('Audio OFDM MODEM: {0:.1f} kb/s ({1:d}-QAM x {2:d} carriers) '
|
||||
'Fs={3:.1f} kHz')
|
||||
description = fmt.format(config.modem_bps / 1e3, len(config.symbols),
|
||||
config.Nfreq, config.Fs / 1e3)
|
||||
p = argparse.ArgumentParser(description=description)
|
||||
|
||||
@@ -11,7 +11,7 @@ class ALSA(object):
|
||||
self.bytes_per_sample = self.bits_per_sample / 8.0
|
||||
self.bytes_per_second = self.bytes_per_sample * self.Fs
|
||||
# PCM signed little endian
|
||||
self.audio_format = 'S{}_LE'.format(self.bits_per_sample)
|
||||
self.audio_format = 'S{0}_LE'.format(self.bits_per_sample)
|
||||
self.audio_tool = tool
|
||||
|
||||
def launch(self, fname=None, **kwargs):
|
||||
|
||||
@@ -68,7 +68,7 @@ def run_recorder(config, recorder):
|
||||
error = not any(states)
|
||||
if error:
|
||||
error_index = flags.index(False)
|
||||
message = 'too {} signal'.format(errors[error_index])
|
||||
message = 'too {0} signal'.format(errors[error_index])
|
||||
|
||||
yield dict(
|
||||
freq=freq, rms=rms, peak=peak, coherency=coherency,
|
||||
|
||||
@@ -135,7 +135,7 @@ class Receiver(object):
|
||||
log.debug('Current phase on carrier: %.3f', last_phase)
|
||||
|
||||
log.debug('Frequency error: %.2f ppm', freq_err * 1e6)
|
||||
self.plt.title('Frequency drift: {:.3f} ppm'.format(freq_err * 1e6))
|
||||
self.plt.title('Frequency drift: {0:.3f} ppm'.format(freq_err * 1e6))
|
||||
return freq_err
|
||||
|
||||
def _train(self, sampler, order, lookahead):
|
||||
@@ -177,7 +177,7 @@ class Receiver(object):
|
||||
for (i, freq), snr in zip(enumerate(self.frequencies), SNRs):
|
||||
log.debug('%5.1f kHz: SNR = %5.2f dB', freq / 1e3, snr)
|
||||
self._constellation(symbols[:, i], train_symbols[:, i],
|
||||
'$F_c = {} Hz$'.format(freq), index=i)
|
||||
'$F_c = {0} Hz$'.format(freq), index=i)
|
||||
assert error_rate == 0, error_rate
|
||||
|
||||
return equalization_filter
|
||||
@@ -260,7 +260,7 @@ class Receiver(object):
|
||||
symbol_list = np.array(self.stats['symbol_list'])
|
||||
for i, freq in enumerate(self.frequencies):
|
||||
self._constellation(symbol_list[i], self.modem.symbols,
|
||||
'$F_c = {} Hz$'.format(freq), index=i)
|
||||
'$F_c = {0} Hz$'.format(freq), index=i)
|
||||
self.plt.show()
|
||||
|
||||
def _constellation(self, y, symbols, title, index=None):
|
||||
|
||||
Reference in New Issue
Block a user