Skip to content
Snippets Groups Projects
Commit bb78f168 authored by Recolic Keghart's avatar Recolic Keghart
Browse files

inputer

parent 95666e34
No related branches found
No related tags found
No related merge requests found
#!/bin/env python3
# Type data into https://recolic.net/phy
# Edit&reuse it if you want.
# I'm making it print python code for other usage.
# Recolic Keghart.
import sys
if len(sys.argv) < 2:
print('Usage: ./dataInput.py /path/to/dat/file | python')
exit(123)
import numpy
dataset=numpy.loadtxt(sys.argv[1], delimiter=' ')
print('#!/bin/env python3')
print('from pykeyboard import PyKeyboard')
print('import time')
print('k=PyKeyboard()')
oneLine=False
for ar in dataset:
if type(ar) == numpy.float64:
ar=dataset #fuck numpy......
oneLine=True
if len(ar) == 0:
continue
print('print(\'Waiting for 5 second... Please be ready for auto-typing.\')')
print('time.sleep(5)')
for i in ar:
print('k.type_string(\''+ str(i) +'\')')
print('k.tap_key(k.tab_key)')
if oneLine:
break
36837 37258 36845 37345 36870 37283 36855 37327 36843 37261
3.54 4.37 8.26 25.9 13.2 47.7 17.7 66.95 22.46 87.16 27.14 108.6 32.06 129.9 36.68 150.8 41.48 173.35 46.3 194.69 50.86 217.16 55.8 239.56
36837 37258 36845 37345 36870 37283 36855 37327 36843 37261
3.54 4.37 8.26 25.9 13.2 47.7 17.7 66.95 22.46 87.16 27.14 108.6 32.06 129.9 36.68 150.8 41.48 173.35 46.3 194.69 50.86 217.16 55.8 239.56
sound2
sound3
3.54 8.26 13.20 17.70 22.46 27.14 32.06 36.68 41.48 46.30 50.86 55.80
4.37 25.90 47.70 66.95 87.16 108.60 129.90 150.80 173.35 194.69 217.16 239.56
conv
3.54 4.37 8.26 25.9 13.2 47.7 17.7 66.95 22.46 87.16 27.14 108.6 32.06 129.9 36.68 150.8 41.48 173.35 46.3 194.69 50.86 217.16 55.8 239.56
sound1
36837 37258 36845 37345 36870 37283 36855 37327 36843 37261
#!/bin/env python3
# Type data into https://recolic.net/phy
# Edit&reuse it if you want.
# I'm making it print python code for other usage.
# Recolic Keghart.
import sys
if len(sys.argv) < 2:
print('Usage: ./dataInput.py /path/to/dat/file | python')
exit(123)
import numpy
dataset=numpy.loadtxt(sys.argv[1], delimiter=' ')
print('#!/bin/env python3')
print('from pykeyboard import PyKeyboard')
print('import time')
print('k=PyKeyboard()')
oneLine=False
for ar in dataset:
if type(ar) == numpy.float64:
ar=dataset #fuck numpy......
oneLine=True
if len(ar) == 0:
continue
print('print(\'Waiting for 5 second... Please be ready for auto-typing.\')')
print('time.sleep(5)')
for i in ar:
print('k.type_string(\''+ str(i) +'\')')
print('k.tap_key(k.tab_key)')
if oneLine:
break
#!/bin/env python3
# -*- coding: UTF-8 -*-
# Gereric: Draw line.
# Recolic Keghart, Apr 29, 2017.
import numpy
from scipy.optimize import leastsq
import matplotlib.pyplot as plt
from matplotlib import rcParams
def GetMap(parrX, parrY, windowX = 12, windowY = 8, line = False, passO = False):
print('Generic-GetMap by Recolic.')
arrX, arrY = parrX, parrY
maxX, maxY = max(arrX)*1.2, max(arrY)*1.25
# Do calculate
# y = k x + b (I = k V + b)
print('Your input: ', arrX, '|', arrY)
print('Data collection done. Generating result...')
V, I = numpy.array(arrX), numpy.array(arrY)
def lineFunc(kb, v):
k,b=kb
if passO:
return k*v
else:
return k*v+b
lossFunc = lambda kb, v, i : lineFunc(kb, v) - i
# Fire!
if line:
kb0 = [10,0]
kbFinal = leastsq(lossFunc, kb0, args=(V, I))
k,b=kbFinal[0]
print('Fit line done. Y=', k, 'X +', b)
else:
print('Drawing map without fitting a line...')
# Draw function map.
rcParams['grid.linestyle']='-'
rcParams['grid.color'] = 'blue'
rcParams['grid.linewidth'] = 0.2
plt.figure(figsize=(windowX, windowY))
plt.scatter(V,I,color="red",label="Sample Point",linewidth=3)
if line:
px=numpy.linspace(0,maxX,1000)
py=k*px+b
plt.plot(px,py,color="orange",label="Fitting Line",linewidth=2)
plt.legend()
plt.grid()
plt.show()
def toFloat(sstr):
if sstr == '':
return 0.0
else:
return float(sstr)
\ No newline at end of file
try https://recolic.net/phy
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment