Closed m-aguena closed 1 year ago
@m-aguena Did you mean to publish this PR to be ready for review or are you still working on it?
It is still in progress. I have to update the unittests
@mattkwiecien I tried to run the unit tests but got a sacc related error:
===================================================================================================== ERRORS ======================================================================================================
______________________________________________________________________________________ ERROR at setup of test_load_from_sacc ______________________________________________________________________________________
@pytest.fixture
def mock_sacc():
# Using values from
# https://github.com/nrussofer/Cosmological-Covariance-matrices
# /blob/master/Full%20covariance%20N_N%20part%20vfinal.ipynb
# As reference.
s = sacc.Sacc()
s.metadata["nbins_cluster_redshift"] = 18
s.metadata["nbins_cluster_richness"] = 3
s.metadata["min_mass"] = 1e13
# This isnt how tracers actually look, but sort of
# hacks the class to work without building
# an entire sacc file for this test.
> s.add_tracer(
"misc",
"clusters_0_0",
metadata={
"Mproxy_name": "richness",
"Mproxy_min": 10,
"Mproxy_max": 100,
"z_name": "redshift",
"z_min": 0.3,
"z_max": 1.2,
},
)
tests/test_covariance_clusters.py:51:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../sacc/sacc/sacc.py:138: in add_tracer
tracer = BaseTracer.make(tracer_type, name,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'sacc.tracers.BaseTracer'>, tracer_type = 'misc', name = 'clusters_0_0', args = (), kwargs = {'metadata': {'Mproxy_max': 100, 'Mproxy_min': 10, 'Mproxy_name': 'richness', 'z_max': 1.2, ...}}
@classmethod
def make(cls, tracer_type, name, *args, **kwargs):
"""
Select a Tracer subclass based on tracer_type
and instantiate in instance of it with the remaining
arguments.
Parameters
----------
tracer_type: str
Must correspond to the tracer_type of a subclass
name: str
The name for this specific tracer.
Returns
-------
instance: Tracer object
An instance of a Tracer subclass
"""
> subclass = cls._tracer_classes[tracer_type]
E KeyError: 'misc'
../sacc/sacc/tracers.py:75: KeyError
I don't know the source of it. Could this be related to a latest sacc version?
Sorry, this is indeed caused my the latest sacc version which means you have to write "Misc" instead of "misc". I hadn't appreciated this would happen, apologies. I have a PR now in sacc to fix it.
Sorry, this is indeed caused my the latest sacc version which means you have to write "Misc" instead of "misc". I hadn't appreciated this would happen, apologies. I have a PR now in sacc to fix it.
Thanks @joezuntz !
@m-aguena I would recommend pulling latest master and rebasing (or merging into) your branch, we made some changes to the tests since you've branched off master.
@joezuntz thank you!
This solves only part of issue #71