Closed sibirrer closed 2 years ago
Thanks for raising the issue! As of now, the code does not work with one dimensional likelihoods since (hyper)ellipsoids are essential to the algorithm and aren't defined in 1 dimension. I'm not sure how common it is use Monte-Carlo samplers for one-dimensional problems. Nautilus would certainly be an overkill here. Do other samplers support one-dimensional likelihoods? I'm inclined to just have the code raise an explicit error message for one-dimensional likelihoods instead of adapting the code to support those.
I see. I made a simple test case using 1d sampling. This worked for the other samplers implemented in lenstronomy. It's not a requirement that it works but having a raise statement that it's not supported might be helpful to not start debugging.
When sampling a single parameter and initiating the prior as
num_param = 1 prior = Prior() for i in range(num_param): prior.add_parameter(dist=(self._lower_limit[i], self._upper_limit[i]))
and then running the sampler, it results in this error message below
In prior.py:94 try: assert self.dimensionality() == points.shape[-1] except AssertionError:
It looks like that point.shape[-1] is then the number of live points instead of the dimensionality of the free parameter. When adding more free parameters, the sampler runs as desired. Perhaps a check for the dimensionality or a re-formatting under the hook when having only one single call of add_parameter() is necessary to be able to run the same interface with one parameter as with multiple ones.