Skip to content

Commit 76142fc

Browse files
committed
Changed the license to BSD 3-Clause from GPL 3.
1 parent f4cede8 commit 76142fc

18 files changed

+102
-987
lines changed

LICENSE.txt

+8-668
Large diffs are not rendered by default.

commpy/channelcoding/algcode.py

+3-16
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,7 @@
11

2-
# Copyright 2012 Veeresh Taranalli <[email protected]>
3-
#
4-
# This file is part of CommPy.
5-
#
6-
# CommPy is free software: you can redistribute it and/or modify
7-
# it under the terms of the GNU General Public License as published by
8-
# the Free Software Foundation, either version 3 of the License, or
9-
# (at your option) any later version.
10-
#
11-
# CommPy is distributed in the hope that it will be useful,
12-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14-
# GNU General Public License for more details.
15-
#
16-
# You should have received a copy of the GNU General Public License
17-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
2+
3+
# Authors: Veeresh Taranalli <[email protected]>
4+
# License: BSD 3-Clause
185

196
from fractions import gcd
207
from numpy import array, arange, concatenate, convolve

commpy/channelcoding/convcode.py

+3-16
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,7 @@
11

2-
# Copyright 2012 Veeresh Taranalli <[email protected]>
3-
#
4-
# This file is part of CommPy.
5-
#
6-
# CommPy is free software: you can redistribute it and/or modify
7-
# it under the terms of the GNU General Public License as published by
8-
# the Free Software Foundation, either version 3 of the License, or
9-
# (at your option) any later version.
10-
#
11-
# CommPy is distributed in the hope that it will be useful,
12-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14-
# GNU General Public License for more details.
15-
#
16-
# You should have received a copy of the GNU General Public License
17-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
2+
3+
# Authors: Veeresh Taranalli <[email protected]>
4+
# License: BSD 3-Clause
185

196
""" Algorithms for Convolutional Codes """
207

commpy/channelcoding/gfields.py

+3-16
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,7 @@
11

2-
# Copyright 2012 Veeresh Taranalli <[email protected]>
3-
#
4-
# This file is part of CommPy.
5-
#
6-
# CommPy is free software: you can redistribute it and/or modify
7-
# it under the terms of the GNU General Public License as published by
8-
# the Free Software Foundation, either version 3 of the License, or
9-
# (at your option) any later version.
10-
#
11-
# CommPy is distributed in the hope that it will be useful,
12-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14-
# GNU General Public License for more details.
15-
#
16-
# You should have received a copy of the GNU General Public License
17-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
2+
3+
# Authors: Veeresh Taranalli <[email protected]>
4+
# License: BSD 3-Clause
185

196
""" Galois Fields """
207

commpy/channelcoding/interleavers.py

+14-30
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,7 @@
11

2-
# Copyright 2012 Veeresh Taranalli <[email protected]>
3-
#
4-
# This file is part of CommPy.
5-
#
6-
# CommPy is free software: you can redistribute it and/or modify
7-
# it under the terms of the GNU General Public License as published by
8-
# the Free Software Foundation, either version 3 of the License, or
9-
# (at your option) any later version.
10-
#
11-
# CommPy is distributed in the hope that it will be useful,
12-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14-
# GNU General Public License for more details.
15-
#
16-
# You should have received a copy of the GNU General Public License
17-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
2+
3+
# Authors: Veeresh Taranalli <[email protected]>
4+
# License: BSD 3-Clause
185

196
""" Interleavers and De-interleavers """
207

@@ -41,7 +28,7 @@ def interlv(self, in_array):
4128
"""
4229
out_array = array(map(lambda x: in_array[x], self.p_array))
4330
return out_array
44-
31+
4532
def deinterlv(self, in_array):
4633
""" De-interleave input array using the specific interleaver.
4734
@@ -62,30 +49,30 @@ def deinterlv(self, in_array):
6249
return out_array
6350

6451
class RandInterlv(_Interleaver):
65-
""" Random Interleaver.
52+
""" Random Interleaver.
6653
6754
Parameters
6855
----------
6956
length : int
7057
Length of the interleaver.
7158
7259
seed : int
73-
Seed to initialize the random number generator
74-
which generates the random permutation for
75-
interleaving.
76-
60+
Seed to initialize the random number generator
61+
which generates the random permutation for
62+
interleaving.
63+
7764
Returns
7865
-------
7966
random_interleaver : RandInterlv object
8067
A random interleaver object.
8168
8269
Note
8370
----
84-
The random number generator is the
85-
RandomState object from NumPy,
86-
which uses the Mersenne Twister algorithm.
87-
88-
"""
71+
The random number generator is the
72+
RandomState object from NumPy,
73+
which uses the Mersenne Twister algorithm.
74+
75+
"""
8976
def __init__(self, length, seed):
9077
rand_gen = mtrand.RandomState(seed)
9178
self.p_array = rand_gen.permutation(arange(length))
@@ -95,6 +82,3 @@ def __init__(self, length, seed):
9582

9683

9784
#class QPPInterlv(_Interleaver):
98-
99-
100-

