diff --git a/Experiments/.ipynb_checkpoints/MQ303_Regression-checkpoint.ipynb b/Experiments/.ipynb_checkpoints/MQ303_Regression-checkpoint.ipynb
new file mode 100644
index 0000000..69d3517
--- /dev/null
+++ b/Experiments/.ipynb_checkpoints/MQ303_Regression-checkpoint.ipynb
@@ -0,0 +1,2077 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Requirement already satisfied: pandas in c:\\programdata\\anaconda3\\lib\\site-packages (0.24.2)\n",
+ "Requirement already satisfied: pytz>=2011k in c:\\programdata\\anaconda3\\lib\\site-packages (from pandas) (2018.9)\n",
+ "Requirement already satisfied: python-dateutil>=2.5.0 in c:\\programdata\\anaconda3\\lib\\site-packages (from pandas) (2.8.0)\n",
+ "Requirement already satisfied: numpy>=1.12.0 in c:\\programdata\\anaconda3\\lib\\site-packages (from pandas) (1.16.2)\n",
+ "Requirement already satisfied: six>=1.5 in c:\\programdata\\anaconda3\\lib\\site-packages (from python-dateutil>=2.5.0->pandas) (1.12.0)\n",
+ "Requirement already satisfied: xlrd in c:\\programdata\\anaconda3\\lib\\site-packages (1.2.0)\n",
+ "Requirement already satisfied: sklearn in c:\\programdata\\anaconda3\\lib\\site-packages (0.0)\n",
+ "Requirement already satisfied: scikit-learn in c:\\programdata\\anaconda3\\lib\\site-packages (from sklearn) (0.21.2)\n",
+ "Requirement already satisfied: scipy>=0.17.0 in c:\\programdata\\anaconda3\\lib\\site-packages (from scikit-learn->sklearn) (1.2.1)\n",
+ "Requirement already satisfied: joblib>=0.11 in c:\\programdata\\anaconda3\\lib\\site-packages (from scikit-learn->sklearn) (0.13.2)\n",
+ "Requirement already satisfied: numpy>=1.11.0 in c:\\programdata\\anaconda3\\lib\\site-packages (from scikit-learn->sklearn) (1.16.2)\n",
+ "Requirement already satisfied: imblearn in c:\\programdata\\anaconda3\\lib\\site-packages (0.0)\n",
+ "Requirement already satisfied: imbalanced-learn in c:\\programdata\\anaconda3\\lib\\site-packages (from imblearn) (0.5.0)\n",
+ "Requirement already satisfied: joblib>=0.11 in c:\\programdata\\anaconda3\\lib\\site-packages (from imbalanced-learn->imblearn) (0.13.2)\n",
+ "Requirement already satisfied: scipy>=0.17 in c:\\programdata\\anaconda3\\lib\\site-packages (from imbalanced-learn->imblearn) (1.2.1)\n",
+ "Requirement already satisfied: numpy>=1.11 in c:\\programdata\\anaconda3\\lib\\site-packages (from imbalanced-learn->imblearn) (1.16.2)\n",
+ "Requirement already satisfied: scikit-learn>=0.21 in c:\\programdata\\anaconda3\\lib\\site-packages (from imbalanced-learn->imblearn) (0.21.2)\n"
+ ]
+ }
+ ],
+ "source": [
+ "!pip install pandas\n",
+ "!pip install xlrd\n",
+ "!pip install sklearn\n",
+ "!pip install imblearn"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import xlrd\n",
+ "book = xlrd.open_workbook(\"Datasheets info.xlsx\")\n",
+ "sheetMQ2 = book.sheet_by_name(\"MQ2 - Pololulu\")\n",
+ "sheetMQ3 = book.sheet_by_name(\"MQ3 - Sparkfun\")\n",
+ "sheetMQ4 = book.sheet_by_name(\"MQ4 - Sparkfun\")\n",
+ "sheetMQ5 = book.sheet_by_name(\"MQ5 - Sparkfun\")\n",
+ "sheetMQ6 = book.sheet_by_name(\"MQ6 - Sparkfun\")\n",
+ "sheetMQ7 = book.sheet_by_name(\"MQ7 - Sparkfun\")\n",
+ "sheetMQ8 = book.sheet_by_name(\"MQ8 - Sparkfun\")\n",
+ "sheetMQ9 = book.sheet_by_name(\"MQ9 - Haoyuelectronics\")\n",
+ "sheetMQ131 = book.sheet_by_name(\"MQ131- Sensorsportal\")\n",
+ "sheetMQ135 = book.sheet_by_name(\"MQ135 - HANWEI\")\n",
+ "sheetMQ303A = book.sheet_by_name(\"MQ303A - HANWEI\")\n",
+ "sheetMQ309A = book.sheet_by_name(\"MQ309A - HANWEI\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "0.01 \t \t \t \n",
+ "0.02 \t \t \t \n",
+ "0.03 \t \t \t \n",
+ "0.04 \t \t \t \n",
+ "0.05 \t \t \t \n",
+ "0.06 \t \t \t \n",
+ "0.07 \t \t \t \n",
+ "0.08 \t \t \t \n",
+ "0.09 \t \t \t \n",
+ "0.1 \t 3000.0 \t \t 1000.0\n",
+ "0.2 \t \t 300.0 \t \n",
+ "0.3 \t 300.0 \t 100.0 \t \n",
+ "0.4 \t 100.0 \t \t 30.0\n",
+ "0.5 \t \t \t \n",
+ "0.6 \t \t \t 10.0\n",
+ "0.7 \t \t \t \n",
+ "0.8 \t \t 10.0 \t \n",
+ "0.9 \t \t \t \n",
+ "1.0 \t \t \t \n"
+ ]
+ }
+ ],
+ "source": [
+ "for row_index in range(1,20): #reading first columns\n",
+ " RsR0, Iso_butano, Hidrogeno , Alcohol = sheetMQ303A.row_values(row_index, start_colx=0, end_colx=4)\n",
+ " print(RsR0, \"\t\", Iso_butano, \"\t\", Hidrogeno, \"\t\", Alcohol)\n",
+ " "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 12,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "x_MQ303A = sheetMQ3.col_values(0)[2:]\n",
+ "MQ5_CH4 = sheetMQ3.col_values(1)[2:]\n",
+ "MQ5_CO = sheetMQ3.col_values(2)[2:]\n",
+ "MQ5_H2 = sheetMQ3.col_values(3)[2:]\n",
+ "MQ5_Alcohol = sheetMQ3.col_values(4)[2:]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "def zero_to_nan(values):\n",
+ " \"\"\"Replace every 0 with 'nan' and return a copy.\"\"\"\n",
+ " return [float('nan') if x==0 else x for x in values]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "MQ5_CH4 =zero_to_nan(MQ5_CH4)\n",
+ "MQ5_CO =zero_to_nan(MQ5_CO)\n",
+ "MQ5_H2 =zero_to_nan(MQ5_H2)\n",
+ "MQ5_Alcohol =zero_to_nan(MQ5_Alcohol)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {
+ "scrolled": false
+ },
+ "outputs": [],
+ "source": [
+ "import pandas as pd\n",
+ "import numpy as np\n",
+ "from sklearn.datasets import load_iris\n",
+ "#from sklearn.cross_validation import train_test_split\n",
+ "from sklearn.tree import DecisionTreeClassifier\n",
+ "from sklearn import datasets\n",
+ "from sklearn import linear_model\n",
+ "\n",
+ "dataCH4 = {'RsRo': x_MQ309, 'CH4': MQ5_CH4}\n",
+ "dataCO = {'RsRo': x_MQ309, 'CO': MQ5_CO}\n",
+ "dataH2 = {'RsRo': x_MQ309, 'H2': MQ5_H2}\n",
+ "dataLPG = {'RsRo': x_MQ309, 'Alcohol': MQ5_Alcohol}\n",
+ "\n",
+ "dfMQ309A_CH4 = pd.DataFrame(dataCH4)\n",
+ "dfMQ309A_CO = pd.DataFrame(dataCO)\n",
+ "dfMQ309A_H2 = pd.DataFrame(dataH2)\n",
+ "dfMQ309A_Alcohol = pd.DataFrame(dataLPG)\n",
+ "\n",
+ "dfMQ309A_CH4['CH4'] = pd.to_numeric(dfMQ309A_CH4['CH4'])\n",
+ "dfMQ309A_CO['CO'] = pd.to_numeric(dfMQ309A_CO['CO'])\n",
+ "dfMQ309A_H2['H2'] = pd.to_numeric(dfMQ309A_H2['H2'])\n",
+ "dfMQ309A_Alcohol['Alcohol'] = pd.to_numeric(dfMQ309A_Alcohol['Alcohol'])\n",
+ "\n",
+ "dfMQ309A_CH4['CH4'] = dfMQ309A_CH4['CH4'].replace('',None, regex=True)\n",
+ "dfMQ309A_CO['CO'] = dfMQ309A_CO['CO'].replace('',None, regex=True)\n",
+ "dfMQ309A_H2['H2'] = dfMQ309A_H2['H2'].replace('',None, regex=True)\n",
+ "dfMQ309A_Alcohol['Alcohol'] = dfMQ309A_Alcohol['Alcohol'].replace('',None, regex=True)\n",
+ "\n",
+ "#Global X_Predict variable\n",
+ "X_Predict = dfMQ309A_CH4.RsRo.apply(lambda x: [x]).tolist()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "#Model and train CH4\n",
+ "dataset2TrainCH4 = dfMQ309A_CH4.copy()\n",
+ "dataset2TrainCH4.dropna(inplace=True)\n",
+ "X_trainCH4 = dataset2TrainCH4.RsRo.apply(lambda x: [x]).tolist()\n",
+ "y_trainCH4 = dataset2TrainCH4['CH4'].tolist()\n",
+ "model = linear_model.Lasso(alpha=0.1)\n",
+ "model.fit(X_trainCH4, y_trainCH4)\n",
+ "#Predict\n",
+ "CH4_Predicted = model.predict(X_Predict)\n",
+ "#save into MQ2\n",
+ "MQ309A_CH4 = CH4_Predicted"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "#Model and train CO\n",
+ "dataset2TrainCO = dfMQ309A_CO.copy()\n",
+ "dataset2TrainCO.dropna(inplace=True)\n",
+ "X_trainCO = dataset2TrainCO.RsRo.apply(lambda x: [x]).tolist()\n",
+ "y_trainCO = dataset2TrainCO['CO'].tolist()\n",
+ "model = linear_model.Lasso(alpha=0.1)\n",
+ "model.fit(X_trainCO, y_trainCO)\n",
+ "#Predict\n",
+ "CO_Predicted = model.predict(X_Predict)\n",
+ "#save into MQ2\n",
+ "MQ309A_CO = CO_Predicted"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "#Model and train H2\n",
+ "dataset2TrainH2 = dfMQ309A_H2.copy()\n",
+ "dataset2TrainH2.dropna(inplace=True)\n",
+ "X_trainH2 = dataset2TrainH2.RsRo.apply(lambda x: [x]).tolist()\n",
+ "y_trainH2 = dataset2TrainH2['H2'].tolist()\n",
+ "model = linear_model.Lasso(alpha=0.1)\n",
+ "model.fit(X_trainH2, y_trainH2)\n",
+ "#Predict\n",
+ "H2_Predicted = model.predict(X_Predict)\n",
+ "#save into MQ2\n",
+ "MQ309A_H2 = H2_Predicted\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "#Model and train Alcohol\n",
+ "dataset2TrainAlcohol = dfMQ309A_Alcohol.copy()\n",
+ "dataset2TrainAlcohol.dropna(inplace=True)\n",
+ "X_trainAlcohol = dataset2TrainAlcohol.RsRo.apply(lambda x: [x]).tolist()\n",
+ "y_trainAlcohol = dataset2TrainAlcohol['Alcohol'].tolist()\n",
+ "model = linear_model.Lasso(alpha=0.1)\n",
+ "model.fit(X_trainAlcohol, y_trainAlcohol)\n",
+ "#Predict\n",
+ "Alcohol_Predicted = model.predict(X_Predict)\n",
+ "#save into MQ2\n",
+ "MQ309A_Alcohol = Alcohol_Predicted"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 13,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "image/svg+xml": [
+ "\r\n",
+ "\r\n",
+ "\r\n",
+ "\r\n"
+ ],
+ "text/plain": [
+ ""
+ ]
+ },
+ "metadata": {
+ "needs_background": "light"
+ },
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "%config InlineBackend.figure_formats = ['svg']\n",
+ "%matplotlib inline\n",
+ "import matplotlib.pyplot as plt\n",
+ "import matplotlib.lines as mlines\n",
+ "import matplotlib.transforms as mtransforms\n",
+ "\n",
+ "fig, ax = plt.subplots()\n",
+ "\n",
+ "fig.set_size_inches(9, 5.5, forward=True)\n",
+ "fig.set_dpi(200)\n",
+ "\n",
+ "# only these two lines are calibration curves\n",
+ "plt.plot(MQ309A_CH4, x_MQ309A, marker='o', linewidth=1, label='CH4')\n",
+ "plt.plot(MQ309A_CO, x_MQ309A, marker='o', linewidth=1, label='CO')\n",
+ "plt.plot(MQ309A_H2, x_MQ309A, marker='o', linewidth=1, label='H2')\n",
+ "plt.plot(MQ309A_Alcohol, x_MQ309A, marker='o', linewidth=1, label='Alcohol')\n",
+ "\n",
+ "\n",
+ "\n",
+ "# reference line, legends, and axis labels\n",
+ "#line = mlines.Line2D([0, 1], [0, 1], color='black')\n",
+ "#transform = ax.transAxes\n",
+ "#line.set_transform(transform)\n",
+ "#ax.add_line(line)\n",
+ "plt.yscale('log')\n",
+ "plt.xscale('log')\n",
+ "plt.legend()\n",
+ "\n",
+ "plt.grid(b=True, which='minor', color='lightgrey', linestyle='--')\n",
+ "\n",
+ "fig.suptitle('Calibration plot for MQ-309A data')\n",
+ "ax.set_xlabel('PPM Concentration')\n",
+ "ax.set_ylabel('Rs/Ro')\n",
+ "\n",
+ "\n",
+ "#Save image\n",
+ "plt.savefig('MQ309A.svg', format = 'svg', dpi = 1200)\n",
+ "plt.savefig('MQ309A.png')\n",
+ "plt.savefig('MQ309A.eps', format = 'eps', dpi = 1200)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "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.7.3"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 2
+}
diff --git a/Experiments/MQ303_Regression.ipynb b/Experiments/MQ303_Regression.ipynb
new file mode 100644
index 0000000..69d3517
--- /dev/null
+++ b/Experiments/MQ303_Regression.ipynb
@@ -0,0 +1,2077 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Requirement already satisfied: pandas in c:\\programdata\\anaconda3\\lib\\site-packages (0.24.2)\n",
+ "Requirement already satisfied: pytz>=2011k in c:\\programdata\\anaconda3\\lib\\site-packages (from pandas) (2018.9)\n",
+ "Requirement already satisfied: python-dateutil>=2.5.0 in c:\\programdata\\anaconda3\\lib\\site-packages (from pandas) (2.8.0)\n",
+ "Requirement already satisfied: numpy>=1.12.0 in c:\\programdata\\anaconda3\\lib\\site-packages (from pandas) (1.16.2)\n",
+ "Requirement already satisfied: six>=1.5 in c:\\programdata\\anaconda3\\lib\\site-packages (from python-dateutil>=2.5.0->pandas) (1.12.0)\n",
+ "Requirement already satisfied: xlrd in c:\\programdata\\anaconda3\\lib\\site-packages (1.2.0)\n",
+ "Requirement already satisfied: sklearn in c:\\programdata\\anaconda3\\lib\\site-packages (0.0)\n",
+ "Requirement already satisfied: scikit-learn in c:\\programdata\\anaconda3\\lib\\site-packages (from sklearn) (0.21.2)\n",
+ "Requirement already satisfied: scipy>=0.17.0 in c:\\programdata\\anaconda3\\lib\\site-packages (from scikit-learn->sklearn) (1.2.1)\n",
+ "Requirement already satisfied: joblib>=0.11 in c:\\programdata\\anaconda3\\lib\\site-packages (from scikit-learn->sklearn) (0.13.2)\n",
+ "Requirement already satisfied: numpy>=1.11.0 in c:\\programdata\\anaconda3\\lib\\site-packages (from scikit-learn->sklearn) (1.16.2)\n",
+ "Requirement already satisfied: imblearn in c:\\programdata\\anaconda3\\lib\\site-packages (0.0)\n",
+ "Requirement already satisfied: imbalanced-learn in c:\\programdata\\anaconda3\\lib\\site-packages (from imblearn) (0.5.0)\n",
+ "Requirement already satisfied: joblib>=0.11 in c:\\programdata\\anaconda3\\lib\\site-packages (from imbalanced-learn->imblearn) (0.13.2)\n",
+ "Requirement already satisfied: scipy>=0.17 in c:\\programdata\\anaconda3\\lib\\site-packages (from imbalanced-learn->imblearn) (1.2.1)\n",
+ "Requirement already satisfied: numpy>=1.11 in c:\\programdata\\anaconda3\\lib\\site-packages (from imbalanced-learn->imblearn) (1.16.2)\n",
+ "Requirement already satisfied: scikit-learn>=0.21 in c:\\programdata\\anaconda3\\lib\\site-packages (from imbalanced-learn->imblearn) (0.21.2)\n"
+ ]
+ }
+ ],
+ "source": [
+ "!pip install pandas\n",
+ "!pip install xlrd\n",
+ "!pip install sklearn\n",
+ "!pip install imblearn"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import xlrd\n",
+ "book = xlrd.open_workbook(\"Datasheets info.xlsx\")\n",
+ "sheetMQ2 = book.sheet_by_name(\"MQ2 - Pololulu\")\n",
+ "sheetMQ3 = book.sheet_by_name(\"MQ3 - Sparkfun\")\n",
+ "sheetMQ4 = book.sheet_by_name(\"MQ4 - Sparkfun\")\n",
+ "sheetMQ5 = book.sheet_by_name(\"MQ5 - Sparkfun\")\n",
+ "sheetMQ6 = book.sheet_by_name(\"MQ6 - Sparkfun\")\n",
+ "sheetMQ7 = book.sheet_by_name(\"MQ7 - Sparkfun\")\n",
+ "sheetMQ8 = book.sheet_by_name(\"MQ8 - Sparkfun\")\n",
+ "sheetMQ9 = book.sheet_by_name(\"MQ9 - Haoyuelectronics\")\n",
+ "sheetMQ131 = book.sheet_by_name(\"MQ131- Sensorsportal\")\n",
+ "sheetMQ135 = book.sheet_by_name(\"MQ135 - HANWEI\")\n",
+ "sheetMQ303A = book.sheet_by_name(\"MQ303A - HANWEI\")\n",
+ "sheetMQ309A = book.sheet_by_name(\"MQ309A - HANWEI\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "0.01 \t \t \t \n",
+ "0.02 \t \t \t \n",
+ "0.03 \t \t \t \n",
+ "0.04 \t \t \t \n",
+ "0.05 \t \t \t \n",
+ "0.06 \t \t \t \n",
+ "0.07 \t \t \t \n",
+ "0.08 \t \t \t \n",
+ "0.09 \t \t \t \n",
+ "0.1 \t 3000.0 \t \t 1000.0\n",
+ "0.2 \t \t 300.0 \t \n",
+ "0.3 \t 300.0 \t 100.0 \t \n",
+ "0.4 \t 100.0 \t \t 30.0\n",
+ "0.5 \t \t \t \n",
+ "0.6 \t \t \t 10.0\n",
+ "0.7 \t \t \t \n",
+ "0.8 \t \t 10.0 \t \n",
+ "0.9 \t \t \t \n",
+ "1.0 \t \t \t \n"
+ ]
+ }
+ ],
+ "source": [
+ "for row_index in range(1,20): #reading first columns\n",
+ " RsR0, Iso_butano, Hidrogeno , Alcohol = sheetMQ303A.row_values(row_index, start_colx=0, end_colx=4)\n",
+ " print(RsR0, \"\t\", Iso_butano, \"\t\", Hidrogeno, \"\t\", Alcohol)\n",
+ " "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 12,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "x_MQ303A = sheetMQ3.col_values(0)[2:]\n",
+ "MQ5_CH4 = sheetMQ3.col_values(1)[2:]\n",
+ "MQ5_CO = sheetMQ3.col_values(2)[2:]\n",
+ "MQ5_H2 = sheetMQ3.col_values(3)[2:]\n",
+ "MQ5_Alcohol = sheetMQ3.col_values(4)[2:]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "def zero_to_nan(values):\n",
+ " \"\"\"Replace every 0 with 'nan' and return a copy.\"\"\"\n",
+ " return [float('nan') if x==0 else x for x in values]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "MQ5_CH4 =zero_to_nan(MQ5_CH4)\n",
+ "MQ5_CO =zero_to_nan(MQ5_CO)\n",
+ "MQ5_H2 =zero_to_nan(MQ5_H2)\n",
+ "MQ5_Alcohol =zero_to_nan(MQ5_Alcohol)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {
+ "scrolled": false
+ },
+ "outputs": [],
+ "source": [
+ "import pandas as pd\n",
+ "import numpy as np\n",
+ "from sklearn.datasets import load_iris\n",
+ "#from sklearn.cross_validation import train_test_split\n",
+ "from sklearn.tree import DecisionTreeClassifier\n",
+ "from sklearn import datasets\n",
+ "from sklearn import linear_model\n",
+ "\n",
+ "dataCH4 = {'RsRo': x_MQ309, 'CH4': MQ5_CH4}\n",
+ "dataCO = {'RsRo': x_MQ309, 'CO': MQ5_CO}\n",
+ "dataH2 = {'RsRo': x_MQ309, 'H2': MQ5_H2}\n",
+ "dataLPG = {'RsRo': x_MQ309, 'Alcohol': MQ5_Alcohol}\n",
+ "\n",
+ "dfMQ309A_CH4 = pd.DataFrame(dataCH4)\n",
+ "dfMQ309A_CO = pd.DataFrame(dataCO)\n",
+ "dfMQ309A_H2 = pd.DataFrame(dataH2)\n",
+ "dfMQ309A_Alcohol = pd.DataFrame(dataLPG)\n",
+ "\n",
+ "dfMQ309A_CH4['CH4'] = pd.to_numeric(dfMQ309A_CH4['CH4'])\n",
+ "dfMQ309A_CO['CO'] = pd.to_numeric(dfMQ309A_CO['CO'])\n",
+ "dfMQ309A_H2['H2'] = pd.to_numeric(dfMQ309A_H2['H2'])\n",
+ "dfMQ309A_Alcohol['Alcohol'] = pd.to_numeric(dfMQ309A_Alcohol['Alcohol'])\n",
+ "\n",
+ "dfMQ309A_CH4['CH4'] = dfMQ309A_CH4['CH4'].replace('',None, regex=True)\n",
+ "dfMQ309A_CO['CO'] = dfMQ309A_CO['CO'].replace('',None, regex=True)\n",
+ "dfMQ309A_H2['H2'] = dfMQ309A_H2['H2'].replace('',None, regex=True)\n",
+ "dfMQ309A_Alcohol['Alcohol'] = dfMQ309A_Alcohol['Alcohol'].replace('',None, regex=True)\n",
+ "\n",
+ "#Global X_Predict variable\n",
+ "X_Predict = dfMQ309A_CH4.RsRo.apply(lambda x: [x]).tolist()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "#Model and train CH4\n",
+ "dataset2TrainCH4 = dfMQ309A_CH4.copy()\n",
+ "dataset2TrainCH4.dropna(inplace=True)\n",
+ "X_trainCH4 = dataset2TrainCH4.RsRo.apply(lambda x: [x]).tolist()\n",
+ "y_trainCH4 = dataset2TrainCH4['CH4'].tolist()\n",
+ "model = linear_model.Lasso(alpha=0.1)\n",
+ "model.fit(X_trainCH4, y_trainCH4)\n",
+ "#Predict\n",
+ "CH4_Predicted = model.predict(X_Predict)\n",
+ "#save into MQ2\n",
+ "MQ309A_CH4 = CH4_Predicted"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "#Model and train CO\n",
+ "dataset2TrainCO = dfMQ309A_CO.copy()\n",
+ "dataset2TrainCO.dropna(inplace=True)\n",
+ "X_trainCO = dataset2TrainCO.RsRo.apply(lambda x: [x]).tolist()\n",
+ "y_trainCO = dataset2TrainCO['CO'].tolist()\n",
+ "model = linear_model.Lasso(alpha=0.1)\n",
+ "model.fit(X_trainCO, y_trainCO)\n",
+ "#Predict\n",
+ "CO_Predicted = model.predict(X_Predict)\n",
+ "#save into MQ2\n",
+ "MQ309A_CO = CO_Predicted"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "#Model and train H2\n",
+ "dataset2TrainH2 = dfMQ309A_H2.copy()\n",
+ "dataset2TrainH2.dropna(inplace=True)\n",
+ "X_trainH2 = dataset2TrainH2.RsRo.apply(lambda x: [x]).tolist()\n",
+ "y_trainH2 = dataset2TrainH2['H2'].tolist()\n",
+ "model = linear_model.Lasso(alpha=0.1)\n",
+ "model.fit(X_trainH2, y_trainH2)\n",
+ "#Predict\n",
+ "H2_Predicted = model.predict(X_Predict)\n",
+ "#save into MQ2\n",
+ "MQ309A_H2 = H2_Predicted\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "#Model and train Alcohol\n",
+ "dataset2TrainAlcohol = dfMQ309A_Alcohol.copy()\n",
+ "dataset2TrainAlcohol.dropna(inplace=True)\n",
+ "X_trainAlcohol = dataset2TrainAlcohol.RsRo.apply(lambda x: [x]).tolist()\n",
+ "y_trainAlcohol = dataset2TrainAlcohol['Alcohol'].tolist()\n",
+ "model = linear_model.Lasso(alpha=0.1)\n",
+ "model.fit(X_trainAlcohol, y_trainAlcohol)\n",
+ "#Predict\n",
+ "Alcohol_Predicted = model.predict(X_Predict)\n",
+ "#save into MQ2\n",
+ "MQ309A_Alcohol = Alcohol_Predicted"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 13,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "image/svg+xml": [
+ "\r\n",
+ "\r\n",
+ "\r\n",
+ "\r\n"
+ ],
+ "text/plain": [
+ ""
+ ]
+ },
+ "metadata": {
+ "needs_background": "light"
+ },
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "%config InlineBackend.figure_formats = ['svg']\n",
+ "%matplotlib inline\n",
+ "import matplotlib.pyplot as plt\n",
+ "import matplotlib.lines as mlines\n",
+ "import matplotlib.transforms as mtransforms\n",
+ "\n",
+ "fig, ax = plt.subplots()\n",
+ "\n",
+ "fig.set_size_inches(9, 5.5, forward=True)\n",
+ "fig.set_dpi(200)\n",
+ "\n",
+ "# only these two lines are calibration curves\n",
+ "plt.plot(MQ309A_CH4, x_MQ309A, marker='o', linewidth=1, label='CH4')\n",
+ "plt.plot(MQ309A_CO, x_MQ309A, marker='o', linewidth=1, label='CO')\n",
+ "plt.plot(MQ309A_H2, x_MQ309A, marker='o', linewidth=1, label='H2')\n",
+ "plt.plot(MQ309A_Alcohol, x_MQ309A, marker='o', linewidth=1, label='Alcohol')\n",
+ "\n",
+ "\n",
+ "\n",
+ "# reference line, legends, and axis labels\n",
+ "#line = mlines.Line2D([0, 1], [0, 1], color='black')\n",
+ "#transform = ax.transAxes\n",
+ "#line.set_transform(transform)\n",
+ "#ax.add_line(line)\n",
+ "plt.yscale('log')\n",
+ "plt.xscale('log')\n",
+ "plt.legend()\n",
+ "\n",
+ "plt.grid(b=True, which='minor', color='lightgrey', linestyle='--')\n",
+ "\n",
+ "fig.suptitle('Calibration plot for MQ-309A data')\n",
+ "ax.set_xlabel('PPM Concentration')\n",
+ "ax.set_ylabel('Rs/Ro')\n",
+ "\n",
+ "\n",
+ "#Save image\n",
+ "plt.savefig('MQ309A.svg', format = 'svg', dpi = 1200)\n",
+ "plt.savefig('MQ309A.png')\n",
+ "plt.savefig('MQ309A.eps', format = 'eps', dpi = 1200)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "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.7.3"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 2
+}
diff --git a/Experiments/MQ309A.eps b/Experiments/MQ309A.eps
index a30f0c4..fd0e2b1 100644
--- a/Experiments/MQ309A.eps
+++ b/Experiments/MQ309A.eps
@@ -1,7 +1,7 @@
%!PS-Adobe-3.0 EPSF-3.0
%%Title: MQ309A.eps
%%Creator: matplotlib version 3.0.3, http://matplotlib.org/
-%%CreationDate: Wed Jul 3 20:17:00 2019
+%%CreationDate: Wed Jul 3 20:23:34 2019
%%Orientation: portrait
%%BoundingBox: -18 198 630 594
%%EndComments
@@ -42,7 +42,7 @@ newpath
/FontMatrix[.001 0 0 .001 0 0]def
/FontBBox[-1021 -463 1793 1232]def
/FontType 3 def
-/Encoding [ /space /hyphen /slash /zero /one /two /three /four /nine /A /C /H /M /O /P /Q /R /a /b /c /d /e /f /h /i /l /n /o /p /r /s /t /minus ] def
+/Encoding [ /space /hyphen /slash /zero /one /two /three /four /nine /A /C /H /M /O /P /Q /R /a /b /c /d /e /f /h /i /l /n /o /p /r /s /t ] def
/FontInfo 10 dict dup begin
/FamilyName (DejaVu Sans) def
/FullName (DejaVu Sans) def
@@ -54,7 +54,7 @@ newpath
/UnderlinePosition -130 def
/UnderlineThickness 90 def
end readonly def
-/CharStrings 34 dict dup begin
+/CharStrings 33 dict dup begin
/.notdef 0 def
/space{318 0 0 0 0 0 _sc
}_d
@@ -687,13 +687,6 @@ _cl}_d
93 702 _l
183 702 _l
_cl}_d
-/minus{838 0 106 272 732 355 _sc
-106 355 _m
-732 355 _l
-732 272 _l
-106 272 _l
-106 355 _l
-_cl}_d
end readonly def
/BuildGlyph
@@ -755,53 +748,10 @@ grestore
stroke
grestore
} bind def
-121.567 49.5 o
+97.735 49.5 o
grestore
gsave
-109.566941 34.578125 translate
-0.000000 rotate
-/DejaVuSans findfont
-10.0 scalefont
-setfont
-0.000000 0.064063 moveto
-/one glyphshow
-
-6.362305 0.064063 moveto
-/zero glyphshow
-
-/DejaVuSans findfont
-7.0 scalefont
-setfont
-12.820312 3.892188 moveto
-/minus glyphshow
-
-18.685547 3.892188 moveto
-/one glyphshow
-
-
-grestore
-gsave
-/o {
-gsave
-newpath
-translate
-0.8 setlinewidth
-1 setlinejoin
-0 setlinecap
-0 0 m
-0 -3.5 l
-
-gsave
-0.000 setgray
-fill
-grestore
-stroke
-grestore
-} bind def
-305.474 49.5 o
-grestore
-gsave
-296.474439 33.578125 translate
+88.735032 33.578125 translate
0.000000 rotate
/DejaVuSans findfont
10.0 scalefont
@@ -816,7 +766,7 @@ setfont
7.0 scalefont
setfont
12.820312 4.804688 moveto
-/zero glyphshow
+/two glyphshow
grestore
@@ -838,10 +788,50 @@ grestore
stroke
grestore
} bind def
-489.382 49.5 o
+302.727 49.5 o
grestore
gsave
-480.381938 34.578125 translate
+293.726723 33.578125 translate
+0.000000 rotate
+/DejaVuSans findfont
+10.0 scalefont
+setfont
+0.000000 0.976562 moveto
+/one glyphshow
+
+6.362305 0.976562 moveto
+/zero glyphshow
+
+/DejaVuSans findfont
+7.0 scalefont
+setfont
+12.820312 4.804688 moveto
+/three glyphshow
+
+
+grestore
+gsave
+/o {
+gsave
+newpath
+translate
+0.8 setlinewidth
+1 setlinejoin
+0 setlinecap
+0 0 m
+0 -3.5 l
+
+gsave
+0.000 setgray
+fill
+grestore
+stroke
+grestore
+} bind def
+507.718 49.5 o
+grestore
+gsave
+498.718413 34.578125 translate
0.000000 rotate
/DejaVuSans findfont
10.0 scalefont
@@ -856,7 +846,7 @@ setfont
7.0 scalefont
setfont
12.820312 3.892188 moveto
-/one glyphshow
+/four glyphshow
grestore
@@ -864,8 +854,8 @@ grestore
0.827 setgray
gsave
502.2 299 81 49.5 clipbox
-80.767292 49.5 m
-80.767292 348.48 l
+88.355127 49.5 m
+88.355127 348.48 l
stroke
grestore
0.600 setlinewidth
@@ -889,15 +879,15 @@ grestore
stroke
grestore
} bind def
-80.7673 49.5 o
+88.3551 49.5 o
grestore
0.800 setlinewidth
[2.96 1.28] 0 setdash
0.827 setgray
gsave
502.2 299 81 49.5 clipbox
-93.079309 49.5 m
-93.079309 348.48 l
+159.44368 49.5 m
+159.44368 348.48 l
stroke
grestore
0.600 setlinewidth
@@ -921,15 +911,15 @@ grestore
stroke
grestore
} bind def
-93.0793 49.5 o
+159.444 49.5 o
grestore
0.800 setlinewidth
[2.96 1.28] 0 setdash
0.827 setgray
gsave
502.2 299 81 49.5 clipbox
-103.744463 49.5 m
-103.744463 348.48 l
+195.540925 49.5 m
+195.540925 348.48 l
stroke
grestore
0.600 setlinewidth
@@ -953,15 +943,15 @@ grestore
stroke
grestore
} bind def
-103.744 49.5 o
+195.541 49.5 o
grestore
0.800 setlinewidth
[2.96 1.28] 0 setdash
0.827 setgray
gsave
502.2 299 81 49.5 clipbox
-113.151795 49.5 m
-113.151795 348.48 l
+221.152328 49.5 m
+221.152328 348.48 l
stroke
grestore
0.600 setlinewidth
@@ -985,15 +975,15 @@ grestore
stroke
grestore
} bind def
-113.152 49.5 o
+221.152 49.5 o
grestore
0.800 setlinewidth
[2.96 1.28] 0 setdash
0.827 setgray
gsave
502.2 299 81 49.5 clipbox
-176.928614 49.5 m
-176.928614 348.48 l
+241.018075 49.5 m
+241.018075 348.48 l
stroke
grestore
0.600 setlinewidth
@@ -1017,15 +1007,15 @@ grestore
stroke
grestore
} bind def
-176.929 49.5 o
+241.018 49.5 o
grestore
0.800 setlinewidth
[2.96 1.28] 0 setdash
0.827 setgray
gsave
502.2 299 81 49.5 clipbox
-209.313117 49.5 m
-209.313117 348.48 l
+257.249573 49.5 m
+257.249573 348.48 l
stroke
grestore
0.600 setlinewidth
@@ -1049,15 +1039,15 @@ grestore
stroke
grestore
} bind def
-209.313 49.5 o
+257.25 49.5 o
grestore
0.800 setlinewidth
[2.96 1.28] 0 setdash
0.827 setgray
gsave
502.2 299 81 49.5 clipbox
-232.290288 49.5 m
-232.290288 348.48 l
+270.973108 49.5 m
+270.973108 348.48 l
stroke
grestore
0.600 setlinewidth
@@ -1081,15 +1071,15 @@ grestore
stroke
grestore
} bind def
-232.29 49.5 o
+270.973 49.5 o
grestore
0.800 setlinewidth
[2.96 1.28] 0 setdash
0.827 setgray
gsave
502.2 299 81 49.5 clipbox
-250.112766 49.5 m
-250.112766 348.48 l
+282.860975 49.5 m
+282.860975 348.48 l
stroke
grestore
0.600 setlinewidth
@@ -1113,15 +1103,15 @@ grestore
stroke
grestore
} bind def
-250.113 49.5 o
+282.861 49.5 o
grestore
0.800 setlinewidth
[2.96 1.28] 0 setdash
0.827 setgray
gsave
502.2 299 81 49.5 clipbox
-264.674791 49.5 m
-264.674791 348.48 l
+293.346818 49.5 m
+293.346818 348.48 l
stroke
grestore
0.600 setlinewidth
@@ -1145,15 +1135,15 @@ grestore
stroke
grestore
} bind def
-264.675 49.5 o
+293.347 49.5 o
grestore
0.800 setlinewidth
[2.96 1.28] 0 setdash
0.827 setgray
gsave
502.2 299 81 49.5 clipbox
-276.986807 49.5 m
-276.986807 348.48 l
+364.435371 49.5 m
+364.435371 348.48 l
stroke
grestore
0.600 setlinewidth
@@ -1177,15 +1167,15 @@ grestore
stroke
grestore
} bind def
-276.987 49.5 o
+364.435 49.5 o
grestore
0.800 setlinewidth
[2.96 1.28] 0 setdash
0.827 setgray
gsave
502.2 299 81 49.5 clipbox
-287.651961 49.5 m
-287.651961 348.48 l
+400.532615 49.5 m
+400.532615 348.48 l
stroke
grestore
0.600 setlinewidth
@@ -1209,15 +1199,15 @@ grestore
stroke
grestore
} bind def
-287.652 49.5 o
+400.533 49.5 o
grestore
0.800 setlinewidth
[2.96 1.28] 0 setdash
0.827 setgray
gsave
502.2 299 81 49.5 clipbox
-297.059294 49.5 m
-297.059294 348.48 l
+426.144018 49.5 m
+426.144018 348.48 l
stroke
grestore
0.600 setlinewidth
@@ -1241,15 +1231,15 @@ grestore
stroke
grestore
} bind def
-297.059 49.5 o
+426.144 49.5 o
grestore
0.800 setlinewidth
[2.96 1.28] 0 setdash
0.827 setgray
gsave
502.2 299 81 49.5 clipbox
-360.836113 49.5 m
-360.836113 348.48 l
+446.009766 49.5 m
+446.009766 348.48 l
stroke
grestore
0.600 setlinewidth
@@ -1273,15 +1263,15 @@ grestore
stroke
grestore
} bind def
-360.836 49.5 o
+446.01 49.5 o
grestore
0.800 setlinewidth
[2.96 1.28] 0 setdash
0.827 setgray
gsave
502.2 299 81 49.5 clipbox
-393.220616 49.5 m
-393.220616 348.48 l
+462.241263 49.5 m
+462.241263 348.48 l
stroke
grestore
0.600 setlinewidth
@@ -1305,15 +1295,15 @@ grestore
stroke
grestore
} bind def
-393.221 49.5 o
+462.241 49.5 o
grestore
0.800 setlinewidth
[2.96 1.28] 0 setdash
0.827 setgray
gsave
502.2 299 81 49.5 clipbox
-416.197786 49.5 m
-416.197786 348.48 l
+475.964799 49.5 m
+475.964799 348.48 l
stroke
grestore
0.600 setlinewidth
@@ -1337,15 +1327,15 @@ grestore
stroke
grestore
} bind def
-416.198 49.5 o
+475.965 49.5 o
grestore
0.800 setlinewidth
[2.96 1.28] 0 setdash
0.827 setgray
gsave
502.2 299 81 49.5 clipbox
-434.020264 49.5 m
-434.020264 348.48 l
+487.852666 49.5 m
+487.852666 348.48 l
stroke
grestore
0.600 setlinewidth
@@ -1369,15 +1359,15 @@ grestore
stroke
grestore
} bind def
-434.02 49.5 o
+487.853 49.5 o
grestore
0.800 setlinewidth
[2.96 1.28] 0 setdash
0.827 setgray
gsave
502.2 299 81 49.5 clipbox
-448.582289 49.5 m
-448.582289 348.48 l
+498.338508 49.5 m
+498.338508 348.48 l
stroke
grestore
0.600 setlinewidth
@@ -1401,15 +1391,15 @@ grestore
stroke
grestore
} bind def
-448.582 49.5 o
+498.339 49.5 o
grestore
0.800 setlinewidth
[2.96 1.28] 0 setdash
0.827 setgray
gsave
502.2 299 81 49.5 clipbox
-460.894306 49.5 m
-460.894306 348.48 l
+569.427061 49.5 m
+569.427061 348.48 l
stroke
grestore
0.600 setlinewidth
@@ -1433,135 +1423,7 @@ grestore
stroke
grestore
} bind def
-460.894 49.5 o
-grestore
-0.800 setlinewidth
-[2.96 1.28] 0 setdash
-0.827 setgray
-gsave
-502.2 299 81 49.5 clipbox
-471.559459 49.5 m
-471.559459 348.48 l
-stroke
-grestore
-0.600 setlinewidth
-[] 0 setdash
-0.000 setgray
-gsave
-/o {
-gsave
-newpath
-translate
-0.6 setlinewidth
-1 setlinejoin
-0 setlinecap
-0 0 m
-0 -2 l
-
-gsave
-0.000 setgray
-fill
-grestore
-stroke
-grestore
-} bind def
-471.559 49.5 o
-grestore
-0.800 setlinewidth
-[2.96 1.28] 0 setdash
-0.827 setgray
-gsave
-502.2 299 81 49.5 clipbox
-480.966792 49.5 m
-480.966792 348.48 l
-stroke
-grestore
-0.600 setlinewidth
-[] 0 setdash
-0.000 setgray
-gsave
-/o {
-gsave
-newpath
-translate
-0.6 setlinewidth
-1 setlinejoin
-0 setlinecap
-0 0 m
-0 -2 l
-
-gsave
-0.000 setgray
-fill
-grestore
-stroke
-grestore
-} bind def
-480.967 49.5 o
-grestore
-0.800 setlinewidth
-[2.96 1.28] 0 setdash
-0.827 setgray
-gsave
-502.2 299 81 49.5 clipbox
-544.743611 49.5 m
-544.743611 348.48 l
-stroke
-grestore
-0.600 setlinewidth
-[] 0 setdash
-0.000 setgray
-gsave
-/o {
-gsave
-newpath
-translate
-0.6 setlinewidth
-1 setlinejoin
-0 setlinecap
-0 0 m
-0 -2 l
-
-gsave
-0.000 setgray
-fill
-grestore
-stroke
-grestore
-} bind def
-544.744 49.5 o
-grestore
-0.800 setlinewidth
-[2.96 1.28] 0 setdash
-0.827 setgray
-gsave
-502.2 299 81 49.5 clipbox
-577.128114 49.5 m
-577.128114 348.48 l
-stroke
-grestore
-0.600 setlinewidth
-[] 0 setdash
-0.000 setgray
-gsave
-/o {
-gsave
-newpath
-translate
-0.6 setlinewidth
-1 setlinejoin
-0 setlinecap
-0 0 m
-0 -2 l
-
-gsave
-0.000 setgray
-fill
-grestore
-stroke
-grestore
-} bind def
-577.128 49.5 o
+569.427 49.5 o
grestore
/DejaVuSans findfont
10.000 scalefont
@@ -1606,10 +1468,10 @@ grestore
stroke
grestore
} bind def
-81 133.48 o
+81 174.911 o
grestore
gsave
-56.000000 129.018895 translate
+56.000000 170.449781 translate
0.000000 rotate
/DejaVuSans findfont
10.0 scalefont
@@ -1627,46 +1489,6 @@ setfont
/zero glyphshow
-grestore
-gsave
-/o {
-gsave
-newpath
-translate
-0.8 setlinewidth
-1 setlinejoin
-0 setlinecap
-0 0 m
--3.5 0 l
-
-gsave
-0.000 setgray
-fill
-grestore
-stroke
-grestore
-} bind def
-81 234.185 o
-grestore
-gsave
-56.000000 230.223979 translate
-0.000000 rotate
-/DejaVuSans findfont
-10.0 scalefont
-setfont
-0.000000 0.064063 moveto
-/one glyphshow
-
-6.362305 0.064063 moveto
-/zero glyphshow
-
-/DejaVuSans findfont
-7.0 scalefont
-setfont
-12.820312 3.892188 moveto
-/one glyphshow
-
-
grestore
gsave
/o {
@@ -1689,22 +1511,22 @@ grestore
81 334.89 o
grestore
gsave
-56.000000 330.429062 translate
+56.000000 330.929063 translate
0.000000 rotate
/DejaVuSans findfont
10.0 scalefont
setfont
-0.000000 0.976562 moveto
+0.000000 0.064063 moveto
/one glyphshow
-6.362305 0.976562 moveto
+6.362305 0.064063 moveto
/zero glyphshow
/DejaVuSans findfont
7.0 scalefont
setfont
-12.820312 4.804688 moveto
-/two glyphshow
+12.820312 3.892188 moveto
+/one glyphshow
grestore
@@ -1744,8 +1566,8 @@ grestore
0.827 setgray
gsave
502.2 299 81 49.5 clipbox
-81 80.823285 m
-583.2 80.823285 l
+81 91.260953 m
+583.2 91.260953 l
stroke
grestore
0.600 setlinewidth
@@ -1769,15 +1591,15 @@ grestore
stroke
grestore
} bind def
-81 80.8233 o
+81 91.261 o
grestore
0.800 setlinewidth
[2.96 1.28] 0 setdash
0.827 setgray
gsave
502.2 299 81 49.5 clipbox
-81 93.405251 m
-583.2 93.405251 l
+81 111.248562 m
+583.2 111.248562 l
stroke
grestore
0.600 setlinewidth
@@ -1801,15 +1623,15 @@ grestore
stroke
grestore
} bind def
-81 93.4053 o
+81 111.249 o
grestore
0.800 setlinewidth
[2.96 1.28] 0 setdash
0.827 setgray
gsave
502.2 299 81 49.5 clipbox
-81 103.164582 m
-583.2 103.164582 l
+81 126.752157 m
+583.2 126.752157 l
stroke
grestore
0.600 setlinewidth
@@ -1833,15 +1655,15 @@ grestore
stroke
grestore
} bind def
-81 103.165 o
+81 126.752 o
grestore
0.800 setlinewidth
[2.96 1.28] 0 setdash
0.827 setgray
gsave
502.2 299 81 49.5 clipbox
-81 111.138536 m
-583.2 111.138536 l
+81 139.419515 m
+583.2 139.419515 l
stroke
grestore
0.600 setlinewidth
@@ -1865,15 +1687,15 @@ grestore
stroke
grestore
} bind def
-81 111.139 o
+81 139.42 o
grestore
0.800 setlinewidth
[2.96 1.28] 0 setdash
0.827 setgray
gsave
502.2 299 81 49.5 clipbox
-81 117.880418 m
-583.2 117.880418 l
+81 150.129615 m
+583.2 150.129615 l
stroke
grestore
0.600 setlinewidth
@@ -1897,15 +1719,15 @@ grestore
stroke
grestore
} bind def
-81 117.88 o
+81 150.13 o
grestore
0.800 setlinewidth
[2.96 1.28] 0 setdash
0.827 setgray
gsave
502.2 299 81 49.5 clipbox
-81 123.720502 m
-583.2 123.720502 l
+81 159.407125 m
+583.2 159.407125 l
stroke
grestore
0.600 setlinewidth
@@ -1929,15 +1751,15 @@ grestore
stroke
grestore
} bind def
-81 123.721 o
+81 159.407 o
grestore
0.800 setlinewidth
[2.96 1.28] 0 setdash
0.827 setgray
gsave
502.2 299 81 49.5 clipbox
-81 128.871821 m
-583.2 128.871821 l
+81 167.590468 m
+583.2 167.590468 l
stroke
grestore
0.600 setlinewidth
@@ -1961,15 +1783,15 @@ grestore
stroke
grestore
} bind def
-81 128.872 o
+81 167.59 o
grestore
0.800 setlinewidth
[2.96 1.28] 0 setdash
0.827 setgray
gsave
502.2 299 81 49.5 clipbox
-81 163.795084 m
-583.2 163.795084 l
+81 223.069281 m
+583.2 223.069281 l
stroke
grestore
0.600 setlinewidth
@@ -1993,15 +1815,15 @@ grestore
stroke
grestore
} bind def
-81 163.795 o
+81 223.069 o
grestore
0.800 setlinewidth
[2.96 1.28] 0 setdash
0.827 setgray
gsave
502.2 299 81 49.5 clipbox
-81 181.528369 m
-583.2 181.528369 l
+81 251.240234 m
+583.2 251.240234 l
stroke
grestore
0.600 setlinewidth
@@ -2025,15 +1847,15 @@ grestore
stroke
grestore
} bind def
-81 181.528 o
+81 251.24 o
grestore
0.800 setlinewidth
[2.96 1.28] 0 setdash
0.827 setgray
gsave
502.2 299 81 49.5 clipbox
-81 194.110335 m
-583.2 194.110335 l
+81 271.227843 m
+583.2 271.227843 l
stroke
grestore
0.600 setlinewidth
@@ -2057,15 +1879,15 @@ grestore
stroke
grestore
} bind def
-81 194.11 o
+81 271.228 o
grestore
0.800 setlinewidth
[2.96 1.28] 0 setdash
0.827 setgray
gsave
502.2 299 81 49.5 clipbox
-81 203.869665 m
-583.2 203.869665 l
+81 286.731438 m
+583.2 286.731438 l
stroke
grestore
0.600 setlinewidth
@@ -2089,15 +1911,15 @@ grestore
stroke
grestore
} bind def
-81 203.87 o
+81 286.731 o
grestore
0.800 setlinewidth
[2.96 1.28] 0 setdash
0.827 setgray
gsave
502.2 299 81 49.5 clipbox
-81 211.843619 m
-583.2 211.843619 l
+81 299.398797 m
+583.2 299.398797 l
stroke
grestore
0.600 setlinewidth
@@ -2121,15 +1943,15 @@ grestore
stroke
grestore
} bind def
-81 211.844 o
+81 299.399 o
grestore
0.800 setlinewidth
[2.96 1.28] 0 setdash
0.827 setgray
gsave
502.2 299 81 49.5 clipbox
-81 218.585502 m
-583.2 218.585502 l
+81 310.108896 m
+583.2 310.108896 l
stroke
grestore
0.600 setlinewidth
@@ -2153,15 +1975,15 @@ grestore
stroke
grestore
} bind def
-81 218.586 o
+81 310.109 o
grestore
0.800 setlinewidth
[2.96 1.28] 0 setdash
0.827 setgray
gsave
502.2 299 81 49.5 clipbox
-81 224.425585 m
-583.2 224.425585 l
+81 319.386406 m
+583.2 319.386406 l
stroke
grestore
0.600 setlinewidth
@@ -2185,15 +2007,15 @@ grestore
stroke
grestore
} bind def
-81 224.426 o
+81 319.386 o
grestore
0.800 setlinewidth
[2.96 1.28] 0 setdash
0.827 setgray
gsave
502.2 299 81 49.5 clipbox
-81 229.576904 m
-583.2 229.576904 l
+81 327.56975 m
+583.2 327.56975 l
stroke
grestore
0.600 setlinewidth
@@ -2217,263 +2039,7 @@ grestore
stroke
grestore
} bind def
-81 229.577 o
-grestore
-0.800 setlinewidth
-[2.96 1.28] 0 setdash
-0.827 setgray
-gsave
-502.2 299 81 49.5 clipbox
-81 264.500167 m
-583.2 264.500167 l
-stroke
-grestore
-0.600 setlinewidth
-[] 0 setdash
-0.000 setgray
-gsave
-/o {
-gsave
-newpath
-translate
-0.6 setlinewidth
-1 setlinejoin
-0 setlinecap
-0 0 m
--2 0 l
-
-gsave
-0.000 setgray
-fill
-grestore
-stroke
-grestore
-} bind def
-81 264.5 o
-grestore
-0.800 setlinewidth
-[2.96 1.28] 0 setdash
-0.827 setgray
-gsave
-502.2 299 81 49.5 clipbox
-81 282.233452 m
-583.2 282.233452 l
-stroke
-grestore
-0.600 setlinewidth
-[] 0 setdash
-0.000 setgray
-gsave
-/o {
-gsave
-newpath
-translate
-0.6 setlinewidth
-1 setlinejoin
-0 setlinecap
-0 0 m
--2 0 l
-
-gsave
-0.000 setgray
-fill
-grestore
-stroke
-grestore
-} bind def
-81 282.233 o
-grestore
-0.800 setlinewidth
-[2.96 1.28] 0 setdash
-0.827 setgray
-gsave
-502.2 299 81 49.5 clipbox
-81 294.815418 m
-583.2 294.815418 l
-stroke
-grestore
-0.600 setlinewidth
-[] 0 setdash
-0.000 setgray
-gsave
-/o {
-gsave
-newpath
-translate
-0.6 setlinewidth
-1 setlinejoin
-0 setlinecap
-0 0 m
--2 0 l
-
-gsave
-0.000 setgray
-fill
-grestore
-stroke
-grestore
-} bind def
-81 294.815 o
-grestore
-0.800 setlinewidth
-[2.96 1.28] 0 setdash
-0.827 setgray
-gsave
-502.2 299 81 49.5 clipbox
-81 304.574749 m
-583.2 304.574749 l
-stroke
-grestore
-0.600 setlinewidth
-[] 0 setdash
-0.000 setgray
-gsave
-/o {
-gsave
-newpath
-translate
-0.6 setlinewidth
-1 setlinejoin
-0 setlinecap
-0 0 m
--2 0 l
-
-gsave
-0.000 setgray
-fill
-grestore
-stroke
-grestore
-} bind def
-81 304.575 o
-grestore
-0.800 setlinewidth
-[2.96 1.28] 0 setdash
-0.827 setgray
-gsave
-502.2 299 81 49.5 clipbox
-81 312.548703 m
-583.2 312.548703 l
-stroke
-grestore
-0.600 setlinewidth
-[] 0 setdash
-0.000 setgray
-gsave
-/o {
-gsave
-newpath
-translate
-0.6 setlinewidth
-1 setlinejoin
-0 setlinecap
-0 0 m
--2 0 l
-
-gsave
-0.000 setgray
-fill
-grestore
-stroke
-grestore
-} bind def
-81 312.549 o
-grestore
-0.800 setlinewidth
-[2.96 1.28] 0 setdash
-0.827 setgray
-gsave
-502.2 299 81 49.5 clipbox
-81 319.290585 m
-583.2 319.290585 l
-stroke
-grestore
-0.600 setlinewidth
-[] 0 setdash
-0.000 setgray
-gsave
-/o {
-gsave
-newpath
-translate
-0.6 setlinewidth
-1 setlinejoin
-0 setlinecap
-0 0 m
--2 0 l
-
-gsave
-0.000 setgray
-fill
-grestore
-stroke
-grestore
-} bind def
-81 319.291 o
-grestore
-0.800 setlinewidth
-[2.96 1.28] 0 setdash
-0.827 setgray
-gsave
-502.2 299 81 49.5 clipbox
-81 325.130669 m
-583.2 325.130669 l
-stroke
-grestore
-0.600 setlinewidth
-[] 0 setdash
-0.000 setgray
-gsave
-/o {
-gsave
-newpath
-translate
-0.6 setlinewidth
-1 setlinejoin
-0 setlinecap
-0 0 m
--2 0 l
-
-gsave
-0.000 setgray
-fill
-grestore
-stroke
-grestore
-} bind def
-81 325.131 o
-grestore
-0.800 setlinewidth
-[2.96 1.28] 0 setdash
-0.827 setgray
-gsave
-502.2 299 81 49.5 clipbox
-81 330.281988 m
-583.2 330.281988 l
-stroke
-grestore
-0.600 setlinewidth
-[] 0 setdash
-0.000 setgray
-gsave
-/o {
-gsave
-newpath
-translate
-0.6 setlinewidth
-1 setlinejoin
-0 setlinecap
-0 0 m
--2 0 l
-
-gsave
-0.000 setgray
-fill
-grestore
-stroke
-grestore
-} bind def
-81 330.282 o
+81 327.57 o
grestore
gsave
49.921875 184.677500 translate
@@ -2489,16 +2055,16 @@ grestore
0.122 0.467 0.706 setrgbcolor
gsave
502.2 299 81 49.5 clipbox
-392.948486 63.09 m
-383.772523 80.823285 l
-373.403862 93.405251 l
-361.485466 103.164582 l
-347.471271 111.138536 l
-330.463555 117.880418 l
-308.82612 123.720502 l
-279.055499 128.871821 l
-231.058335 133.479833 l
--1 133.518101 l
+463.913146 63.09 m
+458.325962 91.260953 l
+452.364515 111.248562 l
+445.975042 126.752157 l
+439.091293 139.419515 l
+431.630334 150.129615 l
+423.486432 159.407125 l
+414.521847 167.590468 l
+404.552446 174.910719 l
+-1 175.005663 l
stroke
grestore
0 setlinecap
@@ -2529,105 +2095,36 @@ grestore
stroke
grestore
} bind def
-392.948 63.09 o
-383.773 80.8233 o
-373.404 93.4053 o
-361.485 103.165 o
-347.471 111.139 o
-330.464 117.88 o
-308.826 123.721 o
-279.055 128.872 o
-231.058 133.48 o
--1 133.518 o
+463.913 63.09 o
+458.326 91.261 o
+452.365 111.249 o
+445.975 126.752 o
+439.091 139.42 o
+431.63 150.13 o
+423.486 159.407 o
+414.522 167.59 o
+404.552 174.911 o
+-1 175.006 o
grestore
2 setlinecap
1.000 0.498 0.055 setrgbcolor
gsave
502.2 299 81 49.5 clipbox
-464.779903 63.09 m
-462.67343 80.823285 l
-460.509892 93.405251 l
-458.286113 103.164582 l
-455.99864 111.138536 l
-453.643718 117.880418 l
-451.217247 123.720502 l
-448.714743 128.871821 l
-446.131288 133.479833 l
-414.294532 163.795084 l
-360.553916 181.528369 l
-103.827273 194.110335 l
--1 194.115903 l
-stroke
-grestore
-0 setlinecap
-gsave
-502.2 299 81 49.5 clipbox
-/o {
-gsave
-newpath
-translate
-1.0 setlinewidth
-1 setlinejoin
-0 setlinecap
-0 -3 m
-0.795609 -3 1.55874 -2.683901 2.12132 -2.12132 c
-2.683901 -1.55874 3 -0.795609 3 0 c
-3 0.795609 2.683901 1.55874 2.12132 2.12132 c
-1.55874 2.683901 0.795609 3 0 3 c
--0.795609 3 -1.55874 2.683901 -2.12132 2.12132 c
--2.683901 1.55874 -3 0.795609 -3 0 c
--3 -0.795609 -2.683901 -1.55874 -2.12132 -2.12132 c
--1.55874 -2.683901 -0.795609 -3 0 -3 c
-cl
-
-gsave
-1.000 0.498 0.055 setrgbcolor
-fill
-grestore
-stroke
-grestore
-} bind def
-464.78 63.09 o
-462.673 80.8233 o
-460.51 93.4053 o
-458.286 103.165 o
-455.999 111.139 o
-453.644 117.88 o
-451.217 123.721 o
-448.715 128.872 o
-446.131 133.48 o
-414.295 163.795 o
-360.554 181.528 o
-103.827 194.11 o
--1 194.116 o
-grestore
-2 setlinecap
-0.173 0.627 0.173 setrgbcolor
-gsave
-502.2 299 81 49.5 clipbox
560.372727 63.09 m
-560.212977 80.823285 l
-560.052907 93.405251 l
-559.892516 103.164582 l
-559.731801 111.138536 l
-559.570763 117.880418 l
-559.409399 123.720502 l
-559.247709 128.871821 l
-559.085691 133.479833 l
-557.44717 163.795084 l
-555.774331 181.528369 l
-554.065703 194.110335 l
-552.319723 203.869665 l
-550.534721 211.843619 l
-548.708913 218.585502 l
-546.840388 224.425585 l
-544.927101 229.576904 l
-542.966854 234.184916 l
-520.15285 264.500167 l
-488.093684 282.233452 l
-433.700143 294.815418 l
-136.128966 304.574749 l
--1 304.5807 l
+558.882027 91.260953 l
+557.36594 111.248562 l
+555.823587 126.752157 l
+554.254042 139.419515 l
+552.656328 150.129615 l
+551.029416 159.407125 l
+549.372219 167.590468 l
+547.683587 174.910719 l
+528.760177 223.069281 l
+504.697505 251.240234 l
+471.619165 271.227843 l
+418.397677 286.731438 l
+266.649507 299.398797 l
+-1 299.412741 l
stroke
grestore
0 setlinecap
@@ -2652,62 +2149,103 @@ translate
cl
gsave
-0.173 0.627 0.173 setrgbcolor
+1.000 0.498 0.055 setrgbcolor
fill
grestore
stroke
grestore
} bind def
560.373 63.09 o
-560.213 80.8233 o
-560.053 93.4053 o
-559.893 103.165 o
-559.732 111.139 o
-559.571 117.88 o
-559.409 123.721 o
-559.248 128.872 o
-559.086 133.48 o
-557.447 163.795 o
-555.774 181.528 o
-554.066 194.11 o
-552.32 203.87 o
-550.535 211.844 o
-548.709 218.586 o
-546.84 224.426 o
-544.927 229.577 o
-542.967 234.185 o
-520.153 264.5 o
-488.094 282.233 o
-433.7 294.815 o
-136.129 304.575 o
--1 304.581 o
+558.882 91.261 o
+557.366 111.249 o
+555.824 126.752 o
+554.254 139.42 o
+552.656 150.13 o
+551.029 159.407 o
+549.372 167.59 o
+547.684 174.911 o
+528.76 223.069 o
+504.698 251.24 o
+471.619 271.228 o
+418.398 286.731 o
+266.65 299.399 o
+-1 299.413 o
+grestore
+2 setlinecap
+0.173 0.627 0.173 setrgbcolor
+gsave
+502.2 299 81 49.5 clipbox
+406.857518 63.09 m
+401.942826 91.260953 l
+396.740886 111.248562 l
+391.216024 126.752157 l
+385.325479 139.419515 l
+379.017389 150.129615 l
+372.228014 159.407125 l
+364.877802 167.590468 l
+356.865685 174.910719 l
+103.827273 223.069281 l
+-1 223.083658 l
+stroke
+grestore
+0 setlinecap
+gsave
+502.2 299 81 49.5 clipbox
+/o {
+gsave
+newpath
+translate
+1.0 setlinewidth
+1 setlinejoin
+0 setlinecap
+0 -3 m
+0.795609 -3 1.55874 -2.683901 2.12132 -2.12132 c
+2.683901 -1.55874 3 -0.795609 3 0 c
+3 0.795609 2.683901 1.55874 2.12132 2.12132 c
+1.55874 2.683901 0.795609 3 0 3 c
+-0.795609 3 -1.55874 2.683901 -2.12132 2.12132 c
+-2.683901 1.55874 -3 0.795609 -3 0 c
+-3 -0.795609 -2.683901 -1.55874 -2.12132 -2.12132 c
+-1.55874 -2.683901 -0.795609 -3 0 -3 c
+cl
+
+gsave
+0.173 0.627 0.173 setrgbcolor
+fill
+grestore
+stroke
+grestore
+} bind def
+406.858 63.09 o
+401.943 91.261 o
+396.741 111.249 o
+391.216 126.752 o
+385.325 139.42 o
+379.017 150.13 o
+372.228 159.407 o
+364.878 167.59 o
+356.866 174.911 o
+103.827 223.069 o
+-1 223.084 o
grestore
2 setlinecap
0.839 0.153 0.157 setrgbcolor
gsave
502.2 299 81 49.5 clipbox
-478.329351 63.09 m
-478.148335 80.823285 l
-477.966908 93.405251 l
-477.785068 103.164582 l
-477.602814 111.138536 l
-477.420142 117.880418 l
-477.237051 123.720502 l
-477.05354 128.871821 l
-476.869607 133.479833 l
-475.00659 163.795084 l
-473.099078 181.528369 l
-471.144892 194.110335 l
-469.141691 203.869665 l
-467.086953 211.843619 l
-464.977955 218.585502 l
-462.811755 224.425585 l
-460.585163 229.576904 l
-458.294713 234.184916 l
-430.836039 264.500167 l
-388.655372 282.233452 l
-293.621463 294.815418 l
--1 294.831054 l
+544.207088 63.09 m
+542.416567 91.260953 l
+540.589295 111.248562 l
+538.72373 126.752157 l
+536.818235 139.419515 l
+534.871061 150.129615 l
+532.880345 159.407125 l
+530.844094 167.590468 l
+528.760177 174.910719 l
+504.697505 223.069281 l
+471.619165 251.240234 l
+418.397677 271.227843 l
+266.649507 286.731438 l
+-1 286.74793 l
stroke
grestore
0 setlinecap
@@ -2738,28 +2276,20 @@ grestore
stroke
grestore
} bind def
-478.329 63.09 o
-478.148 80.8233 o
-477.967 93.4053 o
-477.785 103.165 o
-477.603 111.139 o
-477.42 117.88 o
-477.237 123.721 o
-477.054 128.872 o
-476.87 133.48 o
-475.007 163.795 o
-473.099 181.528 o
-471.145 194.11 o
-469.142 203.87 o
-467.087 211.844 o
-464.978 218.586 o
-462.812 224.426 o
-460.585 229.577 o
-458.295 234.185 o
-430.836 264.5 o
-388.655 282.233 o
-293.621 294.815 o
--1 294.831 o
+544.207 63.09 o
+542.417 91.261 o
+540.589 111.249 o
+538.724 126.752 o
+536.818 139.42 o
+534.871 150.13 o
+532.88 159.407 o
+530.844 167.59 o
+528.76 174.911 o
+504.698 223.069 o
+471.619 251.24 o
+418.398 271.228 o
+266.65 286.731 o
+-1 286.748 o
grestore
0.800 setlinewidth
0 setlinejoin
diff --git a/Experiments/MQ309A.png b/Experiments/MQ309A.png
index 5384d51..52fc603 100644
Binary files a/Experiments/MQ309A.png and b/Experiments/MQ309A.png differ
diff --git a/Experiments/MQ309A.svg b/Experiments/MQ309A.svg
index ffff06f..dc5dbdd 100644
--- a/Experiments/MQ309A.svg
+++ b/Experiments/MQ309A.svg
@@ -32,14 +32,14 @@ z
+" id="m0f4d395c5b" style="stroke:#000000;stroke-width:0.8;"/>
-
+
-
+
-
+" id="DejaVuSans-50"/>
-
-
-
-
-
+
+
+
+
-
+
-
-
+
+
+
+
+
-
+
-
+
-
-
+
+
+
+
+
-
+
-
+" id="mcfef527e4e" style="stroke:#000000;stroke-width:0.6;"/>
-
+
-
-
+
-
-
+
-
-
+
-
-
+
-
-
+
-
-
+
-
-
+
-
-
+
-
-
+
-
-
+
-
-
+
-
-
+
-
-
+
-
-
+
-
-
+
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -636,19 +658,19 @@ z
-
+
+" id="m3796166627" style="stroke:#000000;stroke-width:0.8;"/>
-
+
-
+
@@ -656,14 +678,14 @@ L -3.5 0
-
+
-
+
-
+
@@ -671,340 +693,203 @@ L -3.5 0
-
-
-
-
+
+
-
-
+
-
+
-
-
-
-
+
+
-
-
+
-
-
-
-
+
-
+
-
-
+
-
+
-
+
-
-
+
-
+
-
+
-
-
+
-
+
-
+
-
-
+
-
+
-
+
-
-
+
-
+
-
+
-
-
+
-
+
-
+
-
-
+
-
+
-
+
-
-
+
-
+
-
+
-
-
+
-
+
-
+
-
-
+
-
+
-
+
-
-
+
-
+
-
+
-
-
+
-
+
-
+
-
-
+
-
+
-
+
-
-
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
+" id="mff6ecca32d" style="stroke:#1f77b4;"/>
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+" id="m2f88b1ae2f" style="stroke:#ff7f0e;"/>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+" id="m3b483898ac" style="stroke:#2ca02c;"/>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+" id="m4e679e4534" style="stroke:#d62728;"/>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1323,17 +1172,17 @@ Q 505.729688 114.2325 507.729688 114.2325
z
" style="fill:#ffffff;opacity:0.8;stroke:#cccccc;stroke-linejoin:miter;"/>
-
+
-
+
-
+
-
+
-
@@ -1374,17 +1206,17 @@ z
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
+
-
+
diff --git a/Experiments/MQ309_Regression.ipynb b/Experiments/MQ309_Regression.ipynb
index ca28036..519f5ff 100644
--- a/Experiments/MQ309_Regression.ipynb
+++ b/Experiments/MQ309_Regression.ipynb
@@ -98,20 +98,20 @@
},
{
"cell_type": "code",
- "execution_count": 12,
+ "execution_count": 17,
"metadata": {},
"outputs": [],
"source": [
- "x_MQ309A = sheetMQ3.col_values(0)[2:]\n",
- "MQ5_CH4 = sheetMQ3.col_values(1)[2:]\n",
- "MQ5_CO = sheetMQ3.col_values(2)[2:]\n",
- "MQ5_H2 = sheetMQ3.col_values(3)[2:]\n",
- "MQ5_Alcohol = sheetMQ3.col_values(4)[2:]"
+ "x_MQ309A = sheetMQ309A.col_values(0)[2:]\n",
+ "MQ309A_CH4 = sheetMQ309A.col_values(1)[2:]\n",
+ "MQ309A_CO = sheetMQ309A.col_values(2)[2:]\n",
+ "MQ309A_H2 = sheetMQ309A.col_values(3)[2:]\n",
+ "MQ309A_Alcohol = sheetMQ309A.col_values(4)[2:]"
]
},
{
"cell_type": "code",
- "execution_count": 4,
+ "execution_count": 18,
"metadata": {},
"outputs": [],
"source": [
@@ -122,23 +122,39 @@
},
{
"cell_type": "code",
- "execution_count": 5,
+ "execution_count": 19,
"metadata": {},
"outputs": [],
"source": [
- "MQ5_CH4 =zero_to_nan(MQ5_CH4)\n",
- "MQ5_CO =zero_to_nan(MQ5_CO)\n",
- "MQ5_H2 =zero_to_nan(MQ5_H2)\n",
- "MQ5_Alcohol =zero_to_nan(MQ5_Alcohol)"
+ "MQ309A_CH4 =zero_to_nan(MQ309A_CH4)\n",
+ "MQ309A_CO =zero_to_nan(MQ309A_CO)\n",
+ "MQ309A_H2 =zero_to_nan(MQ309A_H2)\n",
+ "MQ309A_Alcohol =zero_to_nan(MQ309A_Alcohol)"
]
},
{
"cell_type": "code",
- "execution_count": 6,
+ "execution_count": 20,
"metadata": {
"scrolled": false
},
- "outputs": [],
+ "outputs": [
+ {
+ "ename": "ValueError",
+ "evalue": "arrays must all be same length",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[1;31mValueError\u001b[0m Traceback (most recent call last)",
+ "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n\u001b[0;32m 12\u001b[0m \u001b[0mdataLPG\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;33m{\u001b[0m\u001b[1;34m'RsRo'\u001b[0m\u001b[1;33m:\u001b[0m \u001b[0mx_MQ309\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'Alcohol'\u001b[0m\u001b[1;33m:\u001b[0m \u001b[0mMQ309A_Alcohol\u001b[0m\u001b[1;33m}\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 13\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 14\u001b[1;33m \u001b[0mdfMQ309A_CH4\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mpd\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mDataFrame\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mdataCH4\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 15\u001b[0m \u001b[0mdfMQ309A_CO\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mpd\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mDataFrame\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mdataCO\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 16\u001b[0m \u001b[0mdfMQ309A_H2\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mpd\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mDataFrame\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mdataH2\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
+ "\u001b[1;32mC:\\ProgramData\\Anaconda3\\lib\\site-packages\\pandas\\core\\frame.py\u001b[0m in \u001b[0;36m__init__\u001b[1;34m(self, data, index, columns, dtype, copy)\u001b[0m\n\u001b[0;32m 390\u001b[0m dtype=dtype, copy=copy)\n\u001b[0;32m 391\u001b[0m \u001b[1;32melif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mdata\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdict\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 392\u001b[1;33m \u001b[0mmgr\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0minit_dict\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mdata\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mindex\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcolumns\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdtype\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mdtype\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 393\u001b[0m \u001b[1;32melif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mdata\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mma\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mMaskedArray\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 394\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mnumpy\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mma\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mmrecords\u001b[0m \u001b[1;32mas\u001b[0m \u001b[0mmrecords\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
+ "\u001b[1;32mC:\\ProgramData\\Anaconda3\\lib\\site-packages\\pandas\\core\\internals\\construction.py\u001b[0m in \u001b[0;36minit_dict\u001b[1;34m(data, index, columns, dtype)\u001b[0m\n\u001b[0;32m 210\u001b[0m \u001b[0marrays\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;33m[\u001b[0m\u001b[0mdata\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mk\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;32mfor\u001b[0m \u001b[0mk\u001b[0m \u001b[1;32min\u001b[0m \u001b[0mkeys\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 211\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 212\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0marrays_to_mgr\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0marrays\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdata_names\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mindex\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcolumns\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdtype\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mdtype\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 213\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 214\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n",
+ "\u001b[1;32mC:\\ProgramData\\Anaconda3\\lib\\site-packages\\pandas\\core\\internals\\construction.py\u001b[0m in \u001b[0;36marrays_to_mgr\u001b[1;34m(arrays, arr_names, index, columns, dtype)\u001b[0m\n\u001b[0;32m 49\u001b[0m \u001b[1;31m# figure out the index, if necessary\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 50\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mindex\u001b[0m \u001b[1;32mis\u001b[0m \u001b[1;32mNone\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 51\u001b[1;33m \u001b[0mindex\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mextract_index\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0marrays\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 52\u001b[0m \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 53\u001b[0m \u001b[0mindex\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mensure_index\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mindex\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
+ "\u001b[1;32mC:\\ProgramData\\Anaconda3\\lib\\site-packages\\pandas\\core\\internals\\construction.py\u001b[0m in \u001b[0;36mextract_index\u001b[1;34m(data)\u001b[0m\n\u001b[0;32m 315\u001b[0m \u001b[0mlengths\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mlist\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mset\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mraw_lengths\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 316\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mlen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mlengths\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;33m>\u001b[0m \u001b[1;36m1\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 317\u001b[1;33m \u001b[1;32mraise\u001b[0m \u001b[0mValueError\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'arrays must all be same length'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 318\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 319\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mhave_dicts\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
+ "\u001b[1;31mValueError\u001b[0m: arrays must all be same length"
+ ]
+ }
+ ],
"source": [
"import pandas as pd\n",
"import numpy as np\n",
@@ -148,10 +164,10 @@
"from sklearn import datasets\n",
"from sklearn import linear_model\n",
"\n",
- "dataCH4 = {'RsRo': x_MQ309, 'CH4': MQ5_CH4}\n",
- "dataCO = {'RsRo': x_MQ309, 'CO': MQ5_CO}\n",
- "dataH2 = {'RsRo': x_MQ309, 'H2': MQ5_H2}\n",
- "dataLPG = {'RsRo': x_MQ309, 'Alcohol': MQ5_Alcohol}\n",
+ "dataCH4 = {'RsRo': x_MQ309, 'CH4': MQ309A_CH4}\n",
+ "dataCO = {'RsRo': x_MQ309, 'CO': MQ309A_CO}\n",
+ "dataH2 = {'RsRo': x_MQ309, 'H2': MQ309A_H2}\n",
+ "dataLPG = {'RsRo': x_MQ309, 'Alcohol': MQ309A_Alcohol}\n",
"\n",
"dfMQ309A_CH4 = pd.DataFrame(dataCH4)\n",
"dfMQ309A_CO = pd.DataFrame(dataCO)\n",