Changeset 1322
- Timestamp:
- 08/09/24 05:33:09 (2 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
framspy/dissimilarity/density_distribution.py
r1295 r1322 9 9 """ 10 10 11 OLD_FPEX = False # update floating point exception handling/pyemd problems (if still needed) for new python versions 12 if OLD_FPEX: 13 libm = cdll.LoadLibrary(find_library('m')) # for disabling/enabling floating point exceptions (division by zero occurs in the EMD library) 11 libm = find_library('m') # for disabling/enabling floating point exceptions (division by zero occurs in the pyemd library) 12 if libm is not None: # libm.so (the mathematical library) is a part of Linux ecosystem - always present 13 libm = cdll.LoadLibrary(libm) 14 else: 15 print('\nWarning: The "m" library not found - floating point exceptions in pyemd may occur...\n') # but on Windows, pyemd does not seem to cause floating point exceptions 14 16 EPSILON = 0.0001 15 17 … … 293 295 dist_matrix = self.calculateDistanceMatrix(s1[0],s2[0]) 294 296 295 if self. OLD_FPEX:296 self.libm.fedisableexcept(0x04) # change default flag value - don't cause exceptions when dividing by 0 (pyemd does it)297 if self.libm is not None: 298 self.libm.fedisableexcept(0x04) # change default flag value - don't cause "Floating point exception" when dividing by 0 (pyemd does that, for example when comparing two identical histograms, i.e., two identical signatures, for example from two identical phenotypes) 297 299 298 300 if self.frequency: … … 301 303 out = emd(self.normalize(s1[1]),self.normalize(s2[1]),dist_matrix) 302 304 303 if self. OLD_FPEX:304 self.libm.feclearexcept(0x04) # restoring default flag values...305 if self.libm is not None: 306 self.libm.feclearexcept(0x04) # restoring default flag values... 305 307 self.libm.feenableexcept(0x04) 306 308
Note: See TracChangeset
for help on using the changeset viewer.