commpy/channelcoding/ldpc.py

+9-24
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,15 @@
11

2-
# Copyright 2012 Veeresh Taranalli <[email protected]>
3-
#
4-
# This file is part of CommPy.
5-
#
6-
# CommPy is free software: you can redistribute it and/or modify
7-
# it under the terms of the GNU General Public License as published by
8-
# the Free Software Foundation, either version 3 of the License, or
9-
# (at your option) any later version.
10-
#
11-
# CommPy is distributed in the hope that it will be useful,
12-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14-
# GNU General Public License for more details.
15-
#
16-
# You should have received a copy of the GNU General Public License
17-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
2+
3+
# Authors: Veeresh Taranalli <[email protected]>
4+
# License: BSD 3-Clause
185

196
""" LDPC Codes """
207
from numpy import zeros, shape, tanh, arctanh, array, delete, prod, dot
218

229
__all__ = ['ldpc_decode']
2310

2411
def ldpc_decode(pcheck_matrix, rx_codeword, n_iters):
25-
"""
12+
"""
2613
LDPC Decoder using belief propagation for an AWGN channel.
2714
2815
Parameters
@@ -53,10 +40,10 @@ def ldpc_decode(pcheck_matrix, rx_codeword, n_iters):
5340
prev_llrs = delete(llr_vals, v_node)
5441
prev_llrs = prev_llrs[delete(pcheck_matrix[c_node, :], v_node) == 1]
5542
prev_compvals = delete(comp_mat[c_node, :], v_node)
56-
prev_compvals = prev_compvals[delete(pcheck_matrix[c_node, :], v_node) == 1]
43+
prev_compvals = prev_compvals[delete(pcheck_matrix[c_node, :], v_node) == 1]
5744
llr_prod = prod(tanh(-(prev_llrs - prev_compvals)/2))
5845
comp_mat[c_node, v_node] = -2 * arctanh(llr_prod)
59-
46+
6047
# Variable Node Update
6148
for v_node in xrange(n_v_nodes):
6249
llr_vals[v_node] = llr_vals[v_node] + sum(comp_mat[:,v_node][pcheck_matrix[:,v_node]==1])
@@ -65,20 +52,18 @@ def ldpc_decode(pcheck_matrix, rx_codeword, n_iters):
6552
if not (dot(pcheck_matrix, decoded_bits)%2).any():
6653
print "Perfect Decoding, # Iterations: " + str(i+1)
6754
break
68-
55+
6956
return decoded_bits
7057

7158
if __name__ == '__main__':
7259

