Last active
May 11, 2022 03:51
-
-
Save phsantiago/cc3576257abe1242bdeadd8046a680df to your computer and use it in GitHub Desktop.
Python charts with numpy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from matplotlib import pyplot as plt | |
concentrationCurve = [100,50,25,12.5,6.25,3.125,0] | |
opticalDensityCurve = [0.7755,0.3205,0.1325,0.061,0.038,0.029,0.026] | |
concentrationSamples = [19.1,28.05,44.44,59.38,68.67,74.27,91.33] | |
opticalDensitySample = [0.1065,0.1585,0.268,0.384,0.464,0.515,0.684] | |
concentration = concentrationCurve + concentrationSamples | |
opticalDensity = opticalDensityCurve + opticalDensitySample | |
plt.scatter(concentrationCurve, opticalDensityCurve, c='lightblue') | |
plt.scatter(concentrationSamples, opticalDensitySample, c='darkblue') | |
#polynomial fit with degree = 2 | |
model = np.poly1d(np.polyfit(concentration, opticalDensity, 2)) | |
plt.xlabel ('SNAP concentration (µM)') | |
plt.ylabel ('Optical Density (OD)') | |
plt.title ('Curva de concentração do SNAP e pontos de amostragem') | |
#add fitted polynomial line to scatterplot | |
polyline = np.linspace(1, 125, 50) | |
#plt.scatter(concentration, od) | |
#plt.plot(polyline, model(polyline)) | |
plt.show() | |
print("model:") | |
print(model) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment