if noise_power == None: fig_title = 'ASDM Input Signal with No Noise' else: fig_title = 'ASDM Input Signal with %d dB of Noise' % noise_power print fig_title u = func_timer(bl.gen_band_limited)(dur, dt, f, noise_power) pl.plot_signal(t, u, fig_title, output_name + str(output_count) + output_ext) b = 3.5 # bias d = 0.7 # threshold k = 0.01 # scaling factor M = 5 # number of bins for fast decoding algorithm try: asdm.asdm_recoverable(u, bw, b, d, k) except ValueError('reconstruction condition not satisfied'): sys.exit() output_count += 1 fig_title = 'Signal Encoded Using ASDM Encoder' print fig_title s = func_timer(asdm.asdm_encode)(u, dt, b, d, k) pl.plot_encoded(t, u, s, fig_title, output_name + str(output_count) + output_ext) output_count += 1 fig_title = 'Signal Decoded Using ASDM Decoder' print fig_title u_rec = func_timer(asdm.asdm_decode)(s, dur, dt, bw, b, d, k) pl.plot_compare(t, u, u_rec, fig_title,
# Define encoding parameters: dte = dt quad_method = 'trapz' b = 3.5 # bias d = 0.7 # threshold k = 0.01 # scaling factor # Define real time decoder stitching parameters: N = 10 M = 2 K = 1 try: asdm.asdm_recoverable(u, bw, b, d, k) except ValueError('reconstruction condition not satisfied'): sys.exit() output_count += 1 fig_title = 'Signal Encoded Using Real-Time ASDM Encoder' print fig_title encoder = rt.ASDMRealTimeEncoder(dt, b, d, k) s = func_timer(encoder)(u) pl.plot_encoded(t, u, s, fig_title, output_name + str(output_count) + output_ext) output_count += 1 fig_title = 'Signal Decoded Using Real-Time ASDM Decoder' print fig_title decoder = rt.ASDMRealTimeDecoder(dt, bw, b, d, k, N, M, K)
noise_power = None if noise_power == None: fig_title = 'ASDM Input Signal with No Noise' else: fig_title = 'ASDM Input Signal with %d dB of Noise' % noise_power print fig_title u = func_timer(bl.gen_band_limited)(dur, dt, f, noise_power) pl.plot_signal(t, u, fig_title, output_name + str(output_count) + output_ext) b1 = 3.5 # bias d1 = 0.7 # threshold k1 = 0.01 # scaling factor try: asdm.asdm_recoverable(u, bw, b1, d1, k1) except ValueError('reconstruction condition not satisfied'): sys.exit() b2 = 3.4 # bias d2 = 0.8 # threshold k2 = 0.01 # scaling factor try: asdm.asdm_recoverable(u, bw, b2, d2, k2) except ValueError('reconstruction condition not satisfied'): sys.exit() output_count += 1 fig_title = 'Signal Encoded Using ASDM Encoder #1' print fig_title