Skip to content

Commit

Permalink
Merge pull request #146 from joezuntz/numpy2
Browse files Browse the repository at this point in the history
Numpy v2
  • Loading branch information
joezuntz authored Nov 29, 2024
2 parents 2009224 + 80cdadd commit c311592
Show file tree
Hide file tree
Showing 276 changed files with 3,459 additions and 38,389 deletions.
17 changes: 11 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ jobs:
needs: Download_Data
strategy:
matrix:
python-version: [3.7, 3.8, 3.9, "3.10", "3.11", "3.12"]
python-version: [3.9, "3.10", "3.11", "3.12"]

steps:
- name: Checkout repository
Expand Down Expand Up @@ -236,9 +236,9 @@ jobs:
- name: Install python dependencies
run: |
python -m pip install --upgrade pip wheel setuptools
pip install "cosmosis==3.13" "nautilus-sampler==1.0.1" "scipy"
pip install cosmosis "nautilus-sampler==1.0.1" "scipy" "numpy>=2"
pip install -v --no-cache-dir --no-binary=mpi4py,camb mpi4py camb
pip install fitsio astropy fast-pt "Cython>=3.0" jupyter sacc "act_dr6_lenslike>=1.0.2" "git+https://github.com/carronj/planck_PR4_lensing"
pip install astropy fast-pt "Cython>=3.0" jupyter sacc "act_dr6_lenslike>=1.0.2" "git+https://github.com/carronj/planck_PR4_lensing"
- name: Install recent python dependencies
if: ${{ (matrix.python-version != '3.7') && (matrix.python-version != '3.8') }}
Expand Down Expand Up @@ -269,9 +269,14 @@ jobs:
grep -e "🟢 fiducial-test-only" output/campaign.log
cosmosis-campaign examples/des-campaign.yml --status
- name: ExampleNotebook
- name: Run Tests
shell: bash -l {0}
run: |
source cosmosis-configure
rm -f output/pantheon.txt
jupyter nbconvert --to notebook --execute "examples/example.ipynb"
pytest -vv --durations=0 tests/test_cosmosis_standard_library.py
- name: Run Demos
shell: bash -l {0}
run: |
source cosmosis-configure
pytest -vv --durations=0 tests/test_demos.py
5 changes: 4 additions & 1 deletion background/astropy_background/astropy_background.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ def execute(block, config):

# comoving radial
D_C = model.comoving_distance(z).to_value(astropy.units.Mpc)
Ok0 = model._Ok0
try:
Ok0 = model._Ok0
except AttributeError:
Ok0 = model.Ok0

# comoving transverse
if Ok0 == 0:
Expand Down
2 changes: 1 addition & 1 deletion boltzmann/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include ${COSMOSIS_SRC_DIR}/config/compilers.mk
include ${COSMOSIS_SRC_DIR}/config/subdirs.mk

SUBDIRS = isitgr mgcamb sigma_cpp class/class_v3.2.0
SUBDIRS = isitgr mgcamb sigma_cpp class/class_v3.2.5
14 changes: 8 additions & 6 deletions boltzmann/class/class_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@


def setup(options):
class_version = options.get_string(option_section, "version", "3.2.0")
class_version = options.get_string(option_section, "version", "3.2.5")
install_dir = dirname + f"/class_v{class_version}/classy_install/"
sys.path.insert(0, install_dir)

Expand All @@ -33,7 +33,7 @@ def setup(options):
config = {
'lmax': options.get_int(option_section, 'lmax', default=2000),
'zmax': options.get_double(option_section, 'zmax', default=3.0),
'kmax': options.get_double(option_section, 'kmax', default=50.0),
'kmax': options.get_double(option_section, 'kmax', default=10.0),
'nk': options.get_int(option_section, 'nk', default=100),
'debug': options.get_bool(option_section, 'debug', default=False),
'lensing': options.get_bool(option_section, 'lensing', default=True),
Expand All @@ -58,12 +58,13 @@ def setup(options):
def choose_outputs(config):
outputs = []
if config['cmb']:
outputs.append("tCl pCl")
outputs.append("tCl")
outputs.append("pCl")
if config['lensing']:
outputs.append("lCl")
if config["mpk"]:
outputs.append("mPk")
return " ".join(outputs)
return ",".join(outputs)

def get_class_inputs(block, config):

Expand All @@ -76,13 +77,14 @@ def get_class_inputs(block, config):
'lensing': 'yes' if config['lensing'] else 'no',
'A_s': block[cosmo, 'A_s'],
'n_s': block[cosmo, 'n_s'],
'H0': 100 * block[cosmo, 'h0'],
'h': block[cosmo, 'h0'],
'omega_b': block[cosmo, 'ombh2'],
'omega_cdm': block[cosmo, 'omch2'],
'tau_reio': block[cosmo, 'tau'],
'T_cmb': block.get_double(cosmo, 'TCMB', default=2.726),
'N_ur': nnu - nmassive,
'N_ncdm': nmassive,
'l_switch_limber': 9,
}


Expand All @@ -106,7 +108,7 @@ def get_class_inputs(block, config):
if config["mpk"]:
params.update({
'P_k_max_h/Mpc': config["kmax"],
'z_pk': ', '.join(str(z) for z in np.arange(0.0, config['zmax'], 0.01)),
# 'z_pk': ', '.join(str(z) for z in np.arange(0.0, config['zmax'], 0.01)),
'z_max_pk': config['zmax'],
})

Expand Down
12 changes: 0 additions & 12 deletions boltzmann/class/class_v3.2.0/doc/README

This file was deleted.

138 changes: 0 additions & 138 deletions boltzmann/class/class_v3.2.0/doc/input/chap2.md

This file was deleted.

Loading

0 comments on commit c311592

Please sign in to comment.