33import warnings , copy
44
55"""
6- Base class for pairwise statistics.
7-
8- The child classes should either overload the mpi method (if it computes the full mpi)
9- or the bivariate method if it computes only pairwise statisticss
10- """
11-
12- """
13- Some parsing functions for decorating so that we can either input the processes directly or use the data structure
6+ Some parsing functions for decorating so that we can either input the time series directly or use the data structure
147"""
158def parse_univariate (function ):
169 def parsed_function (self ,data ,i = None ,inplace = True ):
@@ -20,7 +13,7 @@ def parsed_function(self,data,i=None,inplace=True):
2013 elif not inplace :
2114 # Ensure we don't write over the original
2215 data = copy .deepcopy (data )
23-
16+
2417 if i is None :
2518 if data .n_processes == 1 :
2619 i = 0
@@ -36,15 +29,15 @@ def parsed_function(self,data,data2=None,i=None,j=None,inplace=True):
3629 if not isinstance (data ,Data ):
3730 if data2 is None :
3831 raise TypeError ('Input must be either a pyspi.data object or two 1D-array inputs.'
39- f' Received { type (data )} and { type (data2 )} .' )
32+ f' Received { type (data )} and { type (data2 )} .' )
4033 data1 = data
4134 data = Data ()
4235 data .add_process (data1 )
4336 data .add_process (data2 )
4437 elif not inplace :
4538 # Ensure we don't write over the original
4639 data = copy .deepcopy (data )
47-
40+
4841 if i is None and j is None :
4942 if data .n_processes == 2 :
5043 i ,j = 0 ,1
@@ -74,8 +67,8 @@ def parsed_function(self,data,inplace=True):
7467
7568 return parsed_function
7669
77- class directed :
78- """ Directed statistics
70+ class Directed :
71+ """ Base class for directed statistics
7972 """
8073
8174 name = 'Bivariate base class'
@@ -125,7 +118,9 @@ def get_group(self,classes):
125118 pass
126119 return None
127120
128- class undirected (directed ):
121+ class Undirected (Directed ):
122+ """ Base class for directed statistics
123+ """
129124
130125 name = 'Base class'
131126 identifier = 'base'
@@ -136,17 +131,20 @@ def ispositive(self):
136131
137132 @parse_multivariate
138133 def multivariate (self ,data ):
139- A = super (undirected ,self ).multivariate (data )
140-
134+ A = super (Undirected ,self ).multivariate (data )
135+
141136 li = np .tril_indices (data .n_processes ,- 1 )
142137 A [li ] = A .T [li ]
143138 return A
144139
145- # Maybe this would be more pythonic as decorators or something?
146- class signed :
140+ class Signed :
141+ """ Base class for signed SPIs
142+ """
147143 def issigned (self ):
148144 return True
149-
150- class unsigned :
145+
146+ class Unsigned :
147+ """ Base class for unsigned SPIs
148+ """
151149 def issigned (self ):
152150 return False
0 commit comments