-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2f7e6ca
commit 9580990
Showing
12 changed files
with
18,086 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,191 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"id": "ada63d23", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import numpy as np\n", | ||
"import pandas as pd" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"id": "c3f95fe9", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/html": [ | ||
"<div>\n", | ||
"<style scoped>\n", | ||
" .dataframe tbody tr th:only-of-type {\n", | ||
" vertical-align: middle;\n", | ||
" }\n", | ||
"\n", | ||
" .dataframe tbody tr th {\n", | ||
" vertical-align: top;\n", | ||
" }\n", | ||
"\n", | ||
" .dataframe thead th {\n", | ||
" text-align: right;\n", | ||
" }\n", | ||
"</style>\n", | ||
"<table border=\"1\" class=\"dataframe\">\n", | ||
" <thead>\n", | ||
" <tr style=\"text-align: right;\">\n", | ||
" <th></th>\n", | ||
" <th>0</th>\n", | ||
" <th>1</th>\n", | ||
" <th>2</th>\n", | ||
" </tr>\n", | ||
" </thead>\n", | ||
" <tbody>\n", | ||
" <tr>\n", | ||
" <th>0</th>\n", | ||
" <td>3.000000e-10</td>\n", | ||
" <td>2.270000e-12</td>\n", | ||
" <td>2.240000e-12</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>1</th>\n", | ||
" <td>3.000000e-10</td>\n", | ||
" <td>2.060000e-12</td>\n", | ||
" <td>1.900000e-12</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>2</th>\n", | ||
" <td>3.000000e-10</td>\n", | ||
" <td>2.790000e-12</td>\n", | ||
" <td>1.560000e-12</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>3</th>\n", | ||
" <td>2.990000e-10</td>\n", | ||
" <td>2.600000e-12</td>\n", | ||
" <td>1.930000e-12</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>4</th>\n", | ||
" <td>2.990000e-10</td>\n", | ||
" <td>1.740000e-12</td>\n", | ||
" <td>9.890000e-13</td>\n", | ||
" </tr>\n", | ||
" </tbody>\n", | ||
"</table>\n", | ||
"</div>" | ||
], | ||
"text/plain": [ | ||
" 0 1 2\n", | ||
"0 3.000000e-10 2.270000e-12 2.240000e-12\n", | ||
"1 3.000000e-10 2.060000e-12 1.900000e-12\n", | ||
"2 3.000000e-10 2.790000e-12 1.560000e-12\n", | ||
"3 2.990000e-10 2.600000e-12 1.930000e-12\n", | ||
"4 2.990000e-10 1.740000e-12 9.890000e-13" | ||
] | ||
}, | ||
"execution_count": 3, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"with open('iz.csv', mode = 'r', encoding = 'UTF-8') as f:\n", | ||
" df = pd.read_csv(f, header = None)\n", | ||
"df.head()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 4, | ||
"id": "00c012a6", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"df[3] = 0.5 * (df[1] + df[2])\n", | ||
"z = np.array(df[0]) * 1e10\n", | ||
"current = np.array(df[3]) * 1e12" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 5, | ||
"id": "fcd90eab", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from sklearn.linear_model import LinearRegression\n", | ||
"from scipy.optimize import curve_fit" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 8, | ||
"id": "922886ba", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"[[ 3.60225002e+00 -2.56599244e-03]\n", | ||
" [-2.56599244e-03 1.89800824e-06]]\n", | ||
"4.306461770837465 3.919756213516532\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"def func(x, a, b):\n", | ||
" return a * np.exp(b*x)\n", | ||
"\n", | ||
"def cal_wf_lin(z, current):\n", | ||
" lr = LinearRegression()\n", | ||
" lr.fit(z.reshape(-1, 1), np.log(current))\n", | ||
" wf = 0.952 * pow(lr.coef_[0], 2)\n", | ||
" return wf\n", | ||
"\n", | ||
"def cal_wf(z, current):\n", | ||
" pfit, pcov = curve_fit(func, z, current)\n", | ||
" print(pcov)\n", | ||
" wf = 0.952 * pow(pfit[1], 2)\n", | ||
" return wf\n", | ||
"\n", | ||
"res1 = cal_wf_lin(z, current)\n", | ||
"res2 = cal_wf(z, current)\n", | ||
"print(res1, res2)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "e8d4bea2", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.8.8" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
Oops, something went wrong.