Skip to content

Commit

Permalink
Merge pull request #88 from joezuntz/interactive-use to make CosmoSIS…
Browse files Browse the repository at this point in the history
… 3.0

- Allow more configuration of the `run_cosmosis` and `run_postprocess` functions, for use from Jupyter or other interactive notebooks.
- Add the `cosmosis-campaign` tool to manage suites of related runs.
- Allow output in `astropy` table format in interactive mode.
- Extensive changes to logging - we now exclusively use cosmosis.logs for anything that is printed during main sampling
- - The `quiet` option is deprecated in favour of more fine-grained logging control.
- Tidy up the output in general
- Update the setup script to avoid the deprecated distutils.
- Deal with various deprecation warnings
- Modify the format of the tables output by the "statistics" postprocessor so they can be read in astropy.
- Fix corner plots so you can put multiple chains on the same axes.
- Allow using MPI pools with general communicator objects - should make it possible to run under MPI in jupyter eventually.
  • Loading branch information
joezuntz authored Jul 27, 2023
2 parents 02f28c0 + 861ba7d commit d2ea4cb
Show file tree
Hide file tree
Showing 70 changed files with 1,891 additions and 1,004 deletions.
24 changes: 14 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,28 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.6, 3.7, 3.8, 3.9, "3.10", 3.11]
python-version: [3.7, 3.8, 3.9, "3.10", 3.11]
os: [ubuntu-20.04, macos-latest]
include:
- os: ubuntu-20.04
INSTALL_DEPS: sudo apt-get update && sudo apt-get -y install gfortran-7 swig libopenmpi-dev openmpi-bin libopenblas-dev && sudo ln -s `which gfortran-7` /usr/local/bin/gfortran
- os: macos-latest
INSTALL_DEPS: brew update && HOMEBREW_NO_AUTO_UPDATE=1 SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL=1 HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install gcc swig libomp open-mpi openblas && if [ ! -f /usr/local/bin/gfortran ]; then ln -s /usr/local/bin/gfortran-$(brew list --versions gcc | awk '{print $2}' | cut -d. -f1) /usr/local/bin/gfortran; fi
INSTALL_DEPS: brew update-reset && HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install gcc swig libomp open-mpi openblas && if [ ! -f /usr/local/bin/gfortran ]; then ln -s /usr/local/bin/gfortran-$(brew list --versions gcc | awk '{print $2}' | cut -d. -f1) /usr/local/bin/gfortran; fi
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
submodules: true

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: ${{ matrix.INSTALL_DEPS }}

- uses: actions/cache@v2
- uses: actions/cache@v3
name: Load pip cache
id: cache-pip
with:
Expand All @@ -48,14 +48,18 @@ jobs:

- name: Install python dependencies
run: |
if [ "${{ matrix.python-version }}" == "3.6" ]; then export SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL=1; fi
python -m pip install --upgrade pip
pip install -v .
pip install --no-binary=mpi4py mpi4py
pip install pytest
if [ "${{ matrix.python-version }}" != "3.6" ]; then pip install pocomc; fi
pip install --no-binary=mpi4py mpi4py astropy pocomc pytest pytest-cov
- name: Test with pytest
run: |
cosmosis --version
mkdir tmp && cd tmp && pytest --pyargs cosmosis
mkdir tmp && cd tmp && pytest --pyargs cosmosis --cov cosmosis --cov-report=xml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
if: matrix.python-version == '3.9' && matrix.os == 'ubuntu-20.04'
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,4 @@ install-record.txt
*.egg-info
.DS_Store
output/*
cosmosis.code-workspace
4 changes: 4 additions & 0 deletions bin/cosmosis-campaign
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env python3
import cosmosis.campaign
args = cosmosis.campaign.parser.parse_args()
cosmosis.campaign.main(args)
2 changes: 1 addition & 1 deletion cosmosis/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from .main import run_cosmosis
from .runtime import MPIPool, LikelihoodPipeline, FunctionModule, \
stdout_redirected, Inifile, CosmosisConfigurationError, \
MPIPool, Module, FunctionModule, ClassModule
MPIPool, Module, FunctionModule, ClassModule, logs
from .samplers import Sampler
from . import samplers
from .version import __version__
Expand Down
Loading

0 comments on commit d2ea4cb

Please sign in to comment.