From 9ba1d59fbd986eb9a9969ff870c52e98054d9bb0 Mon Sep 17 00:00:00 2001
From: Marc Arene <marc.arene@apc.in2p3.fr>
Date: Wed, 29 Jan 2020 16:19:17 +0100
Subject: [PATCH] Removing the raised error "Waveform longer than frequency
 array".

---
 bilby/gw/source.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/bilby/gw/source.py b/bilby/gw/source.py
index b69972fbc..8b52ceeae 100644
--- a/bilby/gw/source.py
+++ b/bilby/gw/source.py
@@ -383,7 +383,10 @@ def _base_lal_cbc_fd_waveform(
     h_cross = np.zeros_like(frequency_array, dtype=np.complex)
 
     if len(hplus.data.data) > len(frequency_array):
-        raise ValueError("Waveform longer than frequency array")
+        # lalsim waveform arrays can be padded with zeros up to
+        # a power of two length which can be greater than our length.
+        h_plus = hplus.data.data[:len(h_plus)]
+        h_cross = hcross.data.data[:len(h_cross)]
 
     h_plus[:len(hplus.data.data)] = hplus.data.data
     h_cross[:len(hcross.data.data)] = hcross.data.data
-- 
GitLab