... | ... | @@ -112,6 +112,48 @@ As you can see the extracted samples match the original. |
|
|
|
|
|
* https://git.ligo.org/lscsoft/pesummary/-/merge_requests/518
|
|
|
|
|
|
## Review tests
|
|
|
|
|
|
To test the `summarycombine_posteriors` executable, we test that the output from `summarycombine_posteriors` matches the output from `cbcBayesCombinePosteriors`. First we extract the `PublicationSamples` dataset from the public GW190814.h5 file:
|
|
|
|
|
|
```bash
|
|
|
summaryextract --outdir ./ --samples GW190814.h5 --filename extracted_PublicationSamples.dat --file_format dat --label PublicationSamples
|
|
|
```
|
|
|
|
|
|
We then run the following:
|
|
|
|
|
|
```python
|
|
|
summarycombine_posteriors --outdir ./ --samples extracted_PublicationSamples.dat extracted_PublicationSamples.dat --weights 0.2 0.8 --filename pesummary_combined.dat --labels one two
|
|
|
cbcBayesCombinePosteriors -p extracted_PublicationSamples.dat -p extracted_PublicationSamples.dat -o lal_combined.dat -w 0.2 -w 0.8
|
|
|
```
|
|
|
|
|
|
We then compare the contents with:
|
|
|
|
|
|
```python
|
|
|
import numpy as np
|
|
|
|
|
|
pesummary_generated = np.genfromtxt("extracted_PublicationSamples.dat", names=True)
|
|
|
lal_generated = np.genfromtxt("lal_combined.dat", names=True)
|
|
|
assert all(param in pesummary_generated.dtype.names for param in lal_generated.dtype.names)
|
|
|
for param in lal_generated.dtype.names:
|
|
|
np.testing.assert_almost_equal(
|
|
|
lal_generated[param], pesummary_generated[param]
|
|
|
)
|
|
|
```
|
|
|
|
|
|
Note, we made a small edit to both executables to ensure both use the same random seed. The diffs can be seen below:
|
|
|
|
|
|
```bash
|
|
|
diff cbcBayesCombinePosteriors cbcBayesCombinePosteriors_original
|
|
|
38,39d37
|
|
|
< np.random.seed(123456789)
|
|
|
<
|
|
|
diff summarycombine_posteriors.py summarycombine_posteriors_original.py
|
|
|
18,19d17
|
|
|
< import numpy as np
|
|
|
< np.random.seed(123456789)
|
|
|
```
|
|
|
|
|
|
## Reviewer comments
|
|
|
|
|
|
# `summarytgr` :heavy_check_mark:
|
... | ... | |