MCPcopy Index your code
hub / github.com/tyiannak/pyAudioAnalysis / generateColorMap

Function generateColorMap

pyAudioAnalysis/audioVisualization.py:18–33  ·  view source on GitHub ↗

This function generates a 256 jet colormap of HTML-like hex string colors (e.g. FF88AA)

()

Source from the content-addressed store, hash-verified

16
17
18def 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
36def levenshtein(str1, s2):

Callers 2

text_list_to_colorsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected