joezuntz / cosmosis

Other
22 stars 16 forks source link

Have Importance sampler retain "nsample" metadata from input chain #89

Open jessmuir opened 1 year ago

jessmuir commented 1 year ago

As it's currently set up, the importance sampler output will have the same number of rows as the input chain, and as far as I can tell, it doesn't retain the nsample metadata that's reported at the end of polychord and multinest chains.

It might be useful for the importance sampler to retain that metadata, either as part of its own metadata, or via step which removes any excess samples in the original chain before running likelihoods. If the original chain output has more rows than should be retained for inferring the posterior, we'd want to make sure to remove those from the IS output as well.

N.b. That being said, this may be nice to have but unecessary: As I was writing this up, I looked at line counts for a couple different polychord and multinest outputs and found that the number of rows in the chain file equal to nsample, so it's not necessary to trim any lines before plotting posteriors. If this is always the case (is it?), the IS posteriors will be fine without tracking nsample.