예제 #1
0
    def test_or_combinations(self):
        assert_equal((volA | volB), volume.CVDefinedVolume(op_id, -0.5, 0.75))
        assert_equal((volB | volC), volume.UnionVolume(volB, volC))
        assert_equal((volB | volC)(0.0), False)
        assert_equal((volB | volC)(0.5), True)
        assert_equal((volB | volC)(-0.5), True)

        # go to VolumeCombination if order parameters isn't the same
        assert_equal((volA2 | volB), volume.UnionVolume(volA2, volB))
예제 #2
0
    def test_or_combinations(self):
        assert (volA | volB) == volume.CVDefinedVolume(op_id, -0.5, 0.75)
        assert (volB | volC) == volume.UnionVolume(volB, volC)
        assert (volB | volC)(0.0) is False
        assert (volB | volC)(0.5) is True
        assert (volB | volC)(-0.5) is True

        # go to VolumeCombination if order parameters isn't the same
        assert (volA2 | volB) == volume.UnionVolume(volA2, volB)
예제 #3
0
 def test_periodic_or_combos(self):
     assert_equal((self.pvolA | self.pvolB), self.pvolD)
     assert_equal((self.pvolA | self.pvolB)(60), True)
     assert_equal((self.pvolA | self.pvolB)(80), True)
     assert_equal((self.pvolA | self.pvolB)(125), False)
     assert_equal((self.pvolB | self.pvolC),
                  volume.UnionVolume(self.pvolB, self.pvolC))
     assert_equal((self.pvolC | self.pvolB),
                  volume.UnionVolume(self.pvolC, self.pvolB))
     assert_is((self.pvolA | self.pvolA), self.pvolA)
     assert_equal((self.pvolA | self.pvolA_), volume.FullVolume())
     assert_equal((self.pvolE | self.pvolD), self.pvolE)
     assert_equal((self.pvolB | self.pvolD), self.pvolD)
     assert_equal((self.pvolE | self.pvolA_), volume.FullVolume())
예제 #4
0
 def test_periodic_or_combos(self):
     assert (self.pvolA | self.pvolB) == self.pvolD
     assert (self.pvolA | self.pvolB)(60) is True
     assert (self.pvolA | self.pvolB)(80) is True
     assert (self.pvolA | self.pvolB)(125) is False
     assert ((self.pvolB | self.pvolC) == volume.UnionVolume(
         self.pvolB, self.pvolC))
     assert ((self.pvolC | self.pvolB) == volume.UnionVolume(
         self.pvolC, self.pvolB))
     assert (self.pvolA | self.pvolA) is self.pvolA
     assert (self.pvolA | self.pvolA_) == volume.FullVolume()
     assert (self.pvolE | self.pvolD) == self.pvolE
     assert (self.pvolB | self.pvolD) == self.pvolD
     assert (self.pvolE | self.pvolA_) == volume.FullVolume()
예제 #5
0
 def test_xor_combinations(self):
     assert_equal(
         (volA ^ volB),
         volume.UnionVolume(volume.CVDefinedVolume(op_id, -0.5, 0.25),
                            volume.CVDefinedVolume(op_id, 0.5, 0.75)))
     assert_equal((volA ^ volA2),
                  volume.SymmetricDifferenceVolume(volA, volA2))
예제 #6
0
 def test_periodic_xor_combos(self):
     assert self.pvolA ^ self.pvolA_ == volume.FullVolume()
     assert self.pvolA ^ self.pvolA == volume.EmptyVolume()
     assert (self.pvolE ^ self.pvolD == volume.UnionVolume(
         volume.PeriodicCVDefinedVolume(op_id, -150, -100),
         volume.PeriodicCVDefinedVolume(op_id, 100, 150)))
     assert self.pvolB ^ self.pvolC == self.pvolB | self.pvolC
     assert (self.pvolB ^ self.pvolD == volume.PeriodicCVDefinedVolume(
         op_id, -100, 50))
예제 #7
0
 def test_sub_combinations(self):
     assert (volA - volB) == volume.CVDefinedVolume(op_id, -0.5, 0.25)
     assert (volB - volC) == volB
     assert (volA - volD) == volume.EmptyVolume()
     assert (volB - volA) == volume.CVDefinedVolume(op_id, 0.5, 0.75)
     assert ((volD - volA) == volume.UnionVolume(
         volume.CVDefinedVolume(op_id, -0.75, -0.5),
         volume.CVDefinedVolume(op_id, 0.5, 0.75)))
     assert (volA2 - volA) == volume.RelativeComplementVolume(volA2, volA)
예제 #8
0
 def test_periodic_xor_combos(self):
     assert_equal(self.pvolA ^ self.pvolA_, volume.FullVolume())
     assert_equal(self.pvolA ^ self.pvolA, volume.EmptyVolume())
     assert_equal(self.pvolE ^ self.pvolD,
                  volume.UnionVolume(
                      volume.PeriodicCVDefinedVolume(op_id, -150, -100),
                      volume.PeriodicCVDefinedVolume(op_id, 100, 150)))
     assert_equal(self.pvolB ^ self.pvolC, self.pvolB | self.pvolC)
     assert_equal(self.pvolB ^ self.pvolD,
                  volume.PeriodicCVDefinedVolume(op_id, -100, 50))
