Skip to content
Snippets Groups Projects
Commit a272a80d authored by Kipp Cannon's avatar Kipp Cannon
Browse files

far.py: fix rate.py pickling problem

- rate.py's d550e7f7717fb81f9c441abe8bb44ef1b94ac74c made NDBins instances
  unpickleable because the ._getitems tuple of instance methods creates
  issues.  this makes it impossible to return them from a subprocess via a
  queue object.
- this switches to returning the BinnedArray's array objects rather than
  the entire BinnedArray (with its NDBins)
parent 80c60a9a
No related branches found
No related tags found
No related merge requests found
......@@ -775,12 +775,12 @@ def binned_log_likelihood_ratio_rates_from_samples(signal_rates, noise_rates, sa
raise ValueError("encountered NaN signal or noise model probability densities")
signal_rates[ln_lamb,] += exp(lnP_signal)
noise_rates[ln_lamb,] += exp(lnP_noise)
return signal_rates, noise_rates
def binned_log_likelihood_ratio_rates_from_samples_wrapper(queue, *args, **kwargs):
def binned_log_likelihood_ratio_rates_from_samples_wrapper(queue, signal_rates, noise_rates, samples, nsamples):
try:
queue.put(binned_log_likelihood_ratio_rates_from_samples(*args, **kwargs))
binned_log_likelihood_ratio_rates_from_samples(signal_rates, noise_rates, samples, nsamples)
queue.put((signal_rates.array, noise_rates.array))
except:
queue.put((None, None))
raise
......@@ -869,7 +869,7 @@ class RankingData(object):
threads.append((p, q, key))
while threads:
p, q, key = threads.pop(0)
self.signal_likelihood_rates[key], self.background_likelihood_rates[key] = q.get()
self.signal_likelihood_rates[key].array, self.background_likelihood_rates[key].array = q.get()
p.join()
if p.exitcode:
raise Exception("sampling thread failed")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment