Commit d247837c authored by Edward Andò's avatar Edward Andò
Browse files

numpy indexing with tuples with contacts

parent e3db4f22
Pipeline #62738 passed with stages
in 25 minutes and 37 seconds
......@@ -284,16 +284,16 @@ def contactPoints(lab, contactPairs, returnContactZones=False, boundingBoxes=Non
dilOnly = numpy.logical_xor(p2['subvol'], p1['subvol'])
labSlice = [slice(p1['slice'][0].start,p1['slice'][0].stop),
labSlice = (slice(p1['slice'][0].start,p1['slice'][0].stop),
slice(p1['slice'][1].start,p1['slice'][1].stop),
slice(p1['slice'][2].start,p1['slice'][2].stop)]
slice(p1['slice'][2].start,p1['slice'][2].stop))
labSubvol = lab[ labSlice ]
labSubvol = lab[labSlice]
if (dilOnly.shape == labSubvol.shape):
intersection = dilOnly * labSubvol
analysisVolume[ labSlice ][ intersection==label2 ] = n+1
analysisVolume[labSlice][intersection==label2] = n+1
else:
raise Exception(
......@@ -302,11 +302,11 @@ def contactPoints(lab, contactPairs, returnContactZones=False, boundingBoxes=Non
if returnContactZones:
return analysisVolume
else:
return spam.label.centresOfMass( analysisVolume )
return spam.label.centresOfMass(analysisVolume)
def labelledContacts( lab, maximumCoordinationNumber=20 ):
def labelledContacts(lab, maximumCoordinationNumber=20):
"""
Uniquely names contacts based on grains.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment