Skip to content

Resolve "Problem merging results due to inconsistent priors"

Matthew Pitkin requested to merge matthew-pitkin/bilby:hdf5_prior_output into master

When a Result object is saved to HDF5 each of the prior values in PriorDict contains the least_recently_sampled attribute. This contains a random sample, or a number of random samples from the prior. This has two effects: i) if you try and merge results from two or more parallel runs based on results stored in HDF5 file it fails, as when it compares priors they are different due to having different samples; ii) the HDF5 object is bloated because it contains all these additional random prior samples.

This does not effect results saved to JSON as the prior dictionary is saved in a manner that ignores the least_recently_sampled value and also when the prior dictionary is read in it just creates a brand new prior object containing no samples.

This MR fixes this in two ways. First, it changes the way the priors are stored in a HDF object by converting them to the same JSON-style dictionary as used for the JSON file. Secondly, if comparing two Prior object using == it changes the __eq__ method, so that it ignores the least_recently_sampled attribute.

Resolves #491 (closed).

Merge request reports