Exemplo n.º 1
0
 def test_call():
     """ Check generated Sech function """
     from numpy import arange
     sech = Sech("sech", 0.4, 5.0, 1.5, 0.3, 0, 1.5)
     t = arange(0.0, 100.0)
     A = sech.generate(t)
     P = abs(A) ** 2
     assert_almost_equal(max(P), 1.5)
Exemplo n.º 2
0
 def test_call():
     """ Check generated Sech function """
     from numpy import arange
     sech = Sech("sech", 0.4, 5.0, 1.5, 0.3, 0, 1.5)
     t = arange(0.0, 100.0)
     A = sech.generate(t)
     P = abs(A) ** 2
     assert_almost_equal(max(P), 1.5)
Exemplo n.º 3
0
    def setUp(self):
        from pyofss.domain import Domain
        from pyofss.modules.sech import Sech

        domain = Domain(bit_width=200.0, samples_per_bit=2048)
        sech = Sech(peak_power=4.0, width=1.0)

        function = self.Function(domain)
        self.parameters = {"method": None, "f": function,
                           "length": 0.5 * np.pi, "total_steps": 1000}

        self.A_analytical = 2.0
        self.P_analytical = np.abs(self.A_analytical) ** 2
        self.A_in = sech.generate(domain.t)