Skip to content

Commit

Permalink
Merge branch 'master' into angular-lightcone
Browse files Browse the repository at this point in the history
  • Loading branch information
steven-murray authored Dec 19, 2023
2 parents c6dd18c + f4d65fe commit f3acded
Show file tree
Hide file tree
Showing 24 changed files with 39 additions and 28 deletions.
30 changes: 18 additions & 12 deletions .github/workflows/test_suite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,13 @@ jobs:
steps:
- uses: actions/checkout@master
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0

- name: Print head git commit message
id: get_head_commit_message
run: echo "commit_message=$(git show -s --format=%s)" >> "$GITHUB_ENV"

- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v2.1.1
with:
Expand All @@ -55,22 +61,14 @@ jobs:
conda config --show
printenv | sort
- name: Logging
run: |
echo ${{ github.event.commits }}
echo ${{ github.event.commits[0] }}
- name: Make it a Debug Run
if: "contains(github.event.payload.commits[0].message, 'ci debug')"
if: "contains(env.commit_message, 'ci debug')"
run: |
echo "log_level=ULTRA_DEBUG" >> $GITHUB_ENV
echo "extra_pytest_args='-s -k test_perturb_field_data --log-level-21=DEBUG'" >> $GITHUB_ENV
- name: 'Log Commit Message'
run: echo ${{ github.event.commits[0].message }}
echo "extra_pytest_args=-s -k "test_power_spectra_lightcone[mdz_tsfluct_nthreads]" --log-level-21=DEBUG" >> $GITHUB_ENV
- name: Make it a Normal Run
if: "!contains(github.event.commits[0].message, 'ci debug')"
if: "!contains(env.commit_message, 'ci debug')"
run: |
echo "log_level=INFO" >> $GITHUB_ENV
echo "extra_pytest_args=" >> $GITHUB_ENV
Expand All @@ -93,7 +91,15 @@ jobs:
- name: Run Tests
run: |
python -m pytest -n 2 -l --cov=py21cmfast --cov-config=.coveragerc -vv --cov-report xml:./coverage.xml --durations=25 ${{ env.extra_pytest_args }}
python -m pytest -n 2 -l ${{ env.extra_pytest_args }} --cov=py21cmfast --cov-config=.coveragerc -vv --cov-report xml:./coverage.xml --durations=25 --plots=testplots
- name: Archive Integration Test Plots
if: always() && contains(env.commit_message, 'ci debug')
uses: actions/upload-artifact@v3
with:
name: integration-test-plots-${{ matrix.os }}-${{ matrix.python-version }}
path: |
testplots/*.pdf
- uses: codecov/codecov-action@v3
if: matrix.os == 'ubuntu-latest' && success() && !contains(github.event.pull_request.labels.*.name, 'auto-pr')
Expand Down
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ exclude: '(^docs/conf.py|^src/py21cmfast/_data/|changethelog.py)'

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: check-added-large-files
Expand All @@ -17,7 +17,7 @@ repos:
- id: mixed-line-ending
args: ['--fix=no']
- repo: https://github.com/pycqa/flake8
rev: 6.0.0 # pick a git hash / tag to point to
rev: 6.1.0 # pick a git hash / tag to point to
hooks:
- id: flake8
additional_dependencies:
Expand All @@ -33,13 +33,13 @@ repos:
# - flake8-copyright # no support flor flake8 v6
- flake8-print

- repo: https://github.com/psf/black
rev: 23.3.0
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.12.0
hooks:
- id: black

- repo: https://github.com/PyCQA/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort

Expand All @@ -51,7 +51,7 @@ repos:
- id: rst-inline-touching-normal

- repo: https://github.com/asottile/pyupgrade
rev: v3.7.0
rev: v3.15.0
hooks:
- id: pyupgrade
args: [--py36-plus]
6 changes: 4 additions & 2 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ version: 2
sphinx:
configuration: docs/conf.py

# Optionally build your docs in additional formats such as PDF and ePub
formats: all
build:
os: ubuntu-22.04
tools:
python: mambaforge-22.9

conda:
environment: docs/environment.yaml
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ Changelog
dev-version
-----------

Fixed
~~~~~

* Incorrect sign on adiabatic fluctuations.

v3.3.1 [24 May 2023]
----------------------

Expand Down
3 changes: 2 additions & 1 deletion docs/environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ channels:
dependencies:
- pip
- ipython
- nbsphinx
- numpydoc
- sphinx>=1.3
- astropy # need this here, because we base classes off it (and docs need that).
Expand All @@ -17,3 +16,5 @@ dependencies:
- setuptools_scm
- bidict
- cosmotile
- nbsphinx
- nbconvert>=6.4.5
4 changes: 0 additions & 4 deletions src/py21cmfast/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -687,10 +687,6 @@ def _implementations(cls):

def _init_arrays(self):
for k, state in self._array_state.items():
if k == "lowres_density":
logger.debug("THINKING ABOUT INITING LOWRES_DENSITY")
logger.debug(state.initialized, state.computed_in_mem, state.on_disk)

# Don't initialize C-based pointers or already-inited stuff, or stuff
# that's computed on disk (if it's on disk, accessing the array should
# just give the computed version, which is what we would want, not a
Expand Down
2 changes: 1 addition & 1 deletion src/py21cmfast/src/SpinTemperatureBox.c
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ LOG_SUPER_DEBUG("Initialised heat");
growthfac = growth_factor_zp * inverse_growth_factor_z;
// read file
#pragma omp parallel shared(this_spin_temp,xe,TK,redshift,perturbed_field, \
inverse_growth_factor_z,growth_factor_zp,cT_ad) \
growthfac,cT_ad) \
private(i,j,k,ct,curr_xalpha,gdens) \
num_threads(user_params->N_THREADS)
{
Expand Down
2 changes: 1 addition & 1 deletion src/py21cmfast/src/heating_helper_progs.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ double xion_RECFAST(float z, int flag)
float cT_approx(float z)
{
if (global_params.USE_ADIABATIC_FLUCTUATIONS)
return 0.58 + 0.006*(z - 10.0);
return 0.58 - 0.006*(z - 10.0);
else
return 0.0;
}
Expand Down
Binary file modified tests/test_data/halo_field_data_halo_field.h5
Binary file not shown.
Binary file modified tests/test_data/perturb_field_data_highres.h5
Binary file not shown.
Binary file modified tests/test_data/perturb_field_data_linear.h5
Binary file not shown.
Binary file modified tests/test_data/perturb_field_data_no2lpt.h5
Binary file not shown.
Binary file modified tests/test_data/perturb_field_data_simple.h5
Binary file not shown.
Binary file modified tests/test_data/power_spectra_halo_field_mdz.h5
Binary file not shown.
Binary file modified tests/test_data/power_spectra_mdz_and_ts_fluct.h5
Binary file not shown.
Binary file modified tests/test_data/power_spectra_mdz_and_tsfluct_nthreads.h5
Binary file not shown.
Binary file modified tests/test_data/power_spectra_mdz_tsfluct_nthreads.h5
Binary file not shown.
Binary file modified tests/test_data/power_spectra_mini_halos.h5
Binary file not shown.
Binary file modified tests/test_data/power_spectra_minihalos_no_tables.h5
Binary file not shown.
Binary file modified tests/test_data/power_spectra_minimize_mem.h5
Binary file not shown.
Binary file modified tests/test_data/power_spectra_relvel.h5
Binary file not shown.
Binary file modified tests/test_data/power_spectra_ts_fluct_no_tables.h5
Binary file not shown.
Binary file modified tests/test_data/power_spectra_tsfluct.h5
Binary file not shown.
3 changes: 2 additions & 1 deletion tests/test_integration_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ def test_power_spectra_lightcone(name, module_direc, plt):
# Ensure all but 10 of the values is within 1%, and none of the values
# is outside 10%
assert np.all(np.abs(value - test_powers[key]) / value[0] < 1e-3)

assert np.sum(~np.isclose(value, test_powers[key], atol=0, rtol=5e-2)) < 10

for key, value in true_global.items():
print(f"Testing Global {key}")
assert np.allclose(value, getattr(lc, key), atol=0, rtol=1e-3)
Expand Down

0 comments on commit f3acded

Please sign in to comment.