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

BUG: Stochastic next functions need to depend on at least one argument #39

Open
timmens opened this issue Oct 5, 2023 · 0 comments
Open
Labels
bug Something isn't working

Comments

@timmens
Copy link
Member

timmens commented Oct 5, 2023

This works

@lcm.mark.stochastic
def next_health(health):  # noqa: ARG001
    pass

This does not

@lcm.mark.stochastic
def next_partner():
    pass

The second version should also work. The problem currently is in the weighting function:

...
new_kwargs = [*function_parameters, "params"]

@with_signature(args=new_kwargs)
def weight_func(*args, **kwargs):
    args = all_as_args(args, kwargs, arg_names=new_kwargs)
    
    # by definition of new_kwargs the last argument is params
    params = args[-1]

    indices = [
        label_translators[arg_name](arg)
        for arg_name, arg in zip(function_parameters, args, strict=False)
    ]

    return params["shocks"][name][*indices]
 ...

In particular, the indices are empty in the second case because there is no argument, although we want an index for each initial state.

@timmens timmens added the bug Something isn't working label Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant