Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Installation Easier #413

Merged
merged 22 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from 21 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
21 changes: 21 additions & 0 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Black

on: [push, pull_request]

jobs:
black:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install poetry
run: pipx install poetry
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install dependencies
run: |
poetry install --with dev
- name: Reformat the code with black
run: |
poetry run black . --check
12 changes: 3 additions & 9 deletions .github/workflows/continous_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,7 @@ name: CI
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:

pull_request:

# run the pipeline on the 0th minute of the 0th hour of day 1 and 15 every month
schedule:
- cron: '0 0 1,15 * *'

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

Expand All @@ -26,7 +20,7 @@ jobs:
# Specify the python versions to test
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11", "3.12"]

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
Expand Down Expand Up @@ -59,7 +53,7 @@ jobs:
run: |
python -m pip install --upgrade pip
python -m pip install poetry
python -m poetry install
python -m poetry install --with dev

# Runs a set of commands using the runners shell
- name: Test the code
Expand Down Expand Up @@ -108,5 +102,5 @@ jobs:
uses: coverallsapp/github-action@v2
with:
parallel-finished: true
carryforward: "python3.9,python3.10,python3.11"
carryforward: "python3.10,python3.11,python3.12"
github-token: ${{ secrets.GITHUB_TOKEN }}
9 changes: 1 addition & 8 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@ on:
pull_request:

jobs:
black:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: psf/black@stable
with:
version: '~=23.12'
mypy:
runs-on: ubuntu-latest
steps:
Expand All @@ -23,6 +16,6 @@ jobs:
- name: Install poetry
run: pip install poetry # You may need additional dependencies here
- name: Install flarestack
run: poetry install
run: poetry install --with dev
- name: Run mypy
run: poetry run mypy # Replace 'your_code_directory' with your actual code directory
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ This will install all packages as documented in the `poetry.lock` file.
If you want to also build the documentation locally, you should install the respective dependencies:

```shell
poetry install --with docs
poetry install --with dev
```

You can still use `pip` if you want to:

```shell
pip install -e flarestack/
pip install -e ".[dev]"
```

Either way will give you the very latest copy of the code, update the installed version if you git pull or modify scripts
Expand Down
2 changes: 1 addition & 1 deletion conda_env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ channels:
- conda-forge
- defaults
dependencies:
- photospline=2.1.0
- photospline=2.3.1
24 changes: 18 additions & 6 deletions flarestack/core/spatial_pdf.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
import numpy as np
import healpy as hp
import os
import logging
import os
from typing import Optional
from scipy.stats import norm
from scipy.interpolate import interp1d

import healpy as hp
import numpy as np
from numpy.lib.recfunctions import append_fields
from scipy.interpolate import interp1d
from scipy.stats import norm

from flarestack.core.astro import angular_distance
from flarestack.shared import bkg_spline_path
from flarestack.utils.make_SoB_splines import load_bkg_spatial_spline
from photospline import SplineTable

try:
from photospline import SplineTable
except ImportError:
SplineTable = None

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -229,6 +235,12 @@ def __init__(self, spatial_pdf_dict):
)
KDEfile = spatial_pdf_dict["spatial_pdf_data"]

if SplineTable is None:
logger.error("Photospline is not installed, cannot use KDE spatial PDF")
raise ImportError(
"Photospline is not installed, cannot use KDE spatial PDF"
)

NorthernTracksKDE.KDEspline = SplineTable(KDEfile)
if NorthernTracksKDE.KDEspline.ndim == 3:
NorthernTracksKDE.SplineIs4D = False
Expand Down
2,841 changes: 1,579 additions & 1,262 deletions poetry.lock

Large diffs are not rendered by default.

20 changes: 8 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,38 +20,34 @@ classifiers = [
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]

[tool.poetry.dependencies]
python = ">=3.9, <3.12"
python = ">=3.9, <4.0"
astropy = ">=5.1,<7.0"
black = ">=23,<25"
coveralls = ">=3.3.1,<5.0.0"
healpy = "^1.16.1"
jupyter = "^1.0.0"
matplotlib = "^3.5.2"
numexpr = "^2.8.3"
numpy = "^1.23.1"
scipy = "^1.9.0"
sphinx = "^5.1.1"
scipy = "^1.13.1"
urllib3 = "2.3.0"

[tool.poetry.dev-dependencies]

[tool.poetry.group.docs]
[tool.poetry.group.dev]
optional = true

[tool.poetry.group.docs.dependencies]
[tool.poetry.group.dev.dependencies]
black = "^23.12"
mypy = "^1.5.1"
Sphinx = "^5.1.1"
sphinx-rtd-theme = ">=1,<3"
myst-parser = "^0.18.0"
nbsphinx = ">=0.8.9,<0.10.0"
myst-nb = ">=0.16,<0.18"


[tool.poetry.group.dev.dependencies]
mypy = "^1.5.1"

[build-system]
requires = ["poetry-core>=1.2.0"]
build-backend = "poetry.core.masonry.api"
Loading