Uninformative error when using an invalid prior with ROQs
When using ROQs with bilby/bilby_pipe, if the prior is not suitable for the basis being used an uninformative error is sometimes returned rather than the more informative errors raised by the check here. I believe this happens when there is no overlap between the prior and ROQ basis, but I have not verified this.
We should make sure the order of the different calls is correct and add a unit test to verify a helpful error is returned.
Example output
Example of the error
Traceback
Traceback (most recent call last):
File "/local/condor/execute/dir_957284/condor_exec.exe", line 8, in <module>
sys.exit(main())
File "/home/michael.williams/.conda/envs/nessai-review-gw/lib/python3.9/site-packages/bilby_pipe/data_analysis.py", line 379, in main
analysis.run_sampler()
File "/home/michael.williams/.conda/envs/nessai-review-gw/lib/python3.9/site-packages/bilby_pipe/data_analysis.py", line 264, in run_sampler
self.result = bilby.run_sampler(
File "/home/michael.williams/.conda/envs/nessai-review-gw/lib/python3.9/site-packages/bilby/core/sampler/__init__.py", line 190, in run_sampler
sampler = sampler_class(
File "/home/michael.williams/.conda/envs/nessai-review-gw/lib/python3.9/site-packages/bilby/core/sampler/base_sampler.py", line 252, in __init__
self._time_likelihood()
File "/home/michael.williams/.conda/envs/nessai-review-gw/lib/python3.9/site-packages/bilby/core/sampler/base_sampler.py", line 441, in _time_likelihood
self.log_likelihood(theta)
File "/home/michael.williams/.conda/envs/nessai-review-gw/lib/python3.9/site-packages/bilby/core/sampler/base_sampler.py", line 841, in log_likelihood
return Sampler.log_likelihood(self, theta)
File "/home/michael.williams/.conda/envs/nessai-review-gw/lib/python3.9/site-packages/bilby/core/sampler/base_sampler.py", line 534, in log_likelihood
return self.likelihood.log_likelihood()
File "/home/michael.williams/.conda/envs/nessai-review-gw/lib/python3.9/site-packages/bilby/gw/likelihood/base.py", line 837, in log_likelihood
return self.log_likelihood_ratio() + self.noise_log_likelihood()
File "/home/michael.williams/.conda/envs/nessai-review-gw/lib/python3.9/site-packages/bilby/gw/likelihood/base.py", line 394, in log_likelihood_ratio
self.waveform_generator.frequency_domain_strain(self.parameters)
File "/home/michael.williams/.conda/envs/nessai-review-gw/lib/python3.9/site-packages/bilby/gw/likelihood/roq.py", line 390, in waveform_generator
self._update_basis()
File "/home/michael.williams/.conda/envs/nessai-review-gw/lib/python3.9/site-packages/bilby/gw/likelihood/roq.py", line 358, in _update_basis
self._cache[basis_number_key] = np.arange(number_of_bases)[in_prior_range][0]
IndexError: index 0 is out of bounds for axis 0 with size 0