MCPcopy Create free account
hub / github.com/ActiveState/code / do

Function do

recipes/Python/580649_nbitarray/recipe-580649.py:117–122  ·  view source on GitHub ↗
(array, name, size)

Source from the content-addressed store, hash-verified

115 low_res_sinus = [int(math.sin(i) * 0x3) & 0x3FFFFF for i in range(10000)]
116
117 def do(array, name, size) :
118 data = nBitArray(size).load_data(array)._data.tobytes()
119 compressed = gzip.compress(data)
120 print("{3}:{4} bits: {0} -> {1} ({2:0.1f} %)".format(
121 len(data), len(compressed), 100 * len(compressed) / len(data), name, size)
122 )
123
124 do(high_res_sinus, "high_res_sinus", 22)
125 do(high_res_sinus, "high_res_sinus", 24)

Callers 1

recipe-580649.pyFile · 0.70

Calls 5

nBitArrayClass · 0.85
printFunction · 0.85
load_dataMethod · 0.80
compressMethod · 0.80
formatMethod · 0.45

Tested by

no test coverage detected