Closed x12red closed 4 months ago
Hi Pier,
I suspect this is because you have a bin that starts before the Big Bang in the first case. The code will return a NaN likelihood for any model that includes stars formed before the Big Bang. If you want to get the precise age that bagpipes thinks the Universe has as a function of redshift you can do pipes.utils.cosmo.age(redshift).
Cheers, Adam
Hi Adam,
Thanks for your reply.
Yes, indeed, that was the problem. I was using a fixed redshift, but didn't realize the continuity function within bagpipes does not have an internal way to check if the maximum age in the bin_edges matches the age of the Universe at the redshift we consider. I simply added a function to sample the bin_edges accordingly to the zphot/zspec I give as input.
Thanks again!
Best, Pier
Dear Adam,
I've been trying running bagpipes with the non-parametric SFH (i.e., Leja+19 approach), but I always get the same error and cannot understand why. Below you find what I get, after the fit lasts for a couple of seconds:
Traceback (most recent call last): File "/Users/rinaldi/Dropbox/bagp/bagpipes_run.py", line 201, in
fit.fit(verbose=True, n_live=1000)
File "/usr/local/lib/python3.9/site-packages/bagpipes/fitting/fit.py", line 172, in fit
samples2d = np.loadtxt(self.fname + "post_equal_weights.dat")
File "/usr/local/lib/python3.9/site-packages/numpy/lib/npyio.py", line 1301, in loadtxt
arr = _read(fname, dtype=dtype, comment=comment, delimiter=delimiter,
File "/usr/local/lib/python3.9/site-packages/numpy/lib/npyio.py", line 979, in _read
arr = _load_from_filelike(
ValueError: could not convert string '-0.999000000000000022+100' to float64 at row 0, column 10.
In this case, I adopted the same configuration as the one pointed out in your example. So: continuity = {} continuity["massformed"] = (0., 13.) continuity["metallicity"] = (0.01, 5.) continuity["metallicity_prior"] = "log_10"§ continuity["bin_edges"] = [0., 10., 100., 250., 500., 1000., 2500., 5000., 5500.]
for i in range(1, len(continuity["bin_edges"])-1): continuity["dsfr" + str(i)] = (-10., 10.) continuity["dsfr" + str(i) + "_prior"] = "student_t"
continuity["dsfr" + str(i) + "_prior_scale"] = 0.3 # Defaults to this value as in Leja19, but can be set
fit_instructions["continuity"] = continuity
However, if I lower the bin_edges, it works (=> continuity["bin_edges"] = [0., 10., 100., 250., 500.]). I wonder if this is due to a mere computational limit of my laptop. Do you know why it happens?
Thank you in advance.
Best, Pier