shortened tainted_neighborhood logic
This commit is contained in:
parent
be47c744d8
commit
4d4278e6dd
|
@ -785,7 +785,7 @@ class Geom:
|
||||||
"""
|
"""
|
||||||
def mp(entry,mapper):
|
def mp(entry,mapper):
|
||||||
return mapper[entry] if entry in mapper else entry
|
return mapper[entry] if entry in mapper else entry
|
||||||
|
|
||||||
mp = np.vectorize(mp)
|
mp = np.vectorize(mp)
|
||||||
mapper = dict(zip(from_material,to_material))
|
mapper = dict(zip(from_material,to_material))
|
||||||
|
|
||||||
|
@ -836,13 +836,9 @@ class Geom:
|
||||||
def tainted_neighborhood(stencil,trigger):
|
def tainted_neighborhood(stencil,trigger):
|
||||||
|
|
||||||
me = stencil[stencil.shape[0]//2]
|
me = stencil[stencil.shape[0]//2]
|
||||||
if len(trigger) == 0:
|
return np.any(stencil != me
|
||||||
return np.any(stencil != me)
|
if len(trigger) == 0 else
|
||||||
if me in trigger:
|
np.in1d(stencil,np.array(list(set(trigger) - {me}))))
|
||||||
trigger = set(trigger)
|
|
||||||
trigger.remove(me)
|
|
||||||
trigger = list(trigger)
|
|
||||||
return np.any(np.in1d(stencil,np.array(trigger)))
|
|
||||||
|
|
||||||
offset_ = np.nanmax(self.material) if offset is None else offset
|
offset_ = np.nanmax(self.material) if offset is None else offset
|
||||||
mask = ndimage.filters.generic_filter(self.material,
|
mask = ndimage.filters.generic_filter(self.material,
|
||||||
|
|
Loading…
Reference in New Issue