Beispiel #1
0
 def test_15(self):
     """TestTrackGenLines.test_15(): genLog10() line spacing."""
     #pS = [p for s, p in Track.genLog10(40.0, 200.0, cycles=2, start=2)]
     pS = [(s.width, p)
           for s, p in Track.genLog10(40.0, 200.0, cycles=2, start=2)]
     #        print()
     #        pprint.pprint(pS)
     self.assertEqual(19, len(pS))
     self.assertEqual(
         [
             (0.75, 40.0),
             (0.25, 54.0873007244545),
             (0.25, 64.0823996531185),
             (0.25, 71.83520069376301),
             (0.25, 78.169700377573),
             (0.25, 83.52544354802205),
             (0.25, 88.16479930623699),
             (0.25, 92.2570011020275),
             (0.75, 95.9176003468815),
             (0.25, 120.0),
             (0.25, 134.0873007244545),
             (0.25, 144.0823996531185),
             (0.25, 151.835200693763),
             (0.25, 158.169700377573),
             (0.25, 163.52544354802205),
             (0.25, 168.164799306237),
             (0.25, 172.25700110202752),
             (0.75, 175.9176003468815),
             (0.75, 200.0),
         ],
         pS,
     )
Beispiel #2
0
 def test_14(self):
     """TestTrackGenLines.test_14(): genLog10() line widths, two cycles, start at 2."""
     pS = [(s.width, p)
           for s, p in Track.genLog10(0.0, 200.0, cycles=2, start=2)]
     #        print()
     #        pprint.pprint(pS)
     self.assertEqual(19, len(pS))
     self.assertEqual(
         [
             (0.75, 0.0),
             (0.25, 17.609125905568124),
             (0.25, 30.10299956639812),
             (0.25, 39.79400086720376),
             (0.25, 47.712125471966246),
             (0.25, 54.40680443502757),
             (0.25, 60.20599913279623),
             (0.25, 65.32125137753437),
             (0.75, 69.89700043360187),
             (0.25, 100.0),
             (0.25, 117.60912590556812),
             (0.25, 130.10299956639813),
             (0.25, 139.79400086720375),
             (0.25, 147.71212547196626),
             (0.25, 154.40680443502757),
             (0.25, 160.20599913279622),
             (0.25, 165.32125137753437),
             (0.75, 169.89700043360187),
             (0.75, 200.0),
         ],
         pS,
     )
Beispiel #3
0
 def test_12(self):
     """TestTrackGenLines.test_12(): genLog10() line widths."""
     wS = [s.width for s, p in Track.genLog10(40.0, 120.0, cycles=2)]
     #        print()
     #        pprint.pprint(wS)
     self.assertEqual(19, len(wS))
     self.assertEqual(
         [
             0.75,
             0.25,
             0.25,
             0.25,
             0.25,
             0.25,
             0.25,
             0.25,
             0.25,
             0.75,
             0.25,
             0.25,
             0.25,
             0.25,
             0.25,
             0.25,
             0.25,
             0.25,
             0.75,
         ],
         wS,
     )
Beispiel #4
0
 def test_13(self):
     """TestTrackGenLines.test_13(): genLog10() line spacing."""
     pS = [p for s, p in Track.genLog10(40.0, 200.0, cycles=2)]
     #print()
     #pprint.pprint(pS)
     self.assertEqual(19, len(pS))
     self.assertEqual(
         [
             40.0,
             64.0823996531185,
             78.169700377573,
             88.164799306237,
             95.9176003468815,
             102.2521000306915,
             107.60784320114054,
             112.24719895935549,
             116.33940075514599,
             120.0,
             144.0823996531185,
             158.169700377573,
             168.164799306237,
             175.9176003468815,
             182.2521000306915,
             187.60784320114055,
             192.2471989593555,
             196.339400755146,
             200.0,
         ],
         pS,
     )
Beispiel #5
0
    def test_16(self):
        """TestTrackGenLines.test_16(): genLog10() line spacing."""
        pS = [math.pow(10,(p-40)/80) for s, p in Track.genLog10(40.0, 200.0, cycles=2, start=1)]
#        print()
#        pprint.pprint(pS)
        self.assertEqual(19, len(pS))
#        decimal.getcontext().prec = 6
#        print(decimal.getcontext())
#        print([decimal.Decimal(p) for p in pS])
#        expResult = [decimal.Decimal(n) for n in list(range(1,11))+list(range(20,110,10))]
        expResult = [float(n) for n in list(range(1,11))+list(range(20,110,10))]
        for e,p in zip(expResult, pS):
            self.assertAlmostEqual(e, p, 6)