Adding code for extract exact columns for processing

main
guillermoponce 3 weeks ago
parent 31c776b1da
commit 6e035aabae

@ -48,12 +48,13 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 25, "execution_count": 17,
"id": "5bbeed9a", "id": "5bbeed9a",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"import pandas as pd\n", "import pandas as pd\n",
"import numpy as np\n",
"from pathlib import Path\n", "from pathlib import Path\n",
"from dataclasses import dataclass\n", "from dataclasses import dataclass\n",
"\n", "\n",
@ -67,7 +68,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 39, "execution_count": 33,
"id": "12b2d8f0", "id": "12b2d8f0",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -76,7 +77,14 @@
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"The min value of the exp_1 are: 0.6 V, length: 77\n", "The min value of the exp_1 are: 0.6 V, length: 77\n",
"The min value of the exp_2 are: 0.3 V, length: 85\n" "The min value of the exp_2 are: 0.3 V, length: 85\n",
"77 85\n",
"77\n",
"85\n",
"True\n",
"[0.573808, 0.668549, 0.772401, 0.869213, 0.973349, 1.071694, 1.173009, 1.27474, 1.372375, 1.471467, 1.568757, 1.672959, 1.776859, 1.8776, 1.965347, 2.064571, 2.151419, 2.243739, 2.32795, 2.419784, 2.508601, 2.592741, 2.677183, 2.768261, 2.852988, 2.93498, 3.019871, 3.10941, 3.193848, 3.277706, 3.360108, 3.445992, 3.533107, 3.616832, 3.679116, 3.766311, 3.8489, 3.934223, 4.016886, 4.090264, 4.178369, 4.247341, 4.296629, 4.383905, 4.464879, 4.5511, 4.644093, 4.728928, 4.781434, 4.892725, 4.971322, 5.060052, 5.185251, 5.194691, 5.262038, 5.357256, 5.458388, 5.544996, 5.60318, 5.675927, 5.757613, 5.844239, 5.910516, 6.025117, 6.090627, 6.175911, 6.266985, 6.351973, 6.424481, 6.592911, 6.674127, 6.741563, 6.831755, 6.913147, 7.000398]\n",
"[0.573853, 0.667522, 0.773055, 0.872369, 0.97355, 1.074186, 1.167853, 1.272827, 1.3683, 1.472672, 1.569552, 1.675805, 1.769356, 1.86589, 1.944208, 2.018332, 2.088197, 2.15909, 2.220222, 2.275156, 2.355009, 2.439813, 2.553364, 2.649481, 2.717847, 2.788432, 2.873282, 2.976466, 3.050858, 3.131146, 3.22697, 3.317778, 3.398386, 3.487932, 3.575035, 3.661309, 3.763909, 3.864253, 3.941614, 4.043282, 4.12081, 4.20273, 4.280082, 4.37163, 4.440561, 4.539856, 4.623924, 4.683808, 4.75006, 4.844785, 4.948401, 5.019534, 5.09199, 5.184119, 5.246069, 5.346119, 5.423541, 5.508804, 5.592692, 5.677811, 5.766302, 5.8584, 5.936311, 6.080866, 6.150302, 6.232371, 6.324351, 6.402649, 6.494829, 6.574733, 6.642314, 6.733614, 6.813686, 6.892127, 6.970774]\n",
"[0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8, 4.9, 5.0, 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 5.9, 6.0, 6.1, 6.2, 6.3, 6.4, 6.5, 6.6, 6.7, 6.8, 6.9, 7.0, 7.1, 7.2, 7.3, 7.4, 7.5, 7.6, 7.7, 7.8, 7.9, 8.0]\n"
] ]
} }
], ],
@ -92,8 +100,8 @@
"#df_1.head()\n", "#df_1.head()\n",
"\n", "\n",
"cols_extract = [\"Voltaje Inyectado (V)\", \"Voltaje Electrodos (V)\", \"Corriente Electrodos (A)\", \"Resistencia\"]\n", "cols_extract = [\"Voltaje Inyectado (V)\", \"Voltaje Electrodos (V)\", \"Corriente Electrodos (A)\", \"Resistencia\"]\n",
"dt_exp1 = df_1[cols_extract].copy()\n", "dt_exp1 = df_1[cols_extract].copy() #Exp 20250917\n",
"dt_exp2 = df_2[cols_extract].copy()\n", "dt_exp2 = df_2[cols_extract].copy() #Exp 20250922\n",
"\n", "\n",
"exp_1 = Experimento(\n", "exp_1 = Experimento(\n",
" volt_iny = dt_exp1[\"Voltaje Inyectado (V)\"], \n", " volt_iny = dt_exp1[\"Voltaje Inyectado (V)\"], \n",
@ -113,7 +121,46 @@
"min_val_exp2 = min(exp_2.volt_iny)\n", "min_val_exp2 = min(exp_2.volt_iny)\n",
"\n", "\n",
"print(f\"The min value of the exp_1 are: {min_val_exp1} V, length: {len(exp_1.volt_iny)}\")\n", "print(f\"The min value of the exp_1 are: {min_val_exp1} V, length: {len(exp_1.volt_iny)}\")\n",
"print(f\"The min value of the exp_2 are: {min_val_exp2} V, length: {len(exp_2.volt_iny)}\")" "print(f\"The min value of the exp_2 are: {min_val_exp2} V, length: {len(exp_2.volt_iny)}\")\n",
"\n",
"# Now we filter the data for extract only the values that we need to work with\n",
"min_value = 0.6\n",
"max_value = 8.0\n",
"\n",
"volt_iny_20250917 = exp_1.volt_iny.to_list() # voltage supply for exp_1\n",
"volt_iny_20250922 = exp_2.volt_iny.to_list() # voltage supply for exp_2\n",
"volt_elec_20250917 = exp_1.volt_elec.to_list() # from exp_1\n",
"volt_elec_20250922 = exp_2.volt_elec.to_list() # from exp_2\n",
"\n",
"print(len(volt_iny_20250917), len(volt_iny_20250922))\n",
"print(len(volt_elec_20250917))\n",
"print(len(volt_elec_20250922))\n",
"\n",
"volt_iny_filt_20250917 = []\n",
"volt_elec_filt_20250917 = []\n",
"volt_elec_filt_20250922 = []\n",
"\n",
"for x in range(len(volt_iny_20250917)):\n",
" if min_value <= volt_iny_20250917[x] <= max_value:\n",
" volt_iny_filt_20250917.append(volt_iny_20250917[x])\n",
" volt_elec_filt_20250917.append(volt_elec_20250917[x])\n",
"\n",
"for x in range(len(volt_iny_20250922)):\n",
" if min_value <= volt_iny_20250922[x] <= max_value:\n",
" volt_elec_filt_20250922.append(volt_elec_20250922[x])\n",
"\n",
"if len(volt_iny_filt_20250917) == len(volt_elec_filt_20250917) and len(volt_iny_filt_20250917) == len(volt_elec_filt_20250922):\n",
" print(True)\n",
"else:\n",
" print(False)\n",
"\n",
"print(volt_elec_filt_20250917)\n",
"print(volt_elec_filt_20250922)\n",
"print(volt_iny_filt_20250917)\n",
"\n",
"\n",
"\n",
"\n"
] ]
} }
], ],

Loading…
Cancel
Save