Skip to content

Commit

Permalink
Add failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
terrorfisch committed Jul 1, 2024
1 parent c6b0ff4 commit 3e4cee6
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/pulses/time_reversal_pulse_template_tests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import unittest

import numpy as np

from qupulse.pulses import ConstantPT, FunctionPT
from qupulse.plotting import render
from qupulse.pulses.time_reversal_pulse_template import TimeReversalPulseTemplate
from qupulse.utils.types import TimeType
from qupulse.expressions import ExpressionScalar
Expand All @@ -25,6 +29,19 @@ def test_simple_properties(self):

self.assertEqual(reversed_pt.identifier, 'reverse')

def test_time_reversal_program(self):
inner = ConstantPT(4, {'a': 3}) @ FunctionPT('sin(t)', 5, channel='a')
manual_reverse = FunctionPT('sin(5 - t)', 5, channel='a') @ ConstantPT(4, {'a': 3})
time_reversed = TimeReversalPulseTemplate(inner)

program = time_reversed.create_program()
manual_program = manual_reverse.create_program()

t, data, _ = render(program, 9 / 10)
_, manual_data, _ = render(manual_program, 9 / 10)

np.testing.assert_allclose(data['a'], manual_data['a'])


class TimeReversalPulseTemplateSerializationTests(unittest.TestCase, SerializableTests):
@property
Expand Down

0 comments on commit 3e4cee6

Please sign in to comment.