8000 pylint fixes · EBenkler/allantools@d5a6c7f · GitHub
[go: up one dir, main page]

Skip to content

Commit d5a6c7f

Browse files
committed
pylint fixes
1 parent 89f0ad5 commit d5a6c7f

File tree

3 files changed

+29
-27
lines changed

3 files changed

+29
-27
lines changed

allantools/allantools.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
Version history
88
---------------
99
10-
**2019.07**
10+
**2019.07** 2019 August 3
1111
- move edf-functions and noise-ID functions to ci.py
1212
- mtotdev() htotdev() speed improvements
1313
- save dataset results to text file
1414
- real-time adev/mdev/hdev
15-
- travis testing on Lniux, OSX, and Windows
15+
- travis testing on Linux, OSX, and Windows
1616
1717
**2018.03** 2018 March 27
1818
- change license to LGPL v3 or later
@@ -718,17 +718,18 @@ def calc_mtotdev_phase(phase, rate, m):
718718
""" PRELIMINARY - REQUIRES FURTHER TESTING.
719719
calculation of mtotdev for one averaging factor m
720720
tau = m*tau0
721-
721+
722722
NIST [SP1065]_ Eqn (27), page 25.
723-
723+
724724
Computed from a set of N - 3m + 1 subsequences of 3m points.
725-
1. A linear trend (frequency offset) is removed from the subsequence
726-
by averaging the first and last halves of the subsequence and dividing by half the interval.
725+
1. A linear trend (frequency offset) is removed from the subsequence
726+
by averaging the first and last halves of the subsequence and
727+
dividing by half the interval.
727728
2. The offset-removed subsequence is extended at both ends
728729
by uninverted, even reflection.
729730
730731
[Howe1999]_
731-
D.A. Howe and F. Vernotte, "Generalization of the Total Variance
732+
D.A. Howe and F. Vernotte, "Generalization of the Total Variance
732733
Approach to the Modified Allan Variance," Proc.
733734
31 st PTTI Meeting, pp. 267-276, Dec. 1999.
734735
"""
@@ -765,10 +766,10 @@ def calc_mtotdev_phase(phase, rate, m):
765766
# remove the linear trend
766767
x0 = [x - slope*idx*tau0 for (idx, x) in enumerate(xs)]
767768
x0_flip = x0[::-1] # left-right flipped version of array
768-
769+
769770
# Step 2.
770771
# extend sequence, by uninverted even reflection
771-
# extended sequence xstar, of length 9m,
772+
# extended sequence xstar, of length 9m,
772773
xstar = np.concatenate((x0_flip, x0, x0_flip))
773774
assert len(xstar) == 9*m
774775

@@ -778,8 +779,7 @@ def calc_mtotdev_phase(phase, rate, m):
778779
# one term in the 6m sum: [ x_i - 2 x_i+m + x_i+2m ]^2
779780
squaresum = 0.0
780781
#print('m=%d 9m=%d maxj+3*m=%d' %( m, len(xstar), 6*int(m)+3*int(m)) )
781-
782-
782+
783783
# below we want the following sums (averages, see squaresum where we divide by m)
784784
# xmean1=np.sum(xstar[j : j+m])
785785
# xmean2=np.sum(xstar[j+m : j+2*m])
@@ -790,16 +790,16 @@ def calc_mtotdev_phase(phase, rate, m):
790790
# faster inner sum, based on Stable32 MTC.c code
791791
if j == 0:
792792
# intialize the sum
793-
xmean1 = np.sum( xstar[0:m] )
794-
xmean2 = np.sum( xstar[m:2*m] )
795-
xmean3 = np.sum( xstar[2*m:3*m] )
793+
xmean1 = np.sum(xstar[0:m])
794+
xmean2 = np.sum(xstar[m:2*m])
795+
xmean3 = np.sum(xstar[2*m:3*m])
796796
else:
797797
# j>=1, subtract old point, add new point
798798
xmean1 = xmean1 - xstar[j-1] + xstar[j+m-1] #
799799
xmean2 = xmean2 - xstar[m+j-1] + xstar[j+2*m-1] #
800800
xmean3 = xmean3 - xstar[2*m+j-1] + xstar[j+3*m-1] #
801801