예제 #9
0
 def test_sub_combinations(self):
     assert_equal((volA - volB), volume.CVRangeVolume(op_id, -0.5, 0.25))
     assert_equal((volB - volC), volB)
     assert_equal((volA - volD), volume.EmptyVolume())
     assert_equal((volB - volA), volume.CVRangeVolume(op_id, 0.5, 0.75))
     assert_equal(
         (volD - volA),
         volume.UnionVolume(volume.CVRangeVolume(op_id, -0.75, -0.5),
                            volume.CVRangeVolume(op_id, 0.5, 0.75)))
     assert_equal((volA2 - volA),
                  volume.RelativeComplementVolume(volA2, volA))
예제 #10
0
 def test_periodic_sub_combos(self):
     assert self.pvolA - self.pvolA_ is self.pvolA
     assert self.pvolA_ - self.pvolA is self.pvolA_
     assert (self.pvolD - self.pvolA == volume.PeriodicCVDefinedVolume(
         op_id, 75, 100))
     assert (self.pvolD - self.pvolA)(80) is True
     assert (self.pvolD - self.pvolA)(50) is False
     assert self.pvolB - self.pvolC is self.pvolB
     assert self.pvolA - self.pvolA == volume.EmptyVolume()
     assert (self.pvolE - self.pvolD == volume.UnionVolume(
         volume.PeriodicCVDefinedVolume(op_id, -150, -100),
         volume.PeriodicCVDefinedVolume(op_id, 100, 150)))
     assert (self.pvolE - self.pvolA_ == volume.PeriodicCVDefinedVolume(
         op_id, -100, 75))
예제 #11
0
 def test_periodic_sub_combos(self):
     assert_equal(self.pvolA - self.pvolA_, self.pvolA)
     assert_equal(self.pvolA_ - self.pvolA, self.pvolA_)
     assert_equal(self.pvolD - self.pvolA,
                  volume.PeriodicCVDefinedVolume(op_id, 75, 100))
     assert_equal((self.pvolD - self.pvolA)(80), True)
     assert_equal((self.pvolD - self.pvolA)(50), False)
     assert_equal(self.pvolB - self.pvolC, self.pvolB)
     assert_equal(self.pvolA - self.pvolA, volume.EmptyVolume())
     assert_equal(self.pvolE - self.pvolD,
                  volume.UnionVolume(
                      volume.PeriodicCVDefinedVolume(op_id, -150, -100),
                      volume.PeriodicCVDefinedVolume(op_id, 100, 150)))
     assert_equal(self.pvolE - self.pvolA_,
                  volume.PeriodicCVDefinedVolume(op_id, -100, 75))
예제 #12
0
 def test_periodic_and_combos(self):
     assert ((self.pvolA & self.pvolB) == volume.PeriodicCVDefinedVolume(
         op_id, 50, 75))
     assert (self.pvolA & self.pvolB)(60) is True
     assert (self.pvolA & self.pvolB)(80) is False
     assert (self.pvolB & self.pvolC) == volume.EmptyVolume()
     assert (self.pvolC & self.pvolB) == volume.EmptyVolume()
     assert (self.pvolA & self.pvolA) is self.pvolA
     assert (self.pvolA & self.pvolA_) == volume.EmptyVolume()
     assert (self.pvolE & self.pvolD) == self.pvolD
     # go to special case for cyclic permutation
     assert (self.pvolB & self.pvolD) == self.pvolB
     # go to special case
     assert ((self.pvolE & self.pvolA_) == volume.UnionVolume(
         volume.PeriodicCVDefinedVolume(op_id, -150, -100),
         volume.PeriodicCVDefinedVolume(op_id, 75, 150)))
     # go to super if needed
     assert type(self.pvolA & volA) is volume.IntersectionVolume
예제 #13
0
 def test_periodic_and_combos(self):
     assert_equal((self.pvolA & self.pvolB),
                  volume.PeriodicCVDefinedVolume(op_id, 50, 75))
     assert_equal((self.pvolA & self.pvolB)(60), True)
     assert_equal((self.pvolA & self.pvolB)(80), False)
     assert_equal((self.pvolB & self.pvolC), volume.EmptyVolume())
     assert_equal((self.pvolC & self.pvolB), volume.EmptyVolume())
     assert_is((self.pvolA & self.pvolA), self.pvolA)
     assert_equal((self.pvolA & self.pvolA_), volume.EmptyVolume())
     assert_equal((self.pvolE & self.pvolD), self.pvolD)
     # go to special case for cyclic permutation
     assert_equal((self.pvolB & self.pvolD), self.pvolB)
     # go to special case
     assert_equal((self.pvolE & self.pvolA_),
                  volume.UnionVolume(
                      volume.PeriodicCVDefinedVolume(op_id, -150, -100),
                      volume.PeriodicCVDefinedVolume(op_id, 75, 150)))
     # go to super if needed
     assert_equal(type(self.pvolA & volA), volume.IntersectionVolume)