Skip to content

Commit

Permalink
remove side-effects of geometry **kwargs
Browse files Browse the repository at this point in the history
  • Loading branch information
jakevdp committed Mar 9, 2016
1 parent cf7c3df commit f818cdf
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions megaman/geometry/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,11 @@ def compute_adjacency_matrix(self, copy=False, **kwargs):
if self.X is None:
raise ValueError(distance_error_msg)

self.adjacency_kwds.update(kwargs)
kwds = self.adjacency_kwds.copy()
kwds.update(kwargs)
self.adjacency_matrix = compute_adjacency_matrix(self.X,
self.adjacency_method,
**self.adjacency_kwds)
**kwds)
if copy:
return self.adjacency_matrix.copy()
else:
Expand Down Expand Up @@ -186,10 +187,11 @@ def compute_affinity_matrix(self, copy=False, **kwargs):
if self.adjacency_matrix is None:
self.compute_adjacency_matrix()

self.affinity_kwds.update(kwargs)
kwds = self.affinity_kwds.copy()
kwds.update(kwargs)
self.affinity_matrix = compute_affinity_matrix(self.adjacency_matrix,
self.affinity_method,
**self.affinity_kwds)
**kwds)
if copy:
return self.affinity_matrix.copy()
else:
Expand Down Expand Up @@ -221,11 +223,12 @@ def compute_laplacian_matrix(self, copy=True, return_lapsym=False, **kwargs):
if self.affinity_matrix is None:
self.compute_affinity_matrix()

self.laplacian_kwds.update(kwargs)
self.laplacian_kwds['full_output'] = return_lapsym
kwds = self.laplacian_kwds.copy()
kwds.update(kwargs)
kwds['full_output'] = return_lapsym
result = compute_laplacian_matrix(self.affinity_matrix,
self.laplacian_method,
**self.laplacian_kwds)
**kwds)
if return_lapsym:
(self.laplacian_matrix,
self.laplacian_symmetric,
Expand Down

0 comments on commit f818cdf

Please sign in to comment.