Skip to content

Conversation

@cmbant
Copy link
Member

@cmbant cmbant commented Dec 3, 2025

Fixes #469

Improve error messages when parameter names are not valid Python identifiers (e.g., al0_-1 containing a hyphen):

  1. Sampled input params: Provide complete working example with derived: False
  2. Input function params: Explain that derived: False is needed to prevent tracking as derived
  3. Output params: Remove incorrect renames suggestion (doesn't actually work for output params), advise not requesting as derived instead

Example error messages after this change:

Sampled param with invalid name:

Parameter name 'al0_-1' is not a valid Python variable name...
If this is an input parameter of a likelihood or theory, whose name you cannot change, define an associated sampled one with a valid name:

  p_prime:
    prior: ...
  al0_-1:
    value: 'lambda p_prime: p_prime'
    derived: False

Output param with invalid name:

Parameter name 'al0_-1' is not a valid Python variable name...
If this is an output parameter of a likelihood or theory whose name you cannot change, do not request it as derived.

Pull Request opened by Augment Code with guidance from the PR author

Improve error messages when parameter names are not valid Python identifiers:

1. For sampled input params: provide complete working example with derived: False
2. For input function params: explain that derived: False is needed
3. For output params: remove incorrect 'renames' suggestion (doesn't work),
   advise not requesting as derived instead

Fixes #469
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

Successfully merging this pull request may close these issues.

cobaya parameter error

2 participants