- Timestamp:
- 07/05/23 18:37:46 (17 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
framspy/dissimilarity/density-distribution.py
r1225 r1266 231 231 232 232 233 def normalize(self, signature): 234 """Normalizes the signature values by dividing it by the sum of elements. 235 Args: 236 signature np.array(,dtype=float): array of signature values. 237 238 Returns: 239 np.array(,dtype=float): array of normalized signature 240 """ 241 total = np.sum(signature) 242 return np.divide(signature, total) 243 244 233 245 def calculateDissimforVoxels(self, voxels1, voxels2): 234 246 """Calculates EMD for pair of voxels representing models. … … 278 290 279 291 if self.frequency: 280 out = emd(s 1,s2,np.array(dist_matrix,dtype=np.float64))292 out = emd(self.normalize(s1),self.normalize(s2),np.array(dist_matrix,dtype=np.float64)) 281 293 else: 282 out = emd(s 1[1],s2[1],dist_matrix)294 out = emd(self.normalize(s1[1]),self.normalize(s2[1]),dist_matrix) 283 295 284 296 self.libm.feclearexcept(0x04) # restoring default flag values...
Note: See TracChangeset
for help on using the changeset viewer.