This function generates a 256 jet colormap of HTML-like hex string colors (e.g. FF88AA)
()
| 16 | |
| 17 | |
| 18 | def generateColorMap(): |
| 19 | ''' |
| 20 | This function generates a 256 jet colormap of HTML-like |
| 21 | hex string colors (e.g. FF88AA) |
| 22 | ''' |
| 23 | Map = cm.jet(np.arange(256)) |
| 24 | stringColors = [] |
| 25 | for i in range(Map.shape[0]): |
| 26 | rgb = (int(255*Map[i][0]), int(255*Map[i][1]), int(255*Map[i][2])) |
| 27 | if (sys.version_info > (3, 0)): |
| 28 | stringColors.append((struct.pack('BBB', *rgb).hex())) # python 3 |
| 29 | else: |
| 30 | stringColors.append( |
| 31 | struct.pack('BBB', *rgb).encode('hex')) # python2 |
| 32 | |
| 33 | return stringColors |
| 34 | |
| 35 | |
| 36 | def levenshtein(str1, s2): |
no outgoing calls
no test coverage detected