Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 25 additions & 26 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ name: tests

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]

env:
MAIN_PYTHON_VERSION: "3.13"
MAIN_PYTHON_VERSION: "3.14"

jobs:
# Build and test
Expand All @@ -16,30 +16,29 @@ jobs:
strategy:
matrix:
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"
steps:
- uses: actions/checkout@v4
- name: Install uv and set the python version
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install the project
run: uv sync --all-extras --dev
- name: Run tests
run: uv run pytest
- name: Run Lint on one python
if: ${{ matrix.python-version == env.MAIN_PYTHON_VERSION }}
run: uv run ruff check
- name: Run Pytest with coverage
if: ${{ matrix.python-version == env.MAIN_PYTHON_VERSION }}
run: |
uv run pytest --cov=pgdtools --cov-report xml
- name: Upload coverage reports to Codecov
if: ${{ matrix.python-version == env.MAIN_PYTHON_VERSION && github.repository_owner == 'NASA-Planetary-Science' }}
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- uses: actions/checkout@v4
- name: Install uv and set the python version
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install the project
run: uv sync --all-extras --dev
- name: Run tests
run: uv run pytest
- name: Run Lint on one python
if: ${{ matrix.python-version == env.MAIN_PYTHON_VERSION }}
run: uv run ruff check
- name: Run Pytest with coverage
if: ${{ matrix.python-version == env.MAIN_PYTHON_VERSION }}
run: |
uv run pytest --cov=pgdtools --cov-report xml
- name: Upload coverage reports to Codecov
if: ${{ matrix.python-version == env.MAIN_PYTHON_VERSION && github.repository_owner == 'NASA-Planetary-Science' }}
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.13
3.14
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@
[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/NASA-Planetary-Science/pgdtools/blob/main/LICENSE)
[![tests](https://github.com/NASA-Planetary-Science/pgdtools/actions/workflows/tests.yml/badge.svg)](https://github.com/NASA-Planetary-Science/pgdtools/actions/workflows/tests.yml)
[![codecov](https://codecov.io/gh/NASA-Planetary-Science/pgdtools/branch/main/graph/badge.svg?token=N0NNVEI8CX)](https://codecov.io/gh/NASA-Planetary-Science/pgdtools)
[![Rye](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/rye/main/artwork/badge.json)](https://rye.astral.sh)
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](code_of_conduct.md)

# Presolar grain database tools (pgdTools)


This package provides a set of tools to
easily access and interface with the presolar grain database.
This package allows users to manage which database(s) they want to use
Expand Down
1 change: 1 addition & 0 deletions docs/api/pgdtools.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ You can either load this class either by importing and defining it:

```python
from pgdtools import PresolarGrains

pgd = PresolarGrains()
```

Expand Down
48 changes: 20 additions & 28 deletions docs/examples/sic_mo_stephan.ipynb

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion docs/maintainer/db_addition.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ from pathlib import Path

import pgdtools.maintainer as mt

excel_file = Path("PGD_SiC_2023-07-22.xlsx", quiet=True) # assuming the file is in the current directory
excel_file = Path(
"PGD_SiC_2023-07-22.xlsx", quiet=True
) # assuming the file is in the current directory
mt.append_reference_json(excel_file)
```

Expand Down
3 changes: 3 additions & 0 deletions docs/users/db.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ Simply updating to the latest version of the database can be done using the foll

```python
from pgdtools import db

db.update()
```

Expand All @@ -76,6 +77,7 @@ To display the currently used database, use the following command:

```python
from pgdtools import db

db.current()
```

Expand Down Expand Up @@ -106,6 +108,7 @@ To set the current database use the following command:

```python
from pgdtools import db

doi = "10.5281/zenodo.8187446"
db.set_current("sic", "DOI", doi)
```
Expand Down
1 change: 1 addition & 0 deletions docs/users/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Alternatively, you can run the following commands inside your python console:

```python
from pgdtools import db

db.update()
```

Expand Down
1 change: 1 addition & 0 deletions docs/users/pgd.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ There are two ways to get the full database:

```python
from pgdtools import PresolarGrains

pgd = PresolarGrains()
```

Expand Down
4 changes: 2 additions & 2 deletions examples/ruthenium_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
}
],
"source": [
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"from iniabu import (\n",
" inimf,\n",
") # iniabu module with abundances as mass fractions - for models!\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"import pgdtools\n",
"\n",
Expand Down
6 changes: 3 additions & 3 deletions examples/silicon_example.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""For Benoit: Compare some Si isotope ratios."""

from iniabu import inimf # import as mass_fraction values right away
import matplotlib.pyplot as plt
import numpy as np
from iniabu import inimf # import as mass_fraction values right away

import pgdtools

Expand Down Expand Up @@ -65,8 +65,8 @@
ax.set_ylim(ylim)

# labels for axes
ax.set_xlabel("$\delta^{30}$Si$_{28}$ (‰)")
ax.set_ylabel("$\delta^{29}$Si$_{28}$ (‰)")
ax.set_xlabel(r"$\delta^{30}$Si$_{28}$ (‰)")
ax.set_ylabel(r"$\delta^{29}$Si$_{28}$ (‰)")
ax.legend()

# aspect and layout
Expand Down
8 changes: 4 additions & 4 deletions examples/titanium_example.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""For Benoit: Compare some Ti isotope ratios."""

from iniabu import inimf # import as mass_fraction values right away
import matplotlib.pyplot as plt
import numpy as np
from iniabu import inimf # import as mass_fraction values right away

import pgdtools

Expand Down Expand Up @@ -79,14 +79,14 @@
a.set_ylim(ylim)

# labels for axes
a.set_xlabel("$\delta^{46}$Ti$_{48}$ (‰)")
a.set_xlabel(r"$\delta^{46}$Ti$_{48}$ (‰)")

# aspect and layout
a.set_aspect("equal")

# y label
ax[0].set_ylabel("$\delta^{47}$Ti$_{48}$ (‰)")
ax[1].set_ylabel("$\delta^{49}$Ti$_{48}$ (‰)")
ax[0].set_ylabel(r"$\delta^{47}$Ti$_{48}$ (‰)")
ax[1].set_ylabel(r"$\delta^{49}$Ti$_{48}$ (‰)")

fig.tight_layout()

Expand Down
54 changes: 27 additions & 27 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,33 @@ name = "pgdtools"
version = "0.2.0"
description = "Read and interact with the presolar grain database with python."
authors = [
{ name = "Reto Trappitsch", email = "reto@galactic-forensics.space" }
{ name = "Reto Trappitsch", email = "reto@galactic-forensics.space" },
]
dependencies = [
"iniabu>=1.1.2",
"matplotlib>=3.7.4",
"numpy>=1.26.4",
"scipy>=1.12.0",
"pandas>=2.2.0",
"requests>=2.31.0",
"iniabu>=1.1.2",
"matplotlib>=3.7.4",
"numpy>=1.26.4",
"scipy>=1.12.0",
"pandas>=2.2.0",
"requests>=2.31.0",
]
readme = "README.md"
requires-python = ">= 3.9"
requires-python = ">= 3.11"
license = { text = "MIT" }

[project.urls]
Source = "https://github.com/galactic-forensics/pgdtools"
Documentation = "https://pgdtools.readthedocs.io"

[project.optional-dependencies]
maintainer = [
"bibtexparser>=1.4.1",
"openpyxl>=3.1.2",
]
maintainer = ["bibtexparser>=1.4.1", "openpyxl>=3.1.2"]
docs = [
"mkdocs>=1.6.0",
"mkdocs-material>=9.5.25",
"mkdocs-jupyter>=0.24.8",
"notebook>=7.2.1",
"ceresfit>=0.3.1",
"mkdocstrings[python]>=0.25.1",
"mkdocs>=1.6.1",
"mkdocs-material>=9.7.7",
"mkdocs-jupyter>=0.26.3",
"notebook>=7.6.2",
"ceresfit>=0.3.1",
"mkdocstrings[python]>=0.26.3",
]

[build-system]
Expand All @@ -42,13 +39,13 @@ build-backend = "hatchling.build"
[tool.uv]
managed = true
dev-dependencies = [
"hypothesis>=6.98.2",
"pytest>=8.0.0",
"pytest-cov>=4.1.0",
"pytest-mock>=3.12.0",
"requests-mock>=1.11.0",
"ruff>=0.11.2",
"xdoctest>=1.1.5",
"hypothesis>=6.98.2",
"pytest>=8.0.0",
"pytest-cov>=4.1.0",
"pytest-mock>=3.12.0",
"requests-mock>=1.11.0",
"ruff>=0.16",
"xdoctest>=1.1.5",
]

[tool.hatch.metadata]
Expand All @@ -58,5 +55,8 @@ allow-direct-references = true
packages = ["src/pgdtools"]

[tool.pytest]
testpaths = "tests"
addopts = "--cov=pgdtools -v"
testpaths = ["tests"]
addopts = ["--cov=pgdtools", "-v"]

[tool.ruff.lint]
ignore = ["DTZ007"] # ignore timezone missing errors
2 changes: 1 addition & 1 deletion src/pgdtools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"classify_sic_grain",
"data",
"db",
"pgd",
"maintainer",
"pgd",
]
Loading
Loading