Skip to content

Commit 57a6c39

Browse files
jtlaitnmaarnio
authored andcommitted
Revert "Update example notebook."
This reverts commit 8ec96f6.
1 parent 1e23b65 commit 57a6c39

File tree

1 file changed

+45
-20
lines changed

1 file changed

+45
-20
lines changed

notebooks/testing_logratio_transformations.ipynb

+45-20
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@
2020
"name": "stderr",
2121
"output_type": "stream",
2222
"text": [
23-
"/root/.cache/pypoetry/virtualenvs/eis-toolkit-QEzTY9B6-py3.10/lib/python3.10/site-packages/geopandas/_compat.py:112: UserWarning: The Shapely GEOS version (3.10.3-CAPI-1.16.1) is incompatible with the GEOS version PyGEOS was compiled with (3.10.4-CAPI-1.16.2). Conversions between both will be slow.\n",
24-
" warnings.warn(\n"
23+
"/root/.cache/pypoetry/virtualenvs/eis-toolkit-QEzTY9B6-py3.10/lib/python3.10/site-packages/beartype/_util/hint/pep/utilpeptest.py:347: BeartypeDecorHintPep585DeprecationWarning: PEP 484 type hint typing.Sequence[str] deprecated by PEP 585. This hint is scheduled for removal in the first Python version released after October 5th, 2025. To resolve this, import this hint from \"beartype.typing\" rather than \"typing\". For further commentary and alternatives, see also:\n",
24+
" https://beartype.readthedocs.io/en/latest/api_roar/#pep-585-deprecations\n",
25+
" warn(\n"
2526
]
2627
}
2728
],
@@ -726,7 +727,7 @@
726727
{
727728
"cell_type": "code",
728729
"execution_count": 21,
729-
"id": "41bfcb78-bdfa-4c03-a9b4-45c2258c60a8",
730+
"id": "e1bda63b-ab9b-4060-90d5-7520952f2e3a",
730731
"metadata": {
731732
"tags": []
732733
},
@@ -756,6 +757,7 @@
756757
" <th>Ca_ppm_511</th>\n",
757758
" <th>Fe_ppm_511</th>\n",
758759
" <th>Mg_ppm_511</th>\n",
760+
" <th>residual</th>\n",
759761
" </tr>\n",
760762
" </thead>\n",
761763
" <tbody>\n",
@@ -765,46 +767,51 @@
765767
" <td>40200.0</td>\n",
766768
" <td>83200.0</td>\n",
767769
" <td>17200.0</td>\n",
770+
" <td>831800.0</td>\n",
768771
" </tr>\n",
769772
" <tr>\n",
770773
" <th>1</th>\n",
771774
" <td>14100.0</td>\n",
772775
" <td>5000.0</td>\n",
773776
" <td>28300.0</td>\n",
774777
" <td>7520.0</td>\n",
778+
" <td>945080.0</td>\n",
775779
" </tr>\n",
776780
" <tr>\n",
777781
" <th>2</th>\n",
778782
" <td>7880.0</td>\n",
779783
" <td>3070.0</td>\n",
780784
" <td>14500.0</td>\n",
781785
" <td>4540.0</td>\n",
786+
" <td>970010.0</td>\n",
782787
" </tr>\n",
783788
" <tr>\n",
784789
" <th>3</th>\n",
785790
" <td>7300.0</td>\n",
786791
" <td>3290.0</td>\n",
787792
" <td>14600.0</td>\n",
788793
" <td>3240.0</td>\n",
794+
" <td>971570.0</td>\n",
789795
" </tr>\n",
790796
" <tr>\n",
791797
" <th>4</th>\n",
792798
" <td>12500.0</td>\n",
793799
" <td>3600.0</td>\n",
794800
" <td>31500.0</td>\n",
795801
" <td>8020.0</td>\n",
802+
" <td>944380.0</td>\n",
796803
" </tr>\n",
797804
" </tbody>\n",
798805
"</table>\n",
799806
"</div>"
800807
],
801808
"text/plain": [
802-
" Al_ppm_511 Ca_ppm_511 Fe_ppm_511 Mg_ppm_511\n",
803-
"0 27600.0 40200.0 83200.0 17200.0\n",
804-
"1 14100.0 5000.0 28300.0 7520.0\n",
805-
"2 7880.0 3070.0 14500.0 4540.0\n",
806-
"3 7300.0 3290.0 14600.0 3240.0\n",
807-
"4 12500.0 3600.0 31500.0 8020.0"
809+
" Al_ppm_511 Ca_ppm_511 Fe_ppm_511 Mg_ppm_511 residual\n",
810+
"0 27600.0 40200.0 83200.0 17200.0 831800.0\n",
811+
"1 14100.0 5000.0 28300.0 7520.0 945080.0\n",
812+
"2 7880.0 3070.0 14500.0 4540.0 970010.0\n",
813+
"3 7300.0 3290.0 14600.0 3240.0 971570.0\n",
814+
"4 12500.0 3600.0 31500.0 8020.0 944380.0"
808815
]
809816
},
810817
"execution_count": 21,
@@ -818,12 +825,15 @@
818825
"df = gpd.read_file(GEOCHEMICAL_DATA, include_fields=elements_to_analyze)\n",
819826
"df = pd.DataFrame(df.drop(columns='geometry'))\n",
820827
"\n",
828+
"# Add a column for the residual\n",
829+
"\n",
830+
"df[\"residual\"] = million - np.sum(df, axis=1)\n",
821831
"df.head()"
822832
]
823833
},
824834
{
825835
"cell_type": "code",
826-
"execution_count": 22,
836+
"execution_count": 24,
827837
"id": "75728aa4-5b2e-46b6-9511-1250bf4b13ae",
828838
"metadata": {
829839
"tags": []
@@ -833,6 +843,7 @@
833843
"pair_Al_Ca = pairwise_logratio(df, \"Al_ppm_511\", \"Ca_ppm_511\")\n",
834844
"pair_Fe_Mg = pairwise_logratio(df, \"Fe_ppm_511\", \"Mg_ppm_511\")\n",
835845
"pair_Mg_Al = pairwise_logratio(df, \"Mg_ppm_511\", \"Al_ppm_511\")\n",
846+
"pair_Mg_res = pairwise_logratio(df, \"Mg_ppm_511\", \"residual\")\n",
836847
"\n",
837848
"df_alr = alr_transform(df)\n",
838849
"df_alr_Mg = alr_transform(df, \"Mg_ppm_511\")\n",
@@ -848,7 +859,7 @@
848859
},
849860
{
850861
"cell_type": "code",
851-
"execution_count": 23,
862+
"execution_count": 25,
852863
"id": "e136d05d-671d-420f-95b9-5f350bc7a94c",
853864
"metadata": {
854865
"tags": []
@@ -865,7 +876,7 @@
865876
"dtype: float64"
866877
]
867878
},
868-
"execution_count": 23,
879+
"execution_count": 25,
869880
"metadata": {},
870881
"output_type": "execute_result"
871882
}
@@ -876,7 +887,7 @@
876887
},
877888
{
878889
"cell_type": "code",
879-
"execution_count": 24,
890+
"execution_count": 26,
880891
"id": "ad352680-433a-4026-b7b5-560b682dfb96",
881892
"metadata": {
882893
"tags": []
@@ -906,6 +917,7 @@
906917
" <th>V1</th>\n",
907918
" <th>V2</th>\n",
908919
" <th>V3</th>\n",
920+
" <th>V4</th>\n",
909921
" </tr>\n",
910922
" </thead>\n",
911923
" <tbody>\n",
@@ -914,52 +926,65 @@
914926
" <td>0.472906</td>\n",
915927
" <td>0.848958</td>\n",
916928
" <td>1.576338</td>\n",
929+
" <td>3.878683</td>\n",
917930
" </tr>\n",
918931
" <tr>\n",
919932
" <th>1</th>\n",
920933
" <td>0.628609</td>\n",
921934
" <td>-0.408128</td>\n",
922935
" <td>1.325296</td>\n",
936+
" <td>4.833703</td>\n",
923937
" </tr>\n",
924938
" <tr>\n",
925939
" <th>2</th>\n",
926940
" <td>0.551401</td>\n",
927941
" <td>-0.391249</td>\n",
928942
" <td>1.161222</td>\n",
943+
" <td>5.364379</td>\n",
929944
" </tr>\n",
930945
" <tr>\n",
931946
" <th>3</th>\n",
932947
" <td>0.812301</td>\n",
933948
" <td>0.015314</td>\n",
934949
" <td>1.505448</td>\n",
950+
" <td>5.703340</td>\n",
935951
" </tr>\n",
936952
" <tr>\n",
937953
" <th>4</th>\n",
938954
" <td>0.443790</td>\n",
939955
" <td>-0.801005</td>\n",
940956
" <td>1.368049</td>\n",
957+
" <td>4.768590</td>\n",
941958
" </tr>\n",
942959
" </tbody>\n",
943960
"</table>\n",
944961
"</div>"
945962
],
946963
"text/plain": [
947-
" V1 V2 V3\n",
948-
"0 0.472906 0.848958 1.576338\n",
949-
"1 0.628609 -0.408128 1.325296\n",
950-
"2 0.551401 -0.391249 1.161222\n",
951-
"3 0.812301 0.015314 1.505448\n",
952-
"4 0.443790 -0.801005 1.368049"
964+
" V1 V2 V3 V4\n",
965+
"0 0.472906 0.848958 1.576338 3.878683\n",
966+
"1 0.628609 -0.408128 1.325296 4.833703\n",
967+
"2 0.551401 -0.391249 1.161222 5.364379\n",
968+
"3 0.812301 0.015314 1.505448 5.703340\n",
969+
"4 0.443790 -0.801005 1.368049 4.768590"
953970
]
954971
},
955-
"execution_count": 24,
972+
"execution_count": 26,
956973
"metadata": {},
957974
"output_type": "execute_result"
958975
}
959976
],
960977
"source": [
961978
"df_alr_Mg.head()"
962979
]
980+
},
981+
{
982+
"cell_type": "code",
983+
"execution_count": null,
984+
"id": "8b6a1929-51ef-4b7a-8621-f46bbe337e31",
985+
"metadata": {},
986+
"outputs": [],
987+
"source": []
963988
}
964989
],
965990
"metadata": {

0 commit comments

Comments
 (0)