ACCarnall / bagpipes

Bagpipes is a state of the art code for generating realistic model galaxy spectra and fitting these to spectroscopic and photometric observations. Users should install with pip, not by cloning the repository.
http://bagpipes.readthedocs.io
GNU General Public License v3.0
71 stars 37 forks source link

Do not rename fitted model params if tex_on is False #66

Closed larrybradley closed 2 months ago

larrybradley commented 2 months ago

I recently ran into an issue where Bagpipes fit_catalogue (with make_plots=True) fails with a KeyError on systems without latex:

plot_1d_posterior.py:50, in plot_1d_posterior(fit, fit2, show, save)
---> 50 samples = np.copy(fit.posterior.samples[name])

KeyError: 'log_10(delayed:metallicity)'

The issue is that fit.fitted_model.params gets a reference to labels, which is later changed in place, thus changing the params names as well.

This PR fixes that issue by making labels a copy of the params. It also removes two unused imports.

ACCarnall commented 2 months ago

Thanks Larry!