Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add reader for Cobaya's MCMC chains (requires GetDist) #167

Merged
merged 18 commits into from
Jul 14, 2021

Conversation

lukashergt
Copy link
Collaborator

@lukashergt lukashergt commented Jun 22, 2021

This introduces a chain reader for Cobaya's MCMC chains. Cobaya (different from CosmoMC) no longer provides .paramnames files for its MCMC chains, but instead works with .yaml files which are simultaneously Cobaya's input files. These contain all information on the sampling parameters and derived parameters, including the tex string. The CobayaMCMCReader that is implemented here uses GetDist to infer the parameter labels used for the pandas dataframe as well as the tex strings for the .tex dictionary. Since GetDist is a requirement for Cobaya anyhow, having it as a requirement for anesthetic's CobayaMCMCReader shouldn't be too bad.

Fixes #129

Checklist:

  • I have performed a self-review of my own code
  • My code is PEP8 compliant (flake8 anesthetic tests)
  • My code contains compliant docstrings (pydocstyle --convention=numpy anesthetic)
  • New and existing unit tests pass locally with my changes (python -m pytest)
  • I have added tests that prove my fix is effective or that my feature works

@lukashergt lukashergt added the enhancement New feature or request label Jun 22, 2021
@lukashergt lukashergt self-assigned this Jun 22, 2021
@codecov
Copy link

codecov bot commented Jun 22, 2021

Codecov Report

Merging #167 (b83488c) into master (0b37b64) will increase coverage by 0.00%.
The diff coverage is 95.74%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #167   +/-   ##
=======================================
  Coverage   95.09%   95.10%           
=======================================
  Files          16       17    +1     
  Lines        1672     1715   +43     
=======================================
+ Hits         1590     1631   +41     
- Misses         82       84    +2     
Impacted Files Coverage Δ
anesthetic/read/getdistreader.py 92.42% <ø> (-0.33%) ⬇️
anesthetic/read/cobayamcmcreader.py 95.23% <95.23%> (ø)
anesthetic/read/samplereader.py 78.57% <100.00%> (+3.57%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0b37b64...b83488c. Read the comment docs.

lukashergt added 2 commits July 5, 2021 08:38
…lumn as `logP` (cobayas second column is the log-posterior) instead of `chi2`
Copy link
Collaborator

@williamjameshandley williamjameshandley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a very nice addition. I assume that since you're a Cobaya aficionado you've tested this 'in the wild' in addition to the tests you've put in here?

Once @Stefan-Heimersheim has finished #158 for dynesty, I think the only one we're missing is cosmosis. @Pablo-Lemos does cosmosis have it's own chain formatting, or does it just rely on polychord/multinest?

@Pablo-Lemos
Copy link
Collaborator

I believe CosmoSIS has its own formatting, and in fact annoyingly does not generate a paramnames file

@lukashergt lukashergt mentioned this pull request Jul 14, 2021
5 tasks
@lukashergt lukashergt merged commit 03ba0b9 into handley-lab:master Jul 14, 2021
@lukashergt lukashergt deleted the cobayamcmcreader branch April 14, 2023 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cobaya chain reading
3 participants