-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #113 from ArgonneCPAC/defaults_migration
Eliminate inconsistent usage of DEFAULT_MAH_PARAMS
- Loading branch information
Showing
12 changed files
with
182 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: linting | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: null | ||
|
||
jobs: | ||
tests: | ||
name: tests | ||
runs-on: "ubuntu-latest" | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: conda-incubator/setup-miniconda@v2 | ||
with: | ||
python-version: 3.9 | ||
channels: conda-forge,defaults | ||
channel-priority: strict | ||
show-channel-urls: true | ||
miniforge-version: latest | ||
miniforge-variant: Mambaforge | ||
|
||
- name: configure conda and install code | ||
# Test against latest releases of each code in the dependency chain | ||
shell: bash -l {0} | ||
run: | | ||
conda config --set always_yes yes | ||
mamba install --quiet \ | ||
--file=requirements.txt | ||
python -m pip install --no-deps -e . | ||
mamba install -y -q \ | ||
flake8 \ | ||
pytest \ | ||
pytest-xdist \ | ||
pytest-cov \ | ||
pip \ | ||
setuptools \ | ||
"setuptools_scm>=7,<8" \ | ||
python-build \ | ||
flake8-pyproject | ||
python -m pip install --no-build-isolation --no-deps -e . | ||
- name: lint | ||
shell: bash -l {0} | ||
run: | | ||
flake8 diffmah |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
""" | ||
""" | ||
import numpy as np | ||
|
||
|
||
def test_default_mah_params_imports_from_top_level_and_is_frozen(): | ||
from .. import DEFAULT_MAH_PARAMS | ||
|
||
assert np.allclose(DEFAULT_MAH_PARAMS, (12.0, 0.05, 2.6137643, 0.12692805)) | ||
|
||
|
||
def test_mah_k_imports_from_top_level(): | ||
from .. import MAH_K | ||
|
||
assert np.allclose(MAH_K, 3.5) | ||
|
||
|
||
def test_mah_halopop_imports_from_top_level(): | ||
from .. import DEFAULT_MAH_PARAMS, DiffmahParams, mah_halopop | ||
|
||
tarr = np.linspace(0.1, 13.7, 100) | ||
ngals = 150 | ||
zz = np.zeros(ngals) | ||
mah_params_halopop = DiffmahParams(*[x + zz for x in DEFAULT_MAH_PARAMS]) | ||
dmhdt, log_mah = mah_halopop(mah_params_halopop, tarr) | ||
assert log_mah.shape == dmhdt.shape |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.