Esempio n. 1
0
    def test_conditional_compare(self):
        """Test conditional_compare"""

        # Refer to the example in
        # bart.common.signal.SignalCompare.conditional_compare
        # doc-strings which explains the calculation for the
        # data set below
        A = [0, 0, 0, 3, 3, 0, 0, 0]
        B = [0, 0, 2, 2, 2, 2, 1, 1]

        trace = trappy.BareTrace()
        df = pd.DataFrame({"A": A, "B": B})
        trace.add_parsed_event("event", df)

        s = SignalCompare(trace, "event:A", "event:B")
        expected = (1.5, 2.0 / 7)
        self.assertEqual(
            s.conditional_compare("event:A > event:B", method="rect"),
            expected)
Esempio n. 2
0
    def test_conditional_compare(self):
        """Test conditional_compare"""

        # Refer to the example in
        # bart.common.signal.SignalCompare.conditional_compare
        # doc-strings which explains the calculation for the
        # data set below
        A = [0, 0, 0, 3, 3, 0, 0, 0]
        B = [0, 0, 2, 2, 2, 2, 1, 1]

        trace = trappy.BareTrace()
        df = pd.DataFrame({"A": A, "B": B})
        trace.add_parsed_event("event", df)

        s = SignalCompare(trace, "event:A", "event:B")
        expected = (1.5, 2.0 / 7)
        self.assertEqual(
            s.conditional_compare(
                "event:A > event:B",
                method="rect"),
            expected)