diff options
Diffstat (limited to 'util')
| -rw-r--r-- | util/genluts.py | 30 | ||||
| -rw-r--r-- | util/view.py | 11 |
2 files changed, 41 insertions, 0 deletions
diff --git a/util/genluts.py b/util/genluts.py new file mode 100644 index 0000000..fcaead9 --- /dev/null +++ b/util/genluts.py @@ -0,0 +1,30 @@ +import sys +import numpy as np + +f = open('src/luts.c', 'w') + +# header +f.write('/*\n') +f.write(' * Copyright (c) 2018 Vasile Vilvoiu (YO7JBP) <vasi.vilvoiu@gmail.com>\n') +f.write(' *\n') +f.write(' * libsstv is free software; you can redistribute it and/or modify\n') +f.write(' * it under the terms of the MIT license. See LICENSE for details.\n') +f.write(' */\n\n') +f.write('#include "luts.h"\n\n') + +x = np.linspace(0.0, 2 * np.pi, num=1024, endpoint=False) +sn = np.sin(x) + +# SSTV_SIN_INT10_INT8 +f.write('int8_t SSTV_SIN_INT10_INT8[1024] = { ') +for s in sn * 127: + f.write(str(int(np.around(s))) + ', ') +f.write('};\n\n') + +# SSTV_SIN_INT10_INT16 +f.write('int16_t SSTV_SIN_INT10_INT16[1024] = { ') +for s in sn * 32767: + f.write(str(int(np.around(s))) + ', ') +f.write('};\n\n') + +f.close()
\ No newline at end of file diff --git a/util/view.py b/util/view.py new file mode 100644 index 0000000..b6e95fe --- /dev/null +++ b/util/view.py @@ -0,0 +1,11 @@ +import sys +import numpy as np +import matplotlib.pyplot as plt + +f = open('test.csv') +lines = [int(l.replace('\n', '')) for l in f.readlines()[:-2]] +f.close() + +s = np.array(lines) +plt.plot(s) +plt.show() |
