Skip to content
Snippets Groups Projects
Commit 6ee08a83 authored by Gregory Ashton's avatar Gregory Ashton
Browse files

Merge branch 'fix-time-reconstruction' into 'master'

force there to be at least three elements in time reconstruction

See merge request !714
parents b8abbc81 a1c34134
No related branches found
No related tags found
1 merge request!714force there to be at least three elements in time reconstruction
Pipeline #102678 passed
......@@ -15,7 +15,7 @@ except ImportError:
from scipy.misc import logsumexp
from scipy.special import i0e
from ..core.likelihood import Likelihood, MarginalizedLikelihoodReconstructionError
from ..core.likelihood import Likelihood
from ..core.utils import BilbyJsonEncoder, decode_bilby_json
from ..core.utils import (
logger, UnsortedInterp2d, create_frequency_series, create_time_series,
......@@ -392,17 +392,13 @@ class GravitationalWaveTransient(Likelihood):
np.exp(time_log_like - max(time_log_like)) * time_prior_array)
keep = (time_post > max(time_post) / 1000)
if sum(keep) < 3:
keep[1:-1] = keep[1:-1] | keep[2:] | keep[:-2]
time_post = time_post[keep]
times = times[keep]
if len(times) > 1:
new_time = Interped(times, time_post).sample()
return new_time
else:
raise MarginalizedLikelihoodReconstructionError(
"Time posterior reconstruction failed, at least two samples "
"are required."
)
new_time = Interped(times, time_post).sample()
return new_time
def generate_distance_sample_from_marginalized_likelihood(
self, signal_polarizations=None):
......
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