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
15 changes: 6 additions & 9 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ jobs:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
python-version: "3.10"
- os: ubuntu-latest
python-version: "3.11"
- os: ubuntu-latest
Expand Down Expand Up @@ -62,9 +60,9 @@ jobs:
pip install git+https://github.com/halomod/halomod.git@main
pip install -e .[dev]

# Coverage only on Ubuntu + Python 3.11
# Coverage only on Ubuntu + Python 3.12
- name: Run Tests (with coverage)
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
run: |
python -m pytest \
--cov=onepower \
Expand All @@ -76,26 +74,25 @@ jobs:

# Other matrix combos run without coverage
- name: Run Tests (without coverage)
if: matrix.os != 'ubuntu-latest' || matrix.python-version != '3.11'
if: matrix.os != 'ubuntu-latest' || matrix.python-version != '3.12'
run: |
python -m pytest --durations=25

- name: Generate coverage badge
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11' && success() && github.event_name == 'push'
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12' && success() && github.event_name == 'push'
run : |
pip install genbadge[coverage]
genbadge coverage -i "cov.xml" -o "coverage.svg"
#uses: tj-actions/coverage-badge-py@v2

- name: Verify Changed files
if : matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11' && success() && github.event_name == 'push'
if : matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12' && success() && github.event_name == 'push'
id: verify
uses: tj-actions/verify-changed-files@v20
with:
files: coverage.svg

- name: Commit and push badge
if: steps.verify.outputs.files_changed == 'true' && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11' && success() && github.event_name == 'push'
if: steps.verify.outputs.files_changed == 'true' && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12' && success() && github.event_name == 'push'
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ dev-version

* Performance improvements in Bnl non-linear corrections.
* Added more defaults in CosmosSIS interface, so the Pmm case can be run without any HOD parameters needed.
* Deprecated Python 3.10, planning to drop support for 3.11 when ``hmf/halomod`` does the same.

**Fixes**

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ OnePower is ideal for:

💾 [Install via PyPI](https://pypi.org/project/onepower/)

🖥️ [Use a web app](https://onepower.dvrnk.si)


## Example usage

Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@ authors = [
license = "MIT"
license-files = ["LICEN[CS]E*"]

requires-python = ">=3.10, <3.13"
requires-python = ">=3.11, <3.13"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Science/Research",
"Operating System :: POSIX",
"Operating System :: Unix",
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
Expand Down
4 changes: 4 additions & 0 deletions src/onepower/hod.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ def dndlnm_int(self):
array_like
interpolated halo mass function at self.z
"""
if np.array_equal(self.z, self.z_vec):
return self.dndlnm
dndlnm_fnc = interp1d(
self.z_vec,
self.dndlnm,
Expand All @@ -144,6 +146,8 @@ def halo_bias_int(self):
array_like
interpolated halo bias function at self.z
"""
if np.array_equal(self.z, self.z_vec):
return self.halo_bias
halo_bias_fnc = interp1d(
self.z_vec,
self.halo_bias,
Expand Down
12 changes: 6 additions & 6 deletions src/onepower/pk.py
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,7 @@ def two_halo_truncation_ia(self):
return np.ones_like(self.k_vec)
return np.exp(-((self.k_vec / self.two_halo_ktrunc_ia) ** 2.0))

def one_halo_truncation_mead(self, sigma8_in):
def one_halo_truncation_mead2020(self, sigma8_in):
"""
1-halo term truncation in Mead et al. 2021, eq 17 and table 2.

Expand All @@ -962,7 +962,7 @@ def one_halo_truncation_mead(self, sigma8_in):
k_frac = self.k_vec[np.newaxis, np.newaxis, :] / k_star
return (k_frac**4.0) / (1.0 + k_frac**4.0)

def two_halo_truncation_mead(self, sigma8_in):
def two_halo_truncation_mead2020(self, sigma8_in):
"""
2-halo term truncation in Mead et al. 2021, eq 16.

Expand Down Expand Up @@ -1588,15 +1588,15 @@ def _power_spectrum_mm(
pk_tot = pk_1h + pk_2h
elif self.nonlinear_mode == 'hmcode':
if self.hmcode_ingredients in ['mead2020_feedback', 'mead2020']:
pk_2h = self._pk_lin[np.newaxis, :, :] * self.two_halo_truncation_mead(
self.sigma8_z
)
pk_2h = self._pk_lin[
np.newaxis, :, :
] * self.two_halo_truncation_mead2020(self.sigma8_z)
pk_1h = self.compute_1h_term(
matter_profile_1h,
matter_profile_1h,
self.mass[np.newaxis, np.newaxis, np.newaxis, :],
self.dndlnm[np.newaxis, :, np.newaxis, :],
) * self.one_halo_truncation_mead(self.sigma8_z)
) * self.one_halo_truncation_mead2020(self.sigma8_z)
pk_tot = self.transition_smoothing(self.neff, pk_1h, pk_2h)
# elif here to include mead2016 etc if ever implemented ...
else:
Expand Down
Loading