@@ -77,7 +77,7 @@ def local_density(max_id, distances, dc, guass=True, cutoff=False):
77
77
Returns:
78
78
local density vector that index is the point index that start from 1
79
79
"""
80
- assert guass and cutoff == False and guass or cutoff == True
80
+ assert guass and cutoff is False and guass or cutoff is True
81
81
logger .info ("PROGRESS: compute local density" )
82
82
guass_func = lambda dij , dc : math .exp (- (dij / dc ) ** 2 )
83
83
cutoff_func = lambda dij , dc : 1 if dij < dc else 0
@@ -137,9 +137,9 @@ def local_density(self, distances, max_dis, min_dis, max_id, dc=None, auto_selec
137
137
Returns:
138
138
local density vector, dc
139
139
"""
140
- assert not (dc != None and auto_select_dc )
140
+ assert not (dc is not None and auto_select_dc )
141
141
142
- if dc == None :
142
+ if dc is None :
143
143
dc = select_dc (max_id , max_dis , min_dis , distances , auto = auto_select_dc )
144
144
rho = local_density (max_id , distances , dc )
145
145
return rho , dc
@@ -163,7 +163,7 @@ def cluster(self, distances, max_dis, min_dis, max_id, density_threshold, distan
163
163
Returns:
164
164
local density vector, min_distance vector, nearest neighbor vector
165
165
"""
166
- assert not (dc != None and auto_select_dc )
166
+ assert not (dc is not None and auto_select_dc )
167
167
rho , dc = self .local_density (distances , max_dis , min_dis , max_id , dc = dc , auto_select_dc = auto_select_dc )
168
168
delta , nneigh = min_distance (max_id , max_dis , distances , rho )
169
169
logger .info ("PROGRESS: start cluster" )
0 commit comments