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

Maybe libquickmap is harder to use now. Add some doc.

parent bb6ab2c7
No related branches found
No related tags found
No related merge requests found
......@@ -5,7 +5,7 @@
!_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 ../quickmap.py /^def GetMap(parrX, parrY, windowSizeX=12, windowSizeY=8, extendXRate=1, extendYRate=1, line=False, passO=False, maxXPower=1, inverseK=False):$/;" kind:function line:20
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
......@@ -33,7 +33,9 @@ dataset ../input/dataInput.py /^dataset=numpy.loadtxt(sys.argv[1], delimiter=' '
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
dotMultiply ../quickmap.py /^def dotMultiply(vctA, vctB):$/;" kind:function line:11
draw ../va/va.py /^from quickmap import GetMap as draw$/;" kind:namespace line:4
draw1.py ../ThermalConductivity/draw1.py 1;" kind:file line:1
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
......@@ -72,12 +74,13 @@ leastsq ../va/quickmap.py /^from scipy.optimize import leastsq$/;" kind:namespac
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 ../quickmap.py /^ def lineFunc(k, x):$/;" kind:function line:31
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
lossFunc ../quickmap.py /^ def lossFunc(k, x, y): return abs(lineFunc(k, x) - y)$/;" kind:function line:37
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
......@@ -123,6 +126,7 @@ 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 ../test.py /^import quickmap$/;" kind:namespace line:1
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
......@@ -151,13 +155,14 @@ 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
test.py ../test.py 1;" kind:file line:1
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 ../quickmap.py /^ def toFloat(sstr):$/;" kind:function line:70
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
......@@ -168,5 +173,7 @@ 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
xrc ../test.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:4
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
yrc ../test.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:3
import numpy
import matplotlib.pyplot as plt
from matplotlib import rcParams
# Points here!
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]
x=xrc
y=[abs(yi) for yi in yrc]
# Draw function map.
rcParams['grid.linestyle']='-'
rcParams['grid.color'] = 'blue'
rcParams['grid.linewidth'] = 0.2
plt.figure(figsize=(8,6)) # Change 8 to yMax here.
plt.scatter(x,y,color="red",label="Sample Point",linewidth=3)
px=numpy.linspace(0,65,1000)
plt.legend()
plt.grid()
plt.show()
\ No newline at end of file
B: d h mm
99.78 99.72 99.72 99.68 99.70
8.26 8.40 8.42 8.34 8.20
C: d h mm
99.82 99.70 99.72 99.72 99.86
9.86 9.90 9.88 9.74 9.82
Init: Ta = 0.3 + Tc
min Ta Tc(^C)
min T1 T2(^C)
0 18.7 19.4
2 36.0 19.4
4 47.8 20.0
6 50.2 21.6
8 50.3 23.3
10 50.2 25.0
12 50.3 26.8
14 50.4 28.3
16 50.4 29.4
18 50.5 30.7
20 50.5 31.8
22 50.5 32.9
24 50.5 33.5
26 50.6 34.3
28 50.5 34.9
30 50.6 35.6
32 50.5 36.1
34 50.7 36.7
36 50.8 37.0
38 50.8 37.5
40 50.8 37.8
42 50.8 38.2
44 50.8 38.5
46 50.8 38.8
48 50.9 39.0
50 50.9 39.3
52 50.9 39.5
54 50.9 39.6
56 50.9 39.8
58 50.9 39.9
60 50.9 40.1
62 50.9 40.2
64 50.9 40.3
66 51.0 40.4
68 51.0 40.6
70 51.0 40.6
72 51.1 40.7
74 51.1 40.8
76 51.1 40.8
78 51.1 40.9
80 51.1 41.0
82 51.1 41.0
84 51.1 41.0
86 51.1 41.0
88 51.1 41.0
90 51.2 41.0
92 51.2 41.0
t(s) Tc(^C)
0 43.2
30 42.9
60 42.5
90 42.2
120 41.9
150 41.5
180 41.2
210 40.9
240 40.5
270 40.3
300 40.0
330 39.7
360 39.4
390 39.1
420 38.8
450 38.5
480 38.2
#!/usr/bin/env python3
minutes = [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92]
rawTa = [18.7, 36.0, 47.8, 50.2, 50.3, 50.2, 50.3, 50.4, 50.4, 50.5, 50.5, 50.5, 50.5, 50.6, 50.5, 50.6, 50.5, 50.7, 50.8, 50.8, 50.8, 50.8, 50.8, 50.8, 50.9, 50.9, 50.9, 50.9, 50.9, 50.9, 50.9, 50.9, 50.9, 51.0, 51.0, 51.0, 51.1, 51.1, 51.1, 51.1, 51.1, 51.1, 51.1, 51.1, 51.1, 51.2, 51.2]
rawTa = [Ti - 0.3 for Ti in rawTa]
rawTc = [19.4, 19.4, 20.0, 21.6, 23.3, 25.0, 26.8, 28.3, 29.4, 30.7, 31.8, 32.9, 33.5, 34.3, 34.9, 35.6, 36.1, 36.7, 37.0, 37.5, 37.8, 38.2, 38.5, 38.8, 39.0, 39.3, 39.5, 39.6, 39.8, 39.9, 40.1, 40.2, 40.3, 40.4, 40.6, 40.6, 40.7, 40.8, 40.8, 40.9, 41.0, 41.0, 41.0, 41.0, 41.0, 41.0, 41.0]
import sys
sys.path.append("..")
import quickmap
##for powerTest in range(16):
## quickmap.GetMap(minutes, rawTa, line=True, maxXPower=powerTest)#, inverseK=True)
##for powerTest in range(16):
## quickmap.GetMap(minutes, rawTa, line=True, maxXPower=powerTest, inverseK=True)
#for powerTest in range(16):
# print(">>>", powerTest)
# quickmap.GetMap(minutes, rawTc, line=True, maxXPower=powerTest)#, inverseK=True)
##for powerTest in range(16):
## quickmap.GetMap(minutes, rawTc, line=True, maxXPower=powerTest, inverseK=True)
quickmap.GetMap(minutes, rawTa)
quickmap.GetMap(minutes, rawTc, line=True, maxXPower=9)
\ No newline at end of file
#!/usr/bin/env python3
time = [0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 360, 390, 420, 450, 480]
tc = [43.2, 42.9, 42.5, 42.2, 41.9, 41.5, 41.2, 40.9, 40.5, 40.3, 40.0, 39.7, 39.4, 39.1, 38.8, 38.5, 38.2]
import sys
sys.path.append("..")
import quickmap
quickmap.GetMap(time, tc, line=True)
......@@ -18,6 +18,18 @@ def dotMultiply(vctA, vctB):
return ans
def GetMap(parrX, parrY, windowSizeX=12, windowSizeY=8, extendXRate=1, extendYRate=1, line=False, passO=False, maxXPower=1, inverseK=False):
'''
Arguments:
parrX and parrY: array of coordinates of points. Ex: GetMap([1,2,3,4,5], [1,2,3,4,5]) -> y=x
line: Should I draw a fitting line?
passO: Should the fitting line pass (0,0)? That's saying, should k0 be zero?
maxXPower: If I should draw a fitting line, what polynomial function should I use? Ex: GetMap([1,2,3,4,5], [1,4,9,16,25], line=True, maxXPower) -> y=x^2
inverseK: Usually, I'm drawing the curl `y=KX`, while K=[k0,k1,k2,...], X=[x^0,x^1,x^2,...]. If this switch is set, I'll drawing the curl `KY=x`. Don't worry, this switch is transparent to you.
Ex: GetMap([0,1,1,4,4,9,9], [0,1,-1,2,-2,3,-3], maxXPower=2, line=True, inverseK=True) -> y^2=x
ReturnValue:
void
'''
print('Generic-GetMap by Recolic.')
arrX, arrY = parrX, parrY
maxX, maxY = max(arrX) * extendXRate, max(arrY) * extendYRate
......@@ -42,10 +54,10 @@ def GetMap(parrX, parrY, windowSizeX=12, windowSizeY=8, extendXRate=1, extendYRa
kInit[0] = 0 # guarantee passO.
if inverseK:
kFinal, _ = leastsq(lossFunc, kInit, args=(Y, X))
print('Fit line done. k^-1=', kFinal)
print('Fitting line done. k^-1=', kFinal)
else:
kFinal, _ = leastsq(lossFunc, kInit, args=(X, Y))
print('Fit line done. k=', kFinal)
print('Fitting line done. k=', kFinal)
else:
print('Drawing map without fitting a line...')
......
......@@ -9,7 +9,7 @@ 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.')
print('This quickmap.py is deleted becaused of out of date!!!')
arrX, arrY = parrX, parrY
maxX, maxY = max(arrX)*1.2, max(arrY)*1.25
......@@ -54,4 +54,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)
......@@ -9,7 +9,7 @@ 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.')
print('This quickmap.py is deleted becaused of out of date!!!')
arrX, arrY = parrX, parrY
maxX, maxY = max(arrX)*1.2, max(arrY)*1.25
......@@ -54,4 +54,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)
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