legend-exp / pygama

Python package for data processing and analysis
https://pygama.readthedocs.io
GNU General Public License v3.0
18 stars 56 forks source link

Correctly set attributes for `sum_dists` to allow for pickling #570

Closed SamuelBorden closed 8 months ago

SamuelBorden commented 8 months ago

Previously, the __getattribute__ method was over-loaded in sum_dists to allow Iminuit to introspect parameter names; however, this implementation incorrectly rewrapped the object which prevented pickling a sum_dist object. By correctly setting the attributes for sum_dists methods using setattr during the initialization, each class method now has a _parameters attribute that Iminuit can use to get parameter names -- it also allows for pickling.