copying BBHPriorDict
If one copies a BBHPriorDict
object it will add back in the default priors, e.g. here I create a standard prior, pop (delete) the mass_1 and make a copy. After the copy operation, the mass prior is back in (a message is printed warning about this).
>>> prior = bilby.gw.prior.BBHPriorDict()
11:24 bilby INFO : No prior given, using default BBH priors in /home/user1/miniconda3/lib/python3.6/site-packages/bilby-0.3.3-py3.6.egg/bilby/gw/prior_files/binary_black_holes.prior.
>>> prior.pop('mass_1') # remove mass_1 from the prior, e.g., to use mass ratio instead
>>> prior_copy = prior.copy()
>>> print(prior_copy)
BBHPriorDict([('mass_1',
Uniform(minimum=5, maximum=100, name='mass_1', latex_label='$m_1$', unit='$M_{\\odot}$')),
('mass_2',
Uniform(minimum=5, maximum=100, name='mass_2', latex_label='$m_2$', unit='$M_{\\odot}$')),
('a_1',
Uniform(minimum=0, maximum=0.8, name='a_1', latex_label='$a_1$', unit=None)),
('a_2', ...
This causes subtle behaviours as the copy operation is used in the bilby.gw.likelihoood.GravitationalWaveTransient
, which is ultimately what caused the strange error of #257 (closed)
Fundamentally, the problem is that the copy operation reinitialises the object and then adds the attributes. At the reinitialisation, the default is read back in. Note sure how best to fix this.