diff --git a/fourier/04_signal_to_noise.py b/fourier/04_signal_to_noise.py index 1d4273e..41f67fb 100755 --- a/fourier/04_signal_to_noise.py +++ b/fourier/04_signal_to_noise.py @@ -217,18 +217,35 @@ if __name__ == "__main__": # plot the snrs fig, axs2 = plt.subplots() fig.basefname="signal_to_noise_vs_N" + axs2.set_title("A: {:.2e}, $\\sigma$: {:.2e}".format(sine_amp, noise_sigma)) axs2.set_xlabel("$N = T*f_s$") axs2.set_ylabel("SNR") + mycolors = {} + myshapes = { 250: '^', 500: 'v' } for i, (f_sample, f_sine, t_lengths) in enumerate(fs_iter): + + if f_sine in mycolors.keys(): + color = mycolors[f_sine] + else: + color = None + + if f_sample in myshapes.keys(): + marker = myshapes[f_sample] + else: + marker = 'x' + # plot the means - l = axs2.plot(t_lengths*f_sample, np.mean(my_snrs[i], axis=-1), marker='*', ls='none', label='f:{}MHz, fs:{}MHz'.format(f_sine, f_sample), markeredgecolor='black') + l = axs2.plot(t_lengths*f_sample, np.mean(my_snrs[i], axis=-1), color=color, marker=marker, ls='none', label='f:{}MHz, fs:{}MHz'.format(f_sine, f_sample), markeredgecolor='black', mew=0.1) color = l[0].get_color() + mycolors[f_sine] = color + myshapes[f_sample] = l[0].get_marker() - for k, t_length in enumerate(t_lengths): - t_length = np.repeat(t_length * f_sample, my_snrs.shape[-1]) - axs2.plot(t_length, my_snrs[i,k], ls='none', color=color, marker='o', alpha=max(0.01, 1/my_snrs.shape[-1])) + if True: + for k, t_length in enumerate(t_lengths): + t_length = np.repeat(t_length * f_sample, my_snrs.shape[-1]) + axs2.plot(t_length, my_snrs[i,k], ls='none', color=color, marker='o', alpha=max(0.01, 1/my_snrs.shape[-1])) axs2.legend() @@ -236,14 +253,30 @@ if __name__ == "__main__": # plot snrs vs T fig, axs3 = plt.subplots() fig.basefname="signal_to_noise_vs_T" + axs3.set_title("A: {:.2e}, $\\sigma$: {:.2e}".format(sine_amp, noise_sigma)) axs3.set_xlabel("time [us]") axs3.set_ylabel("SNR") + #mycolors = {} + #myshapes = { 250: '^', 500: 'v' } for i, (f_sample, f_sine, t_lengths) in enumerate(fs_iter): + + if f_sine in mycolors.keys(): + color = mycolors[f_sine] + else: + color = None + + if f_sample in myshapes.keys(): + marker = myshapes[f_sample] + else: + marker = 'x' + # plot the means - l = axs3.plot(t_lengths, np.mean(my_snrs[i], axis=-1), marker='o', ls='none', label='f:{}MHz, fs:{}MHz'.format(f_sine, f_sample), markeredgecolor='black', markeredgewidth=1) + l = axs3.plot(t_lengths, np.mean(my_snrs[i], axis=-1), color=color, marker=marker, ls='none', label='f:{}MHz, fs:{}MHz'.format(f_sine, f_sample), markeredgecolor='black', mew=1) color = l[0].get_color() + mycolors[f_sine] = color + myshapes[f_sample] = l[0].get_marker() for k, t_length in enumerate(t_lengths): t_length = np.repeat(t_length , my_snrs.shape[-1])