Skip to content

Commit

Permalink
fix the tutorial issue related to #105
Browse files Browse the repository at this point in the history
  • Loading branch information
yalinli2 committed Sep 15, 2023
1 parent 7d1b75a commit a6a6be7
Showing 1 changed file with 52 additions and 64 deletions.
116 changes: 52 additions & 64 deletions docs/source/tutorials/2_Component.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"This tutorial was made with qsdsan v1.2.0.\n"
"This tutorial was made with qsdsan v1.3.0.\n"
]
}
],
Expand Down Expand Up @@ -293,18 +293,18 @@
"[Data] MW: 18.015 g/mol\n",
" Tm: 273.15 K\n",
" Tb: 373.12 K\n",
" Tt: 273.15 K\n",
" Tc: 647.14 K\n",
" Pt: 610 Pa\n",
" Pc: 2.2048e+07 Pa\n",
" Vc: 5.6e-05 m^3/mol\n",
" Tt: 273.16 K\n",
" Tc: 647.1 K\n",
" Pt: 611.65 Pa\n",
" Pc: 2.2064e+07 Pa\n",
" Vc: 5.5948e-05 m^3/mol\n",
" Hf: -2.8582e+05 J/mol\n",
" S0: 70 J/K/mol\n",
" LHV: -44011 J/mol\n",
" HHV: -0 J/mol\n",
" Hfus: 6010 J/mol\n",
" Sfus: None\n",
" omega: 0.344\n",
" omega: 0.3443\n",
" dipole: 1.85 Debye\n",
" similarity_variable: 0.16653\n",
" iscyclic_aliphatic: 0\n",
Expand Down Expand Up @@ -403,7 +403,7 @@
" i_mass: 1.2878 g mass/g N\n",
" i_charge: 0.071394 mol +/g N\n",
" i_COD: 0 g COD/g N\n",
" i_NOD: 0 g NOD/g N\n",
" i_NOD: 4.5691 g NOD/g N\n",
" f_BOD5_COD: 0\n",
" f_uBOD_COD: 0\n",
" f_Vmass_Totmass: 0\n",
Expand Down Expand Up @@ -600,7 +600,7 @@
" i_mass: 1 g mass/g \n",
" i_charge: 0.055437 mol +/g \n",
" i_COD: 0 g COD/g \n",
" i_NOD: 0 g NOD/g \n",
" i_NOD: 3.5478 g NOD/g \n",
" f_BOD5_COD: 0\n",
" f_uBOD_COD: 0\n",
" f_Vmass_Totmass: 0\n",
Expand Down Expand Up @@ -637,7 +637,7 @@
" i_mass: 1.2878 g mass/g N\n",
" i_charge: 0.071394 mol +/g N\n",
" i_COD: 0 g COD/g N\n",
" i_NOD: 0 g NOD/g N\n",
" i_NOD: 4.5691 g NOD/g N\n",
" f_BOD5_COD: 0\n",
" f_uBOD_COD: 0\n",
" f_Vmass_Totmass: 0\n",
Expand Down Expand Up @@ -1013,27 +1013,6 @@
">>> cmps"
]
},
{
"cell_type": "code",
"execution_count": 40,
"metadata": {},
"outputs": [],
"source": [
"# Note that it's fine to have the \">>>\" or \"...\" (indicates line continuation), in front of the code\n",
"# (indication doesn't matter either) as long as you don't have comments\n",
"# So the previous cell will work but this cell won't\n",
"# >>> import qsdsan as qs\n",
"# >>> chems = qs.Chemicals((qs.Chemical('Water'), qs.Chemical('Ethanol')))\n",
"# >>> data = {'Water': {'particle_size': 'Soluble',\n",
"# ... 'degradability': 'Undegradable',\n",
"# ... 'organic': False},\n",
"# ... 'Ethanol': {'particle_size': 'Soluble',\n",
"# ... 'degradability': 'Readily',\n",
"# ... 'organic': False}}\n",
"# >>> cmps2 = qs.Components.from_chemicals(chems, **data)\n",
"# >>> cmps2"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand All @@ -1044,7 +1023,7 @@
},
{
"cell_type": "code",
"execution_count": 41,
"execution_count": 40,
"metadata": {},
"outputs": [
{
Expand All @@ -1070,7 +1049,7 @@
},
{
"cell_type": "code",
"execution_count": 42,
"execution_count": 41,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -1161,8 +1140,8 @@
" <td>0.717</td>\n",
" <td>0.863</td>\n",
" <td>1</td>\n",
" <td>64-19-7</td>\n",
" <td>176</td>\n",
" <td>71-50-1</td>\n",
" <td>175</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
Expand All @@ -1175,33 +1154,26 @@
" <td>0.717</td>\n",
" <td>0.863</td>\n",
" <td>1</td>\n",
" <td>79-09-3</td>\n",
" <td>1.03e+03</td>\n",
" <td>72-03-7</td>\n",
" <td>1.05e+05</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>5 rows × 22 columns</p>\n",
"</div>"
],
"text/plain": [
" ID description formula particle_size degradability \\\n",
"0 S_H2 Dissolved dihydrogen gas H2 Dissolved gas Readily \n",
"1 S_CH4 Dissolved Methane CH4 Dissolved gas Readily \n",
"2 S_CH3OH Methanol CH3OH Soluble Readily \n",
"3 S_Ac Acetate CH3COO(-) Soluble Readily \n",
"4 S_Prop Propionate C2H5COO- Soluble Readily \n",
"\n",
" ... f_BOD5_COD f_uBOD_COD f_Vmass_Totmass CAS PubChem \n",
"0 ... 0 0 1 1333-74-0 783 \n",
"1 ... 0 0 1 74-82-8 297 \n",
"2 ... 0.717 0.863 1 67-56-1 887 \n",
"3 ... 0.717 0.863 1 64-19-7 176 \n",
"4 ... 0.717 0.863 1 79-09-3 1.03e+03 \n",
" ID description formula particle_size degradability ... f_BOD5_COD f_uBOD_COD f_Vmass_Totmass CAS PubChem\n",
"0 S_H2 Dissolved dihydrogen gas H2 Dissolved gas Readily ... 0 0 1 1333-74-0 783\n",
"1 S_CH4 Dissolved Methane CH4 Dissolved gas Readily ... 0 0 1 74-82-8 297\n",
"2 S_CH3OH Methanol CH3OH Soluble Readily ... 0.717 0.863 1 67-56-1 887\n",
"3 S_Ac Acetate CH3COO(-) Soluble Readily ... 0.717 0.863 1 71-50-1 175\n",
"4 S_Prop Propionate C2H5COO- Soluble Readily ... 0.717 0.863 1 72-03-7 1.05e+05\n",
"\n",
"[5 rows x 22 columns]"
]
},
"execution_count": 42,
"execution_count": 41,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -1217,20 +1189,18 @@
},
{
"cell_type": "code",
"execution_count": 43,
"execution_count": 42,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Index(['ID', 'description', 'formula', 'particle_size', 'degradability',\n",
" 'organic', 'measured_as', 'i_C', 'i_N', 'i_P', 'i_K', 'i_Mg', 'i_Ca',\n",
" 'i_mass', 'i_charge', 'i_COD', 'i_NOD', 'f_BOD5_COD', 'f_uBOD_COD',\n",
" 'f_Vmass_Totmass', 'CAS', 'PubChem'],\n",
"Index(['ID', 'description', 'formula', 'particle_size', 'degradability', 'organic', 'measured_as', 'i_C', 'i_N', 'i_P', 'i_K', 'i_Mg', 'i_Ca', 'i_mass',\n",
" 'i_charge', 'i_COD', 'i_NOD', 'f_BOD5_COD', 'f_uBOD_COD', 'f_Vmass_Totmass', 'CAS', 'PubChem'],\n",
" dtype='object')"
]
},
"execution_count": 43,
"execution_count": 42,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -1239,6 +1209,24 @@
"df.columns"
]
},
{
"cell_type": "code",
"execution_count": 43,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Components([S_H2, S_CH4, S_CH3OH, S_Ac, S_Prop, S_F, S_U_Inf, S_U_E, C_B_Subst, C_B_BAP, C_B_UAP, C_U_Inf, X_B_Subst, X_OHO_PHA, X_GAO_PHA, X_PAO_PHA, X_GAO_Gly, X_PAO_Gly, X_OHO, X_AOO, X_NOO, X_AMO, X_PAO, X_MEOLO, X_FO, X_ACO, X_HMO, X_PRO, X_U_Inf, X_U_OHO_E, X_U_PAO_E, X_Ig_ISS, X_MgCO3, X_CaCO3, X_MAP, X_HAP, X_HDP, X_FePO4, X_AlPO4, X_AlOH, X_FeOH, X_PAO_PP_Lo, X_PAO_PP_Hi, S_NH4, S_NO2, S_NO3, S_PO4, S_K, S_Ca, S_Mg, S_CO3, S_N2, S_O2, S_CAT, S_AN])\n"
]
}
],
"source": [
"cmps2 = qs.Components.load_from_file(df)\n",
"cmps2.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -1291,7 +1279,7 @@
" \n",
"# Now we can compile\n",
"cmps1.compile()\n",
"cmps1"
"cmps1.show()"
]
},
{
Expand All @@ -1308,9 +1296,9 @@
}
],
"source": [
"# For the default `Components` objects, the easy way is let it compile during loading\n",
"# For the default `Components` objects, the easy way is to let it compile during loading\n",
"cmps3 = qs.Components.load_default()\n",
"cmps3"
"cmps3.show()"
]
},
{
Expand Down Expand Up @@ -1341,7 +1329,7 @@
"# would be to make a new `Components` containing all the `Component` objects in the `CompiledComponent`\n",
"cmps4 = qs.Components(cmps1)\n",
"cmps4.append(cmps3.S_H2)\n",
"cmps4"
"cmps4.show()"
]
},
{
Expand All @@ -1362,7 +1350,7 @@
"# you can hand pick the `Component` IDs you want and input it to the \n",
"# `.subgroup()` method.\n",
"cmps5 = cmps3.subgroup(['S_CH4', 'S_Ac', 'S_F', 'S_NH4'])\n",
"cmps5"
"cmps5.show()"
]
},
{
Expand Down Expand Up @@ -1523,7 +1511,7 @@
{
"data": {
"text/plain": [
"140171061956096"
"2332755558272"
]
},
"execution_count": 57,
Expand All @@ -1543,7 +1531,7 @@
{
"data": {
"text/plain": [
"140171081327744"
"2332718576768"
]
},
"execution_count": 58,
Expand Down

0 comments on commit a6a6be7

Please sign in to comment.