コード例 #1
0
ファイル: fundamental.py プロジェクト: JY00002/pyphysim
    def __init__(self, M, phaseOffset=0):
        """Initializes the PSK object.

        Parameters
        ----------
        M : int
            The modulation cardinality
        phaseOffset: float, optional
            A phase offset (in radians) to be applied to the PSK
            constellation.

        """
        Modulator.__init__(self)
        # Check if M is a power of 2
        assert 2**math.log(M, 2) == M

        # Generates the constellation
        symbols = self._createConstellation(M, phaseOffset)

        # Change to Gray mapping
        # noinspection PyUnresolvedReferences
        symbols = symbols[gray2binary(np.arange(0, M))]

        self.setConstellation(symbols)
コード例 #2
0
ファイル: fundamental.py プロジェクト: buguen/pyphysim
    def __init__(self, M, phaseOffset=0):
        """Initializes the PSK object.

        Parameters
        ----------
        M : int
            The modulation cardinality
        phaseOffset: float, optional
            A phase offset (in radians) to be applied to the PSK
            constellation.

        """
        Modulator.__init__(self)
        # Check if M is a power of 2
        assert 2 ** math.log(M, 2) == M

        # Generates the constellation
        symbols = self._createConstellation(M, phaseOffset)

        # Change to Gray mapping
        # noinspection PyUnresolvedReferences
        symbols = symbols[gray2binary(np.arange(0, M))]

        self.setConstellation(symbols)
コード例 #3
0
 def test_gray2binary(self):
     vec = np.array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
     np.testing.assert_array_equal(
         conversion.gray2binary(conversion.binary2gray(vec)), vec)
コード例 #4
0
 def test_gray2binary(self):
     vec = np.array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
     np.testing.assert_array_equal(
         conversion.gray2binary(conversion.binary2gray(vec)),
         vec)