Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It would be nice to have a I_V curve subclass of MeasuredFunction #14

Open
thomaslima opened this issue Apr 18, 2019 · 0 comments
Open

Comments

@thomaslima
Copy link
Member

Use case without one:

from scipy.stats import linregress
import matplotlib.pyplot as plt
I_V = MeasuredFunction(swp.data['Voltage (V)'], swp.data['Current (mA)'])
def get_R_parallel(I_V):
    linear_region = I_V.crop([0, 0.3])
    slope, intercept, r_value, p_value, std_err = linregress(linear_region.absc, linear_region.ordi)
    return 1 / slope * 1000
R_mod = get_R_mod(I_V)

print(f"Modulator's parallel resistance: {R_mod:.2f}Ω")
I_V_mod = I_V - MeasuredFunction(swp.data['Voltage (V)'], swp.data['Voltage (V)'] / R_mod * 1000)
I_V_mod.simplePlot()
plt.xlabel('Voltage (V)') 
plt.ylabel('Current (mA)')
plt.show()

plt.figure()
plt.semilogy(I_V_mod.absc, np.abs(I_V_mod.ordi))
plt.xlabel('Voltage (V)') 
plt.ylabel('Current (mA)')
plt.show()

def get_R_series(I_V):
    linear_region = I_V.crop([1.1, 1.2])
    slope, intercept, r_value, p_value, std_err = linregress(linear_region.absc, linear_region.ordi)
    return 1 / slope * 1000

R_series = get_R_series(I_V)
print(f"Modulator's series resistance: {R_series:.2f}Ω")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant