Skip to content
Snippets Groups Projects
Commit 01702c96 authored by Jérôme Hofstetter's avatar Jérôme Hofstetter
Browse files

report finished

parent e2e0b0b2
No related branches found
No related tags found
No related merge requests found
from csv_handling import *
from utils import *
import matplotlib.pyplot as plt
key= "source_150_Zener_50"
data = get_data_fromsearchkey(key,dtype="float")
......@@ -15,8 +16,8 @@ ax[0].set_title("measured Current")
ax[1].set_title("Ripple Voltage")
ax[0].plot(volt,current,label=key)
ax[1].plot(volt,ripple,label=key)
plotdata(ax[0],volt,current,label=key)
plotdata(ax[1],volt,ripple,label=key)
plt.legend()
plt.show()
\ No newline at end of file
from utils import *
key_list=["LM317_3_9","LM317_5_6","LM317_15","LM7805","LM7812","Set3" ]
plot_rms_ripple_voltage_keylist(key_list,show_abs_ripple=True)
plot_rms_ripple_voltage_keylist(key_list,show_abs_ripple=False)
from csv_handling import *
from utils import *
import re
key_list= ["half_wave_rect_10_uF","half_wave_rect_100_uF","half_wave_rect_1000_uF","full_wave_rect_1000_uF" ]
def plot_data_fromsearchkey(key,ax):
data = get_data_fromsearchkey(key,dtype="float")
ax[0].plot(data[0],data[1],label=key)
ax[1].plot(data[0],data[2])
ax[3].plot(data[0], data[2]/data[1]*100)
div = 2 if "full" in key else 1
capacity = int(re.search(r'(?<=_)\d+(?=_uF)', key).group())*1e-6
capacity = int(re.search(r'(?<=_)\d+(?=_uF)', key).group()) # in uF
mod_wave = "full" if "full" in key else "half"
label = f"{mod_wave} wave : {capacity} uF"
plotdata(ax[0],data[0],data[1],label=label)
plotdata(ax[1],data[0],data[2])
plotdata(ax[3],data[0], data[2]/data[1]*100)
freq = 50
calculated_ripple = data[0]/div/capacity/freq
ax[2].plot(data[0], data[2]/calculated_ripple)
calculated_ripple = data[0]/div/capacity/freq*1e6
plotdata(ax[2],data[0], data[2]/calculated_ripple)
def plot_rms_ripple_voltage_keylist(keylist):
......
......@@ -2,17 +2,19 @@ from csv_handling import *
import matplotlib.pyplot as plt
from numerical_math import *
def plotdata(x,y,label=None,zorder=1):
return plt.plot(x,y,label=label,marker='o', linestyle='-', linewidth=0.8,markersize=3,zorder=zorder)
def characterise_plot_transistor_current(data,label,show_lines=True):
x,y = data[0],data[1]
if not show_lines:
plt.plot(x,y,label=label)
plotdata(x,y,label=label)
return
index_maxima=np.argmax(y)
label_char = f"{label}, maxima: {y[index_maxima]} at {x[index_maxima]}"
line=plt.plot(x,y,label=label_char)
line=plotdata(x,y,label=label_char,zorder=3)
x_deriv,y_deriv = num_deriv(x,y,w=1)
#tries to find the index where the derivative noticably dips
......
from csv_handling import *
import matplotlib.pyplot as plt
def plotdata(x,y,label=None,zorder=1):
return plt.plot(x,y,label=label,marker='o', linestyle='-', linewidth=0.8,markersize=3,zorder=zorder)
key= "source_150_Zener_50"
data1 = get_data_fromsearchkey("buffer_1k",dtype="float")
data2 = get_data_fromsearchkey("buffer_10k",dtype="float")
plt.plot(data1[0],data1[0]-data1[1],label="1k potentiometer")
plt.plot(data2[0],data2[0]-data2[1],label="10k potentiometer")
plotdata(data1[0],data1[0]-data1[1],label="1k potentiometer")
plotdata(data2[0],data2[0]-data2[1],label="10k potentiometer")
plt.xlabel("base voltage(V)")
plt.ylabel("base-collector voltage(V)")
plt.title("voltage base-collector")
......
......@@ -7,22 +7,34 @@ def get_zener_data(key):
pattern = r'([^_\d]+)_(\d+)(_(\d))?V_(\d+)'
match = re.search(pattern, key)
if not match:
return None,None,None
firstkey = match.group(1)
voltage = int(match.group(2))
if match.group(4):
voltage+=int(match.group(4))/10
resistance=int(match.group(5))
return resistance,voltage
return resistance,voltage,firstkey
def plotdata(axis,x,y,label=None):
axis.plot(x,y,label=label, marker='o', linestyle='-', linewidth=0.8,markersize=3,)
U_rms = 18.66
def plot_data_fromsearchkey(key,ax,try_zener_shift=False):
data = get_data_fromsearchkey(key,dtype="float")
current = data[0]
if try_zener_shift:
res,volt = get_zener_data(key)
current +=(U_rms-volt)/res
ax[0].plot(current,data[1],label=key)
ax[1].plot(current,data[2])
ax[2].plot(current, data[2]/data[1]*100)
res,volt,firstkey = get_zener_data(key)
label = key
if not(res is None):
if try_zener_shift:
current +=(U_rms-volt)/res
label = f"{firstkey}: {volt} V, {res} $\Omega$"
plotdata(ax[0],current,data[1],label=label,)
plotdata(ax[1],current,data[2],)
plotdata(ax[2],current, data[2]/data[1]*100,)
def plot_rms_ripple_voltage_keylist(keylist,try_zener_shift=False,show_abs_ripple=True):
......
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