Skip to content

Commit

Permalink
Fixing the GMSK modulator and updating the sample format in the USRP …
Browse files Browse the repository at this point in the history
…class
  • Loading branch information
mgm8 committed Aug 29, 2024
1 parent 6c51dbb commit 5c3a429
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
13 changes: 3 additions & 10 deletions spacelab_transmitter/gmsk.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def modulate(self, data, L=_GMSK_DEFAULT_OVERSAMPLING_FACTOR):
:return: dur: Signal duration in seconds
"""
I, Q, fs, dur = self.get_iq(data, L)
s_complex = np.complex64(I) - np.complex64(1j)*np.complex64(Q) # Complex baseband representation
s_complex = I + 1j*Q # Complex baseband representation

return s_complex, fs, dur

Expand All @@ -71,14 +71,7 @@ def get_iq(self, data, L=_GMSK_DEFAULT_OVERSAMPLING_FACTOR):
# Convert to array of bits
data = self._int_list_to_bit_list(data)

data_buff = list()
for i in data:
if i == 0:
data_buff.append(1)
else:
data_buff.append(0)

data = np.array(data_buff)
data = np.array(data)

# Timing parameters
fc = self._baudrate # Carrier frequency = Data transfer rate in bps
Expand All @@ -90,7 +83,7 @@ def get_iq(self, data, L=_GMSK_DEFAULT_OVERSAMPLING_FACTOR):
k = 1 # Truncation length for Gaussian LPF
h_t = self._gaussian_lpf(Tb, L, k) # Gaussian LPF with BT=0.25
b_t = np.convolve(h_t, c_t, 'full') # Convolve c(t) with Gaussian LPF to get b(t)
bnorm_t = b_t/max(abs(b_t)) # Normalize the output of Gaussian LPF to +/-1
bnorm_t = b_t/np.max(np.abs(b_t)) # Normalize the output of Gaussian LPF to +/-1

# Integrate to get phase information
h = 0.5 # Modulation index (GMSK = 0.5)
Expand Down
1 change: 1 addition & 0 deletions spacelab_transmitter/usrp.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def transmit(self, samples, dur, rate, freq):
:return: True/False if successful or not.
"""
samples = samples.astype(np.complex64)
samples = signal.resample_poly(samples, self._sample_rate, rate)

if self._usrp.send_waveform(samples, dur, freq, self._sample_rate, [0], self._gain):
Expand Down
2 changes: 1 addition & 1 deletion spacelab_transmitter/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
__copyright__ = "Copyright The SpaceLab-Transmitter Contributors"
__credits__ = ["Gabriel Mariano Marcelino, Vitória Beatriz Bianchin"]
__license__ = "GPLv3"
__version__ = "0.4.10"
__version__ = "0.4.11"
__maintainer__ = "Gabriel Mariano Marcelino - PU5GMA"
__email__ = "gabriel.mm8@gmail.com"
__status__ = "Development"

0 comments on commit 5c3a429

Please sign in to comment.