You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
py-data-analysis/Experimental_Analysis.ipynb

9.5 KiB

None <html lang="en"> <head> </head>

Experimental Data-Analysis

In [3]:
pip install pandas
Collecting pandas
  Downloading pandas-2.3.3-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.metadata (91 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 91.2/91.2 kB 4.3 MB/s eta 0:00:00
Collecting numpy>=1.26.0 (from pandas)
  Downloading numpy-2.3.3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.metadata (62 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.1/62.1 kB 5.8 MB/s eta 0:00:00
Requirement already satisfied: python-dateutil>=2.8.2 in ./.venv/lib/python3.12/site-packages (from pandas) (2.9.0.post0)
Collecting pytz>=2020.1 (from pandas)
  Using cached pytz-2025.2-py2.py3-none-any.whl.metadata (22 kB)
Collecting tzdata>=2022.7 (from pandas)
  Using cached tzdata-2025.2-py2.py3-none-any.whl.metadata (1.4 kB)
Requirement already satisfied: six>=1.5 in ./.venv/lib/python3.12/site-packages (from python-dateutil>=2.8.2->pandas) (1.17.0)
Downloading pandas-2.3.3-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (12.4 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 12.4/12.4 MB 9.8 MB/s eta 0:00:00:00:0100:01
Downloading numpy-2.3.3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (16.6 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 16.6/16.6 MB 11.2 MB/s eta 0:00:0000:0100:01
Using cached pytz-2025.2-py2.py3-none-any.whl (509 kB)
Using cached tzdata-2025.2-py2.py3-none-any.whl (347 kB)
Installing collected packages: pytz, tzdata, numpy, pandas
Successfully installed numpy-2.3.3 pandas-2.3.3 pytz-2025.2 tzdata-2025.2
Note: you may need to restart the kernel to use updated packages.
In [17]:
import  pandas      as      pd
import  numpy       as      np
from    pathlib     import  Path
from    dataclasses import  dataclass

class   Experimento:
    def __init__(self, volt_iny, volt_elec, corr_elec, resistencia):
        self.volt_iny    =   volt_iny
        self.volt_elec   =   volt_elec
        self.corr_elec   =   corr_elec
        self.resistencia =   resistencia
In [33]:
path_1  =   Path("/home/mgph/Desktop/?/MAESTRIA/HYDROGEN_PROJ/Data/Experimental-Data/EXP-A_20250917_163949.csv")    # Path for the experiment 20250917
path_2  =   Path("/home/mgph/Desktop/?/MAESTRIA/HYDROGEN_PROJ/Data/Experimental-Data/EXP-A_20250922_100524.csv")     # Path for the experiment 20250922
# Import the experiment "20250917"
df_1    =   pd.read_csv(path_1, encoding="latin-1")
# Import the experiment "20250922"
df_2    =   pd.read_csv(path_2, encoding="latin-1")
#df_1.head() 
#df_1.head()

cols_extract    =   ["Voltaje Inyectado (V)", "Voltaje Electrodos (V)", "Corriente Electrodos (A)", "Resistencia"]
dt_exp1         =   df_1[cols_extract].copy()   #Exp 20250917
dt_exp2         =   df_2[cols_extract].copy()   #Exp 20250922

exp_1   =   Experimento(
    volt_iny    =   dt_exp1["Voltaje Inyectado (V)"], 
    volt_elec   =   dt_exp1["Voltaje Electrodos (V)"],
    corr_elec   =   dt_exp1["Corriente Electrodos (A)"],
    resistencia =   dt_exp1["Resistencia"],
)

exp_2   =   Experimento(
    volt_iny    =   dt_exp2["Voltaje Inyectado (V)"], 
    volt_elec   =   dt_exp2["Voltaje Electrodos (V)"],
    corr_elec   =   dt_exp2["Corriente Electrodos (A)"],
    resistencia =   dt_exp2["Resistencia"],
)

min_val_exp1    =   min(exp_1.volt_iny)
min_val_exp2    =   min(exp_2.volt_iny)

print(f"The min value of the exp_1 are: {min_val_exp1} V, length: {len(exp_1.volt_iny)}")
print(f"The min value of the exp_2 are: {min_val_exp2} V, length: {len(exp_2.volt_iny)}")

# Now we filter the data for extract only the values that we need to work with
min_value   =   0.6
max_value   =   8.0

volt_iny_20250917   =   exp_1.volt_iny.to_list()   #   voltage supply for exp_1
volt_iny_20250922   =   exp_2.volt_iny.to_list()   #   voltage supply for exp_2
volt_elec_20250917  =   exp_1.volt_elec.to_list()  #   from exp_1
volt_elec_20250922  =   exp_2.volt_elec.to_list()  #   from exp_2

print(len(volt_iny_20250917), len(volt_iny_20250922))
print(len(volt_elec_20250917))
print(len(volt_elec_20250922))

volt_iny_filt_20250917  =   []
volt_elec_filt_20250917 =   []
volt_elec_filt_20250922 =   []

for x in range(len(volt_iny_20250917)):
    if min_value    <=  volt_iny_20250917[x]  <=  max_value:
        volt_iny_filt_20250917.append(volt_iny_20250917[x])
        volt_elec_filt_20250917.append(volt_elec_20250917[x])

for x in range(len(volt_iny_20250922)):
    if min_value    <=  volt_iny_20250922[x]    <=  max_value:
        volt_elec_filt_20250922.append(volt_elec_20250922[x])

if len(volt_iny_filt_20250917) == len(volt_elec_filt_20250917) and len(volt_iny_filt_20250917) == len(volt_elec_filt_20250922):
    print(True)
else:
    print(False)

print(volt_elec_filt_20250917)
print(volt_elec_filt_20250922)
print(volt_iny_filt_20250917)
The min value of the exp_1 are: 0.6 V, length: 77
The min value of the exp_2 are: 0.3 V, length: 85
77 85
77
85
True
[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]
[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]
[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]
</html>