Enable pickle compatibility for ligo.p_astro.Posterior class
This change implements the solution outlined in Issue #21, where dictionary keys and values stored on the Posterior class as attributes are instead stored as lists.
Merge request reports
Activity
mentioned in merge request spiir!89 (merged)
mentioned in issue #21
Hi @lscsoft p-astro - I'd just like to bump this merge request so that SPIIR no longer has to maintain their own fork of p-astro.
Context
The LIGO reviewers for the SPIIR project recommended that we use this LIGO repository (as it is already reviewed etc.) rather than rewriting the same p-astro implementation from scratch, and so we'd very much like to continue using this repository for our current O4 needs (and clean up the unnecessary fork).
Changes
All we need is this two line change merged. I believe it is simple enough to verify from all uses of the
self.args_all
andself.keys_fixed
attributes that downstream code should not be affected by thislist
function call we've used.We've been using this code for almost 6 months now and we have run into no errors associated with this change.
self.args_all
For those familiar with Python, the only uses of
self.args_all
is either as an iterator ([arg.label for arg in self.args_all]
), a call tolen()
(which accesses the object's__len__
method), and a cast toset
. These three access patterns function exactly the same whether it is alist
ordict_keys
type.self.keys_fixed
This attribute is used in exactly the same manner as
self.args_all
, and so the logic holds.Edited by Daniel Tangmentioned in merge request spiir-group/spiir!40 (merged)