primacore 0.1.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Jordan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,13 @@
1
+ Metadata-Version: 2.4
2
+ Name: primacore
3
+ Version: 0.1.4
4
+ Author-email: Jordi Sassoon <jordisassoon@gmail.com>
5
+ Requires-Python: >=3.10
6
+ License-File: LICENSE
7
+ Requires-Dist: numpy
8
+ Requires-Dist: pandas
9
+ Requires-Dist: uvicorn
10
+ Requires-Dist: scikit-learn
11
+ Requires-Dist: tqdm
12
+ Requires-Dist: lightgbm
13
+ Dynamic: license-file
@@ -0,0 +1,119 @@
1
+ # 🌿 PRIMA: A tool for Palaeoclimatic Reconstruction through Interactive Modelling & Analysis
2
+
3
+ PRIAM is an interactive tool for proxy-based climate reconstruction and analysis. It allows users to import palaeoecological proxy dataβ€”such as fossil pollen, sediments, or other biological indicatorsβ€”and apply multiple statistical and machine learning methods to reconstruct past climate conditions. The app provides instant model training, validation, and visualization, offering insights into model performance, feature importance, and uncertainty. Users can explore reconstructed climate variables through dynamic plots, comparative analyses, and summary statistics, making it a comprehensive platform for both research and teaching in palaeoclimatology.
4
+
5
+ This project implements multiple methods for quantitative palaeoclimate reconstruction from fossil pollen data, including:
6
+
7
+ * **Modern Analogue Technique (MAT)**
8
+ * **Boosted Regression Trees (BRT)**
9
+ * **Weighted Averaging Partial Least Squares (WA-PLS)**
10
+ * **Random Forest (RF)**
11
+
12
+ It also provides a **web-based interface** using [Streamlit](https://streamlit.io).
13
+
14
+ ## πŸ“¦ Installation
15
+
16
+ ### 1. Clone this repository
17
+
18
+ ```bash
19
+ git clone https://github.com/yourusername/PyLae.git
20
+ cd pollen-recon
21
+ ```
22
+
23
+ ### 2. Create and activate a conda environment
24
+
25
+ ```bash
26
+ conda env create -f environment.yml
27
+ conda activate pylaeo
28
+ ```
29
+
30
+ ## βš™οΈ Command-Line Usage
31
+
32
+ The main pipeline is in `main.py`.
33
+ It trains models on **training climate + pollen data** and predicts for **fossil pollen samples**.
34
+
35
+ ### Example
36
+
37
+ ```bash
38
+ python main.py \
39
+ --train_climate ./data/train/AMPD_cl_worldclim2.csv \
40
+ --train_pollen ./data/train/AMPD_po.csv \
41
+ --test_pollen ./data/test/scrubbed_SAR.csv \
42
+ --model RF \
43
+ --target TANN \
44
+ --output_csv ./out/predictions.csv
45
+ ```
46
+
47
+ Arguments:
48
+
49
+ * `--train_climate`: CSV with climate variables (targets).
50
+ * `--train_pollen`: CSV with modern pollen counts.
51
+ * `--test_pollen`: CSV with fossil pollen data.
52
+ * `--model`: Model choice (`MAT`, `BRT`, `WA-PLS`, `RF`).
53
+ * `--target`: Target variable to reconstruct (e.g., `TANN`).
54
+ * `--output_csv`: Where to save predictions.
55
+
56
+ ## πŸ“Š Visualization
57
+
58
+ Once predictions are saved, you can plot them with:
59
+
60
+ ```bash
61
+ python visuals/plot.py \
62
+ --predictions_csv ./out/predictions.csv \
63
+ --output_file ./out/predictions.png \
64
+ --title "Reconstructed TANN"
65
+ ```
66
+
67
+ ## 🌐 Streamlit Web App
68
+
69
+ For an interactive interface:
70
+
71
+ ```bash
72
+ streamlit run app.py
73
+ ```
74
+
75
+ This will launch a web UI at [http://localhost:8501](http://localhost:8501).
76
+
77
+ Features:
78
+
79
+ * Upload training and fossil pollen CSVs.
80
+ * Choose model + target variable.
81
+ * Run predictions interactively.
82
+ * View results as a table and time-series plot.
83
+ * Download predictions as CSV.
84
+
85
+ ## πŸ“‚ Project Structure
86
+
87
+ ```
88
+ β”œβ”€β”€ app.py # Streamlit web app
89
+ β”œβ”€β”€ main.py # CLI pipeline
90
+ β”œβ”€β”€ models/ # Model classes (MAT, BRT, WA-PLS, RF)
91
+ β”œβ”€β”€ utils/dataloader.py # Data loading + preprocessing
92
+ β”œβ”€β”€ visuals/plot.py # Visualization script
93
+ β”œβ”€β”€ data/ # Example datasets
94
+ β”œβ”€β”€ out/ # Output predictions + plots
95
+ β”œβ”€β”€ requirements.txt # Dependencies
96
+ └── README.md # This file
97
+ ```
98
+
99
+ ## πŸ§‘β€πŸ’» Development Notes
100
+
101
+ * Datasets are aligned automatically (non-overlapping taxa filled with zeros).
102
+ * Predictions are saved with column name `Predicted_<target>`.
103
+ * Tested on Linux (Python 3.10).
104
+
105
+ ## πŸ‘©β€πŸ”¬ Authors
106
+
107
+ Dael Sassoon
108
+ β€” Palaeoecologist and Marie Curie Research Fellow (GEO3BCN-CSIC, Barcelona).
109
+ Specialising in tropical palaeoecology and quantitative reconstruction of past climates. Developer of PRIAM, integrating palaeoecological data with statistical and machine learning models for climate reconstruction.
110
+
111
+ Jordan Sassoon
112
+ β€” Computer Scientist.
113
+ Focused on applied AI, data systems, and scientific visualization. Lead developer of the PRIAM interface, integrating backend modelling pipelines with an interactive analytical framework.
114
+
115
+ ## 🧠 Citation
116
+
117
+ If you use PRIAM in your research, please cite as:
118
+
119
+ Sassoon, D., & Sassoon, J. (2025). PRIAM: A tool for Palaeoclimatic Reconstruction through Interactive Analysis & Modelling. GitHub repository: https://github.com/jordisassoon/PRIAM
@@ -0,0 +1,13 @@
1
+ Metadata-Version: 2.4
2
+ Name: primacore
3
+ Version: 0.1.4
4
+ Author-email: Jordi Sassoon <jordisassoon@gmail.com>
5
+ Requires-Python: >=3.10
6
+ License-File: LICENSE
7
+ Requires-Dist: numpy
8
+ Requires-Dist: pandas
9
+ Requires-Dist: uvicorn
10
+ Requires-Dist: scikit-learn
11
+ Requires-Dist: tqdm
12
+ Requires-Dist: lightgbm
13
+ Dynamic: license-file
@@ -0,0 +1,9 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ primacore.egg-info/PKG-INFO
5
+ primacore.egg-info/SOURCES.txt
6
+ primacore.egg-info/dependency_links.txt
7
+ primacore.egg-info/requires.txt
8
+ primacore.egg-info/top_level.txt
9
+ primapy/__init__.py
@@ -0,0 +1,6 @@
1
+ numpy
2
+ pandas
3
+ uvicorn
4
+ scikit-learn
5
+ tqdm
6
+ lightgbm
@@ -0,0 +1 @@
1
+ primapy
File without changes
@@ -0,0 +1,36 @@
1
+ [project]
2
+ name = "primacore"
3
+ version = "0.1.4"
4
+ authors = [{ name = "Jordi Sassoon", email = "jordisassoon@gmail.com" }]
5
+ requires-python = ">=3.10"
6
+ dependencies = [
7
+ "numpy",
8
+ "pandas",
9
+ "uvicorn",
10
+ "scikit-learn",
11
+ "tqdm",
12
+ "lightgbm",
13
+ ]
14
+
15
+ [dependency-groups]
16
+ dev = [
17
+ "mypy>=1.18.2",
18
+ "pytest>=8.4.2",
19
+ "pytest-timeout>=2.4.0",
20
+ "pytest-vcr>=1.0.2",
21
+ "python-dotenv>=1.2.1",
22
+ "ruff>=0.14.3",
23
+ "shellcheck-py>=0.11.0.1",
24
+ "ty>=0.0.14",
25
+ "types-requests>=2.32.4.20260107",
26
+ ]
27
+
28
+ [build-system]
29
+ requires = ["setuptools"]
30
+ build-backend = "setuptools.build_meta"
31
+
32
+ [tool.setuptools.packages.find]
33
+ include = ["primapy"]
34
+
35
+ [tool.uv]
36
+ package = true
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+