62 introduced a bug. Now CovarianceCalculator fails to compute the covariance because covariance_from_name does not find the classes.
A dirty hack is to import the needed class together with the CovarianceCalculator.
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[2], line 2
1 # You can get the total covariance:
----> 2 cov = cc.get_covariance();
4 plt.imshow(np.log10(np.abs(cov)))
5 plt.colorbar()
File ~/.local/lib/python3.10/site-packages/tjpcov/covariance_calculator.py:107, in CovarianceCalculator.get_covariance(self)
100 """Return the covariance with all the contributions added up.
101
102 Returns:
103 array: Final covariance with all the requested contributions added
104 up.
105 """
106 if self.cov_total is None:
--> 107 cov_terms = self.get_covariance_terms()
109 # No need to do it only for rank == 0 since all Builder processes
110 # have self.cov well defined and this is quite unexpensive.
111 self.cov_total = sum(cov_terms.values())
File ~/.local/lib/python3.10/site-packages/tjpcov/covariance_calculator.py:128, in CovarianceCalculator.get_covariance_terms(self)
116 """Return a dictionary with the covariance contributions.
117
118 The dictionary has keys the covariace types and values their covariance
(...)
125 covariance contributions.
126 """
127 if self.cov_terms is None:
--> 128 cov_classes = self.get_covariance_classes()
130 cov_terms = {}
131 for ctype, cov_dict in cov_classes.items():
File ~/.local/lib/python3.10/site-packages/tjpcov/covariance_calculator.py:64, in CovarianceCalculator.get_covariance_classes(self)
62 space_types = []
63 for covi in cov_tbc:
---> 64 covi = covariance_from_name(covi)
65 # Check the cov_type has not been already requested for the
66 # same tracer types (e.g. two Gaussian contributions for ClxCl)
67 if (covi.cov_type in cov_classes) and (
68 covi._tracer_types in cov_classes[covi.cov_type]
69 ):
File ~/.local/lib/python3.10/site-packages/tjpcov/__init__.py:27, in covariance_from_name(name)
25 return mappers[name]
26 else:
---> 27 raise ValueError(f"Unknown covariance {name}")
ValueError: Unknown covariance FourierGaussianNmt
62 introduced a bug. Now
CovarianceCalculator
fails to compute the covariance becausecovariance_from_name
does not find the classes.A dirty hack is to import the needed class together with the
CovarianceCalculator
.