def test(self): # Test Cross seq = SvSequence( [SvObj(0, 0.5), SvObj(100, 2.0), SvObj(200, 3.0), SvObj(400, 2.0)]) seq2 = SvSequence([ SvObj(50, 0.1), SvObj(100, 10.0), SvObj(250, 5.0), SvObj(500, 0.3) ]) seq.crossWith(seq2, inplace=True) self.assertAlmostEqual(seq[0].multiplier, 0.5) self.assertAlmostEqual(seq[1].multiplier, 20.0) self.assertAlmostEqual(seq[2].multiplier, 30.0) self.assertAlmostEqual(seq[3].multiplier, 10.0)
def crossMutualWith(this: SvSequence, other: SvSequence) -> SvPkg: """ Crosses with each other, returning 2 sequences that can be combined with SvPkg. """ return SvPkg([ this.crossWith(other=other, inplace=False), other.crossWith(other=this, inplace=False) ])