73-
pcheck_matrix = array([[1, 1, 1, 0, 0, 1, 1, 0, 0, 1],
60+
pcheck_matrix = array([[1, 1, 1, 0, 0, 1, 1, 0, 0, 1],
7461
[1, 0, 1, 0, 1, 1, 0, 1, 1, 0],
7562
[0, 0, 1, 1, 1, 0, 1, 0, 1, 1],
7663
[0, 1, 0, 1, 1, 1, 0, 1, 0, 1],
7764
[1, 1, 0, 1, 0, 0, 1, 1, 1, 0]])
7865
rx_codeword = array([-1.3, -1.7, -1.5, -0.08, 0.2, 1.9, -1.5, 1.3, -1.1, 1.2])
7966
n_iters = 10
8067
decoded_bits = ldpc_decode(pcheck_matrix, rx_codeword, n_iters)
81-
82-
print decoded_bits
83-
8468

69+
print decoded_bits
+3-18
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,6 @@
11

2-
# Copyright 2012 Veeresh Taranalli <[email protected]>
3-
#
4-
# This file is part of CommPy.
5-
#
6-
# CommPy is free software: you can redistribute it and/or modify
7-
# it under the terms of the GNU General Public License as published by
8-
# the Free Software Foundation, either version 3 of the License, or
9-
# (at your option) any later version.
10-
#
11-
# CommPy is distributed in the hope that it will be useful,
12-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14-
# GNU General Public License for more details.
15-
#
16-
# You should have received a copy of the GNU General Public License
17-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
2+
# Authors: Veeresh Taranalli <[email protected]>
3+
# License: BSD 3-Clause
184

195
from numpy import array
206
from numpy.testing import assert_array_equal
@@ -26,11 +12,10 @@ def test_cyclic_code_gen_poly(self):
2612
code_lengths = array([15, 31])
2713
code_dims = array([4, 21])
2814
desired_genpolys = array([[2479, 3171, 3929],
29-
[1653, 1667, 1503, 1207, 1787, 1561, 1903,
15+
[1653, 1667, 1503, 1207, 1787, 1561, 1903,
3016
1219, 1137, 2013, 1453, 1897, 1975, 1395, 1547]])
3117
count = 0
3218
for n, k in zip(code_lengths, code_dims):
3319
genpolys = cyclic_code_genpoly(n, k)
3420
assert_array_equal(genpolys, desired_genpolys[count])
3521
count += 1
36-

commpy/channelcoding/tests/test_convcode.py

+8-23
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,15 @@
11

2-
# Copyright 2012 Veeresh Taranalli <[email protected]>
3-
#
4-
# This file is part of CommPy.
5-
#
6-
# CommPy is free software: you can redistribute it and/or modify
7-
# it under the terms of the GNU General Public License as published by
8-
# the Free Software Foundation, either version 3 of the License, or
9-
# (at your option) any later version.
10-
#
11-
# CommPy is distributed in the hope that it will be useful,
12-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14-
# GNU General Public License for more details.
15-
#
16-
# You should have received a copy of the GNU General Public License
17-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
2+
3+
# Authors: Veeresh Taranalli <[email protected]>
4+
# License: BSD 3-Clause
185

196
from numpy import array
207
from numpy.random import randint
21-
from numpy.testing import assert_array_equal
8+
from numpy.testing import assert_array_equal
229
from commpy.channelcoding.convcode import Trellis, conv_encode, viterbi_decode
2310

2411
class TestConvCode(object):
25-
12+
2613
@classmethod
2714
def setup_class(cls):
2815
# Convolutional Code 1: G(D) = [1+D^2, 1+D+D^2]
@@ -67,7 +54,7 @@ def test_next_state_table(self):
6754
def test_output_table(self):
6855
assert_array_equal(self.trellis_1.output_table, self.desired_output_table_1)
6956
assert_array_equal(self.trellis_2.output_table, self.desired_output_table_2)
70-
57+
7158
def test_conv_encode(self):
7259
pass
7360

@@ -80,13 +67,11 @@ def test_conv_encode_viterbi_decode(self):
8067

8168
for i in xrange(niters):
8269
msg = randint(0, 2, blocklength)
83-
70+
8471
coded_bits = conv_encode(msg, self.trellis_1)
8572
decoded_bits = viterbi_decode(coded_bits.astype(float), self.trellis_1, 15)
8673
assert_array_equal(decoded_bits[:-2], msg)
87-
74+
8875
coded_bits = conv_encode(msg, self.trellis_2)
8976
decoded_bits = viterbi_decode(coded_bits.astype(float), self.trellis_2, 15)
9077
assert_array_equal(decoded_bits[:-2], msg)
91-
92-

commpy/channelcoding/tests/test_gfields.py

+2-20
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,6 @@
11

2-
# Copyright 2012 Veeresh Taranalli <[email protected]>
3-
#
4-
# This file is part of CommPy.
5-
#
6-
# CommPy is free software: you can redistribute it and/or modify
7-
# it under the terms of the GNU General Public License as published by
8-
# the Free Software Foundation, either version 3 of the License, or
9-
# (at your option) any later version.
10-
#
11-
# CommPy is distributed in the hope that it will be useful,
12-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14-
# GNU General Public License for more details.
15-
#
16-
# You should have received a copy of the GNU General Public License
17-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
2+
# Authors: Veeresh Taranalli <[email protected]>
3+
# License: BSD 3 clause
184

195
from numpy import array, ones_like, arange
206
from numpy.testing import assert_array_almost_equal, assert_array_equal, assert_, assert_equal
@@ -80,7 +66,3 @@ def test_minpols(self):
8066
x = GF(array([2, 8, 32, 6, 24, 35, 10, 40, 59, 41, 14, 37]), m)
8167
z = array([67, 87, 103, 73, 13, 109, 91, 117, 7, 115, 11, 97])
8268
assert_array_equal(x.minpolys(), z)
83-
84-
85-
86-

commpy/channelcoding/turbo.py

+3-16
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,7 @@
11

2-
# Copyright 2012 Veeresh Taranalli <[email protected]>
3-
#
4-
# This file is part of CommPy.
5-
#
6-
# CommPy is free software: you can redistribute it and/or modify
7-
# it under the terms of the GNU General Public License as published by
8-
# the Free Software Foundation, either version 3 of the License, or
9-
# (at your option) any later version.
10-
#
11-
# CommPy is distributed in the hope that it will be useful,
12-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14-
# GNU General Public License for more details.
15-
#
16-
# You should have received a copy of the GNU General Public License
17-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
2+
3+
# Authors: Veeresh Taranalli <[email protected]>
4+
# License: BSD 3-Clause
185

196
""" Turbo Codes """
207

commpy/channels.py

+2-16
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,6 @@
11

2-
# Copyright 2012 Veeresh Taranalli <[email protected]>
3-
#
4-
# This file is part of CommPy.
5-
#
6-
# CommPy is free software: you can redistribute it and/or modify
7-
# it under the terms of the GNU General Public License as published by
8-
# the Free Software Foundation, either version 3 of the License, or
9-
# (at your option) any later version.
10-
#
11-
# CommPy is distributed in the hope that it will be useful,
12-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14-
# GNU General Public License for more details.
15-
#
16-
# You should have received a copy of the GNU General Public License
17-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
2+
# Authors: Veeresh Taranalli <[email protected]>
3+
# License: BSD 3-Clause
184

195
"""
206
============================================

0 commit comments

Comments
 (0)