802-
squaresum += pow( (xmean1 - 2.0*xmean2 + xmean3)/float(m), 2)
802+
squaresum += pow((xmean1 - 2.0*xmean2 + xmean3)/float(m), 2)
803803

804804
squaresum = (1.0/(6.0*m)) * squaresum
805805
dev += squaresum
@@ -817,7 +817,7 @@ def htotdev(data, rate=1.0, data_type="phase", taus=None):
817817
""" PRELIMINARY - REQUIRES FURTHER TESTING.
818818
Hadamard Total deviation.
819819
Better confidence at long averages for Hadamard deviation
820-
820+
821821
Computed for N fractional frequency points y_i with sampling
822822
period tau0, analyzed at tau = m*tau0
823823
1. remove linear trend by averaging first and last half and divide by interval
@@ -941,17 +941,17 @@ def calc_htotdev_freq(freq, m):
941941
# new faster way of doing the sums
942942
if j == 0:
943943
# intialize the sum
944-
xmean1 = np.sum( xstar[0:m] )
945-
xmean2 = np.sum( xstar[m:2*m] )
946-
xmean3 = np.sum( xstar[2*m:3*m] )
944+
xmean1 = np.sum(xstar[0:m])
945+
xmean2 = np.sum(xstar[m:2*m])
946+
xmean3 = np.sum(xstar[2*m:3*m])
947947
else:
948948
# j>=1, subtract old point, add new point
949949
xmean1 = xmean1 - xstar[j-1] + xstar[j+m-1] #
950950
xmean2 = xmean2 - xstar[m+j-1] + xstar[j+2*m-1] #
951951
xmean3 = xmean3 - xstar[2*m+j-1] + xstar[j+3*m-1] #
952952

953-
squaresum += pow( (xmean1 - 2.0*xmean2 + xmean3)/float(m), 2)
954-
953+
squaresum += pow((xmean1 - 2.0*xmean2 + xmean3)/float(m), 2)
954+
955955
k = k+1
956956
assert k == 6*m # check number of terms in the sum
957957
squaresum = (1.0/(6.0*k)) * squaresum
@@ -1097,7 +1097,7 @@ def mtie_rolling_window(a, window):
10971097
-------
10981098
Array that is a view of the original array with a added dimension
10991099
of size window.
1100-
1100+
11011101
Note
11021102
----
11031103
This may consume large amounts of memory. See discussion:

allantools/dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
from . import allantools
3232

3333

34-
class Dataset():
34+
class Dataset(object):
3535
""" Dataset class for Allantools
3636
3737
:Example:

allantools/plot.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"""
3030

3131

32-
class Plot():
32+
class Plot(object):
3333
""" A class for plotting data once computed by Allantools
3434
3535
:Example:
@@ -67,7 +67,7 @@ def plot(self, atDataset,
6767
errorbars=False,
6868
grid=False,
6969
**kwargs
70-
):
70+
):
7171
""" Use matplotlib methods for plotting
7272
7373
Additional keywords arguments are passed to
@@ -88,12 +88,12 @@ def plot(self, atDataset,
8888
atDataset.out["stat"],
8989
yerr=atDataset.out["stat_err"],
9090
**kwargs
91-
)
91+
)
9292
else:
9393
self.ax.plot(atDataset.out["taus"],
9494
atDataset.out["stat"],
9595
**kwargs
96-
)
96+
)
9797
self.ax.set_xlabel("Tau")
9898
self.ax.set_ylabel(atDataset.out["stat_id"])
9999
self.ax.grid(grid, which="minor", ls="-", color='0.65')
@@ -108,4 +108,6 @@ def show(self):
108108
self.plt.show()
109109

110110
def save(self, f):
111+
"""Save figure to file
112+
"""
111113
self.plt.savefig(f)

0 commit comments

Comments
 (0)
0