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

Method for returning a dictionary of required parameters set by a likelihood object #383

Open
arthurmloureiro opened this issue Feb 15, 2024 · 3 comments

Comments

@arthurmloureiro
Copy link

Hi Firecrowd,

It would be great to have a way for returning a dictionary of required parameters (keys and values) from a likelihood object. At the moment, I can return a list of required parameter names by:

from firecrown.likelihood.likelihood import load_likelihood_from_module_type
# this is a likelihood from firecrown's examples:
import des_y1_3x2pt_PT 

likelihood, tools = load_likelihood_from_module_type(des_y1_3x2pt_PT, None)

list(likelihood.required_parameters().get_params_names())

which returns me:

['lens0_b_s',
 'ia_a_d',
 'lens0_mag_bias',
 'ia_a_2',
 'src0_delta_z',
 'ia_a_1',
 'lens0_delta_z',
 'lens0_b_2',
 'lens0_bias']

Although these values are set inside the likelihood, I could not find a way of accessing them.

Is this possible?

This would be useful for the blinding infrastructure as it would eliminate requiring the user to provide this dictionary (and avoid the user providing a dictionary that may be discrepant with what's on the likelihood already).

@marcpaterno
Copy link
Collaborator

This is closed by PR #420. The Likelihood class method has a method required_parameters that returns a RequiredParameters object containing the names and values of the parameters.

Note that ModelingTools also has a method required_parameters that returns a RequiredParameters object containing all the parameters of the models.

The RequiredParameters class has a method get_default_values that returns a dictionary with the names and default values of the parameters.

We will add a tutorial that includes a demonstration of these features.

@arthurmloureiro does this meet the need?

@arthurmloureiro
Copy link
Author

Hi @marcpaterno : has this feature been released yet?

@marcpaterno
Copy link
Collaborator

This feature has been merged into the master branch. It is not yet part of a tagged release, but will become part of Firecrown 1.8.0 (modulo any tweaking in the interface that might occur before the release is cut).

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