Open tilmantroester opened 6 months ago
To explain a bit further: blinding will run as a part of a data-vector measurement pipeline.
The blinding library needs to call the theory-vector calculation from the firecrown likelihood that will be used in the cosmological inference to ensure consistency. This likelihood must be build with different data-vectors as the blinding is a part of a the data-vector calculation pipeline.
We also have a requirement to blind sacc files directly.
In both cases, we need to be able to pass different sacc objects to the build_likelihood
instance.
At the moment, there's a .read()
method but this is protected, it cannot be called twice (we need to call it once, to build the likelihood and obtain a theory vector).
Does that make sense?
I found this trick here based on what is done for TXPipe and adapted the cosmic shear firecrown example to it: https://github.com/LSSTDESC/Blinding/blob/TST-likelihood_examples/examples/cosmic_shear/cosmicshear_likelihood.py
How much of a bad idea is this?
If this is the proper way of passing a sacc file to a likelihood, potentially would be good (if possible) to fix this to the likelihood data-model such that we impose this method exists and so every built likelihood is compatible with blinding.
If not possible, I will just make sure to document this method in the documentation on how to build likelihoods that can be used with the blinding library 😄
@marcpaterno @vitenti happy to help pushing development here... how do you recommend we tackle this?
It will also be important for new developments planned for Augur
For blinding (@arthurmloureiro) we need to be able to pass sacc objects to the likelihood creation entry point. At the moment,
load_likelihood
andbuild_likelihood
expect aNamedParameters
argument. This precludes passing a sacc object (as opposed to a filename string) and also gives no indication if thebuild_likelihood
implementation actually looks for a sacc object or file in thebuild_parameters
argument.A possible solution would be to add an optional
sacc_data
keyword argument toload_likelihood
that gets passed tobuild_likelihood
. If the latter doesn't implement this argument, it will cause an error, which informs the caller that the likelihood factory doesn't support external sacc files.sacc_data
could be either a string orSacc
object and it would be up to the likelihood factory to deal with this.