feat(emcee): implement get_expected_outputs (closes #804)#1073
Open
christianescamilla15-cell wants to merge 1 commit intobilby-dev:mainfrom
Open
feat(emcee): implement get_expected_outputs (closes #804)#1073christianescamilla15-cell wants to merge 1 commit intobilby-dev:mainfrom
christianescamilla15-cell wants to merge 1 commit intobilby-dev:mainfrom
Conversation
The Emcee sampler was inheriting the default get_expected_outputs from the base Sampler class, which returns only a single directory. However, emcee actually writes two concrete files during checkpointing via its checkpoint_info property (bilby/core/sampler/emcee.py:256-257): - chain.dat (tab-separated chain history) - sampler.pickle (dill-pickled EnsembleSampler for resume) These were not being reported to bilby_pipe, which uses this method to know which files to transfer via HTCondor. This PR adds an explicit override for Emcee that reports both files plus the run directory. Also adds a unit test in test/core/sampler/emcee_test.py following the same pattern as the existing tests for Dynesty, Nessai, and Bilby_MCMC.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements a concrete `get_expected_outputs` override for the `Emcee` sampler so that `bilby_pipe` knows about the `chain.dat` and `sampler.pickle` files it writes when using HTCondor file transfer.
Closes #804.
Background
From the issue:
Looking at `bilby/core/sampler/emcee.py` the checkpoint logic is very explicit about what files get written:
```python
chain_file = os.path.join(out_dir, "chain.dat")
sampler_file = os.path.join(out_dir, "sampler.pickle")
```
But `get_expected_outputs` was not overridden on `Emcee`, so it was falling back to the generic `Sampler.get_expected_outputs` which returns only a directory with no files. This means `bilby_pipe` was not listing these files as expected outputs for HTCondor transfer.
Changes
`bilby/core/sampler/emcee.py`
Added a classmethod `get_expected_outputs` that returns:
The implementation follows the same pattern used by the existing `ptemcee`, `dynesty`, and `nessai` overrides.
`test/core/sampler/emcee_test.py`
Added `test_get_expected_outputs` following the pattern of the corresponding tests in `dynesty_test.py` and `nessai_test.py`. It verifies:
Test plan
References
Issue reported by @michael-williams (GitLab migration) — original comment at `bilby/core/sampler/emcee.py#L258`.