예제 #1
0
from unfuckup import unfuckup
from legendary import Legendary

ideal_f = np.array(range(150) + range(-150, 0))
discrete_f = np.array(range(0, 100, 25) + range(-100, 0, 25))

bandpass = lambda x: abs(x) <= 62.5

ideal_r = bandpass(ideal_f)
discrete_r = bandpass(discrete_f)

figure(1)
plot([0,0], [-.5, 2.0], "k:")
plot([-150,150], [0,0], "k:")

plot(unfuckup(ideal_f), unfuckup(ideal_r), "b-", linewidth=3, label="Ideal Bandpass")
xlim(-150, 150)
ylim(-.04, 2.0)
xlabel("Frequency (MHz)")
ylabel("Response")

discrete_transform = np.fft.ifft(discrete_r)
discrete_t = np.array(range(4) + range(-4, 0)) * 5

figure(2)
plot([0,0], [-.5, 2.0], "k:")
plot([-150,150], [0,0], "k:")
plot(discrete_t, discrete_transform.real, "rs", markersize=8, label="Time Domain Coefficients")
xlim(-20, 20)
ylim(-.2, .7)
xlabel("t (ns)")
예제 #2
0
figure()

#
digmixp = np.fromfile(os.path.join(digital_p, "mix_bram"), dtype=">i")
t = np.arange(0, digmixp.size) / f_sample
subplot(221)
plot(t * 1e6, digmixp / 1e3, "-", color="Orange")
title(r"$\nu_{sig} = 2.1 MHz$")
xlabel("Time ($\mu s$)", fontsize=14)
ylabel("V", fontsize=14)
xlim(0, 10)

output = np.fft.fft(digmixp)
subplot(212)
plot(
    1e-6 * unfuckup(np.fft.fftfreq(len(digmixp), 1.0 / f_sample)),
    1e-12 * unfuckup(abs(output) ** 2),
    color="Orange",
    linewidth=4,
)
xlabel("Frequency (MHz)", fontsize=14)
ylabel("Power", fontsize=14)
xlim(-6, 6)

digmixm = np.fromfile(os.path.join(digital_m, "mix_bram"), dtype=">i")
t = np.arange(0, digmixm.size) / f_sample
subplot(222)
plot(t * 1e6, digmixm / 1e3, "b-")
title(r"$\nu_{sig} = 1.9 MHz$")
xlabel("Time ($\mu s$)", fontsize=14)
gca().set_yticklabels([], visible=False)