From ffa84e6d3d749ae4a1911d6a69a60dcd05fe07dc Mon Sep 17 00:00:00 2001 From: msorvoja Date: Thu, 19 Dec 2024 09:14:09 +0200 Subject: [PATCH] Fix notebook --- .../testing_logratio_transformations.ipynb | 45 +++++-------------- 1 file changed, 12 insertions(+), 33 deletions(-) diff --git a/notebooks/testing_logratio_transformations.ipynb b/notebooks/testing_logratio_transformations.ipynb index 4ca0dcd3..53e18c74 100644 --- a/notebooks/testing_logratio_transformations.ipynb +++ b/notebooks/testing_logratio_transformations.ipynb @@ -680,21 +680,6 @@ "## Testing with example data" ] }, - { - "cell_type": "code", - "execution_count": 18, - "id": "f49926c2-f1dd-47e8-a484-f78ce6821904", - "metadata": { - "tags": [] - }, - "outputs": [], - "source": [ - "# Define some constants\n", - "\n", - "ppm = 1e-6\n", - "million = 1e6" - ] - }, { "cell_type": "code", "execution_count": 19, @@ -822,7 +807,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 26, "id": "75728aa4-5b2e-46b6-9511-1250bf4b13ae", "metadata": { "tags": [] @@ -838,12 +823,14 @@ "df_clr = df.copy()\n", "df_plr = df.copy()\n", "\n", - "# As real world geochemical data will often not satisfy sum to a constant, for example 100, a closure needs to be performed\n", + "# As real world geochemical data will often not satisfy sum to a constant, a closure needs to be performed by providing the \"scale\" parameter.\n", + "# In this example, as the example data are in ppm, let's define a scaling factor 1e6\n", + "million = 1e6\n", "\n", - "df_alr = alr_transform(df_alr, closure_target=100)\n", - "df_alr_Mg = alr_transform(df_alr_Mg, denominator_column=\"Mg_ppm_511\", closure_target=100)\n", - "df_clr = clr_transform(df_clr, closure_target=100)\n", - "df_plr = plr_transform(df_plr, closure_target=100)\n", + "df_alr = alr_transform(df_alr, scale=million)\n", + "df_alr_Mg = alr_transform(df_alr_Mg, denominator_column=\"Mg_ppm_511\", scale=million)\n", + "df_clr = clr_transform(df_clr, scale=million)\n", + "df_plr = plr_transform(df_plr, scale=million)\n", "\n", "df_clr_inv = inverse_clr(df_clr, scale=million)\n", "df_alr_inv = inverse_alr(df_alr, \"c\", scale=million)\n", @@ -851,8 +838,8 @@ "df_ilr_Al_Ca = df.copy()\n", "df_ilr_AlCa_FeMg = df.copy()\n", "\n", - "df_ilr_Al_Ca = single_ilr_transform(df_ilr_Al_Ca, [\"Al_ppm_511\"], [\"Ca_ppm_511\"], closure_target=100)\n", - "df_ilr_AlCa_FeMg = single_ilr_transform(df_ilr_AlCa_FeMg, [\"Al_ppm_511\", \"Ca_ppm_511\"], [\"Fe_ppm_511\", \"Mg_ppm_511\"], closure_target=100)" + "df_ilr_Al_Ca = single_ilr_transform(df_ilr_Al_Ca, [\"Al_ppm_511\"], [\"Ca_ppm_511\"], scale=million)\n", + "df_ilr_AlCa_FeMg = single_ilr_transform(df_ilr_AlCa_FeMg, [\"Al_ppm_511\", \"Ca_ppm_511\"], [\"Fe_ppm_511\", \"Mg_ppm_511\"], scale=million)" ] }, { @@ -969,19 +956,11 @@ "source": [ "df_alr_Mg.head()" ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "8b6a1929-51ef-4b7a-8621-f46bbe337e31", - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "eis-toolkit-l5cKD1lZ-py3.10", "language": "python", "name": "python3" }, @@ -995,7 +974,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.12" + "version": "3.10.15" } }, "nbformat": 4,