remi-adam / pitszi

BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

colorbar does support astropy quantities #2

Closed TomEynard closed 5 months ago

TomEynard commented 5 months ago

In utils_plot, line 1067: The colorbar does not allow astropy u.Quantities.

Covmat_bfmodel comes from: k2d, model_pk2d_ref, model_pk2d_covmat = infers[0].get_pk2d_model_statistics(physical=True, Nmc=10) that yields a quantity of kpc4.

Covariance best fit model

ax = plt.subplot(Nrow, 2, 3)
plt.imshow(covmat_bfmodel)
cb = plt.colorbar()
plt.title(r'Best fit model covariance matrix')
plt.xlabel('k bin')
plt.ylabel('k bin')

Adding this seems to work : if isinstance(covmat_bfmodel, u.Quantity): covmat_bfmodel = covmat_bfmodel.value

remi-adam commented 5 months ago

Interesting, it was working for me. But I took the covmat.to_value(kpc4) in the calling function. it should be solved.