@@ -1592,40 +1592,38 @@ def test_engformatter_usetex_useMathText():
1592
1592
1593
1593
1594
1594
@pytest .mark .parametrize (
1595
- 'oom_center, oom_noise , oom_center_desired, oom_noise_desired' , [
1596
- (11 , 1 , 9 , 0 ),
1597
- (13 , 7 , 12 , 6 ),
1598
- (1 , - 2 , 0 , - 3 ),
1599
- (3 , - 2 , 3 , - 3 ),
1600
- (5 , - 3 , 3 , - 3 ),
1601
- (2 , - 3 , 0 , - 3 ),
1602
- # The following sets of parameters demonstrates that when oom_center-1
1603
- # and oom_noise -2 equal a standard 3*N oom, we get that
1604
- # oom_noise_desired < oom_noise
1605
- (10 , 2 , 9 , 3 ),
1606
- (1 , - 7 , 0 , - 6 ),
1607
- (2 , - 4 , 0 , - 3 ),
1608
- (1 , - 4 , 0 , - 3 ),
1609
- # Tests where oom_center <= oom_noise , those are probably covered by the
1610
- # part where formatter.offset != 0
1611
- (4 , 4 , 0 , 3 ),
1612
- (1 , 4 , 0 , 3 ),
1613
- (1 , 3 , 0 , 3 ),
1614
- (1 , 2 , 0 , 0 ),
1615
- (1 , 1 , 0 , 0 ),
1595
+ 'data_offset, noise , oom_center_desired, oom_noise_desired' , [
1596
+ (271_490_000_000.0 , 10 , 9 , 0 ),
1597
+ (27_149_000_000_000.0 , 10_000_000 , 12 , 6 ),
1598
+ (27.149 , 0.01 , 0 , - 3 ),
1599
+ (2_714.9 , 0.01 , 3 , - 3 ),
1600
+ (271_490.0 , 0.001 , 3 , - 3 ),
1601
+ (271.49 , 0.001 , 0 , - 3 ),
1602
+ # The following sets of parameters demonstrates that when
1603
+ # oom(data_offset)-1 and oom(noise) -2 equal a standard 3*N oom, we get
1604
+ # that oom_noise_desired < oom(noise)
1605
+ (27_149_000_000.0 , 100 , 9 , + 3 ),
1606
+ (27.149 , 1e-07 , 0 , - 6 ),
1607
+ (271.49 , 0.0001 , 0 , - 3 ),
1608
+ (27.149 , 0.0001 , 0 , - 3 ),
1609
+ # Tests where oom(data_offset) <= oom(noise) , those are probably
1610
+ # covered by the part where formatter.offset != 0
1611
+ (27_149.0 , 10_000 , 0 , 3 ),
1612
+ (27.149 , 10_000 , 0 , 3 ),
1613
+ (27.149 , 1_000 , 0 , 3 ),
1614
+ (27.149 , 100 , 0 , 0 ),
1615
+ (27.149 , 10 , 0 , 0 ),
1616
1616
]
1617
1617
)
1618
1618
def test_engformatter_offset_oom (
1619
- oom_center ,
1620
- oom_noise ,
1619
+ data_offset ,
1620
+ noise ,
1621
1621
oom_center_desired ,
1622
1622
oom_noise_desired
1623
1623
):
1624
1624
UNIT = "eV"
1625
1625
fig , ax = plt .subplots ()
1626
- # Use some random ugly number
1627
- data_offset = 2.7149 * 10 ** oom_center
1628
- ydata = data_offset + np .arange (- 5 , 7 , dtype = float )* 10 ** oom_noise
1626
+ ydata = data_offset + np .arange (- 5 , 7 , dtype = float )* noise
1629
1627
ax .plot (ydata )
1630
1628
formatter = mticker .EngFormatter (useOffset = True , unit = UNIT )
1631
1629
# So that offset strings will always have the same size
0 commit comments