Skip to content

Instantly share code, notes, and snippets.

@Reboare
Created December 21, 2012 00:53
Show Gist options
  • Save Reboare/4349905 to your computer and use it in GitHub Desktop.
Save Reboare/4349905 to your computer and use it in GitHub Desktop.
Waste of TIme
from numpy import array
import numpy as n
import pylab
def best_fit_line(x,y, color):
coefs = n.lib.polyfit(x,y,1)
fit_y = n.lib.polyval(coefs, x)
pylab.plot(x, fit_y, color)
Task4 = {}
Task4["current"] = array([0.0000002,0.0000007,0.0000015,0.0000026,0.0000047,0.0000086,0.0000169,0.0000309,0.0000516,0.000092])
Task4["voltage"] = array([0.201,0.267,0.301,0.330,0.359,0.389,0.422,0.451,0.480,0.503])
Task4["AlphaVoltage"] = array([0.001]*10)
Task4["AlphaCurrent"] = array([1*10^-7]*10)
Task4["logCurrent"] = n.log(Task4["current"])
Task4["AlphaLogCurrent"] = Task4["AlphaCurrent"]/Task4["current"]
Task1 = {}
Task1["temperature"] = 21.7+273.15
Task1["current"] = array([x*10**(-6) for x in [1.2,0.9,0.6,0.4,0.2,248,100,42,18,6]])
Task1["AlphaCurrent"] = array([x*10**(-6) for x in [0.1,0.1,0.1,0.1,0.1,1,1,1,1,0.1]])
Task1["voltage"] = array([0.025,0.021,0.014,0.01,0.005,0.211,0.18,0.15,0.12,0.075])
Task1["AlphaVoltage"] = array([0.001 for x in range(10)])
Task1["logCurrent"] = n.log(Task1["current"])
Task1["AlphaLogCurrent"] = Task1["AlphaCurrent"]/Task1["current"]
pylab.errorbar(Task1["voltage"],Task1["logCurrent"], fmt = "bo")
best_fit_line(Task1["voltage"],Task1["logCurrent"], "b--")
pylab.errorbar(Task4["voltage"],Task4["logCurrent"], fmt = "ro")
best_fit_line(Task4["voltage"],Task4["logCurrent"], "r--")
pylab.ylabel("ln(Current)")
pylab.xlabel("Voltage (V)")
#Calculate Function
pylab.text(0.4,-12,"hello World")
pylab.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment