Skip to content
Snippets Groups Projects
Commit 1e461c6b authored by Daniel van der Schuur's avatar Daniel van der Schuur
Browse files

-Fiex phase shifting.

parent 5216a8ba
No related branches found
No related tags found
No related merge requests found
...@@ -40,7 +40,7 @@ NOF_INPUT_SIGNALS = 24 ...@@ -40,7 +40,7 @@ NOF_INPUT_SIGNALS = 24
COMPLEX_WIDTH = 8 COMPLEX_WIDTH = 8
NOF_WORDS_PER_BLOCK = 64 NOF_WORDS_PER_BLOCK = 64
PATH = "../hex" PATH = os.environ['RADIOHDL']+'/applications/apertif/apertif_unb1_correlator/src/hex'
FILENAME = "composite_signals" FILENAME = "composite_signals"
############################################################################### ###############################################################################
...@@ -57,54 +57,57 @@ x = np.linspace(0.0, N*T, N) ...@@ -57,54 +57,57 @@ x = np.linspace(0.0, N*T, N)
# 8 bit signed -> WAAROM LIJKT AMPL_MAX DAN TOCH 63 te zijn IPV 127?? # 8 bit signed -> WAAROM LIJKT AMPL_MAX DAN TOCH 63 te zijn IPV 127??
# . Boven ~70 wordt de waarde aan de FFT output jusit lager... # . Boven ~70 wordt de waarde aan de FFT output jusit lager...
AMPL_MAX = 63 # 7 bits+sign #HUH?! 100->62; 63->118; 80->105; 70->123; 72->121; 75->110 AMPL_MAX = 63 # 7 bits+sign #HUH?! 100->62; 63->118; 80->105; 70->123; 72->121; 75->110
NOF_CHANNELS = 1 # Note: starting from 0 in -31..31. CHANNELS = [19]
NOF_CHANNELS = len(CHANNELS)
input_signals = [] input_signals = []
for input_signal_nr in range(NOF_INPUT_SIGNALS): for input_signal_nr in range(NOF_INPUT_SIGNALS):
phase_shift_deg = input_signal_nr phase_shift_deg = input_signal_nr
channel_signals = [] channel_signals = []
for bin_nr in range(NOF_CHANNELS): for bin_nr in CHANNELS:
phase_shift_rad = math.radians(phase_shift_deg) phase_shift_rad = math.radians(phase_shift_deg)
ampl=AMPL_MAX/NOF_CHANNELS ampl=AMPL_MAX/NOF_CHANNELS
signal = ampl * np.exp( (bin_nr+1) * 1.j * (2.0*np.pi*x+phase_shift_rad) ) signal = ampl * np.exp( (bin_nr) * 1.j * (2.0*np.pi*x+(phase_shift_rad/bin_nr)) )
channel_signals.append( signal ) channel_signals.append( signal )
composite_signal=numpy.sum(channel_signals, axis=0) composite_signal=numpy.sum(channel_signals, axis=0)
input_signals.append(composite_signal) input_signals.append(composite_signal)
s=input_signals[23] s=input_signals[1]
############################################################################### ###############################################################################
# Convert the float values to n-bits # Convert the float values to n-bits
############################################################################### ###############################################################################
#s_bits = [] s_bits = []
#for fword in s: for fword in s:
# re_signed = to_signed(fword.real, COMPLEX_WIDTH) re_signed = to_signed(fword.real, COMPLEX_WIDTH)
# im_signed = to_signed(fword.imag, COMPLEX_WIDTH) im_signed = to_signed(fword.imag, COMPLEX_WIDTH)
#
# s_bits.append( complex(re_signed, im_signed) ) s_bits.append( complex(re_signed, im_signed) )
#
#s = numpy.array(s_bits) s = numpy.array(s_bits)
#print s print s
############################################################################### ###############################################################################
# Plot the signal # Plot the signal
############################################################################### ###############################################################################
#plt.plot(t, s.real, 'b-', t, s.imag, 'r--') plt.plot(t, s.real, 'b-', t, s.imag, 'r--')
#plt.legend(('real', 'imaginary')) plt.legend(('real', 'imaginary'))
#plt.show() plt.show()
############################################################################### ###############################################################################
# Plot FFT # Plot FFT
############################################################################### ###############################################################################
#yf = fft(s) yf = fft(s)
#
#xf = fftfreq(N, T) xf = fftfreq(N, T)
#xf = fftshift(xf) xf = fftshift(xf)
#yplot = fftshift(yf) yplot = fftshift(yf)
#plt.bar(xf, 1.0/N * np.abs(yplot)) plt.bar(xf, 1.0/N * np.abs(yplot))
#plt.grid() plt.grid()
#plt.show() plt.show()
############################################################################### ###############################################################################
# Convert complex floats to concatenated integers # Convert complex floats to concatenated integers
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment