Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API for passing sacc data to load_likelihood and build_likelihood #394

Open
tilmantroester opened this issue Feb 22, 2024 · 3 comments
Open

Comments

@tilmantroester
Copy link
Contributor

For blinding (@arthurmloureiro) we need to be able to pass sacc objects to the likelihood creation entry point. At the moment, load_likelihood and build_likelihood expect a NamedParameters argument. This precludes passing a sacc object (as opposed to a filename string) and also gives no indication if the build_likelihood implementation actually looks for a sacc object or file in the build_parameters argument.

A possible solution would be to add an optional sacc_data keyword argument to load_likelihood that gets passed to build_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 or Sacc object and it would be up to the likelihood factory to deal with this.

@arthurmloureiro
Copy link

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?

@arthurmloureiro
Copy link

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 😄

@arthurmloureiro
Copy link

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants