cadCAD-org/cadCAD

params provided as list with parameter of single value

BenSchZA opened this issue · 13 comments

When setting the initial parameters of the system to a single value, i.e. no parameter sweep, the params are provided as a list to the state update and policy functions rather than a dictionary. This isn't expected correct?

The following error is thrown TypeError: list indices must be integers or slices, not str which is simply solved by accessing the specific parameter after selecting the first list index:

m = {
    'a': [2]
}

...

def policy_function_1(_params, substep, sH, s, **kwargs):
    a = _params[0]['a']
    return {'a': a}

I'm sure it's a simple fix, and don't mind looking into it either.

@BenSchZA
I'll handle it this time because its for a feature extension.
can you included a link to the system model?

Cool, I don't have a repo for it, but will upload a recreation of the error for you.

@BenSchZA
that would be greatly appreciated

This issue exists in hot_fix

@JEJodesty https://gist.github.com/BenSchZA/9a67a30e64ad7a7876dc3b72d1e303d5 - note that I did a pip install https://github.com/cadCAD-org/cadCAD/archive/master.zip --force-reinstall because of the issue with PyPi version, so the issue exists on master v0.4.20.

Same here. The issue did not go away in 0.4.20

@aclarkData @BenSchZA
i wasn't aiming to solve this with v0.4.20, v0.4.20 was to solve #171
I will hotfix this with v0.4.21

@aclarkData
Can you provide a repo for me to solve this? (Offline)

@matttyb80 @BenSchZA @aclarkData
try it now in hot_fix branch
1.
reinstall cadCAD
Option B: Build From Source
https://github.com/cadCAD-org/cadCAD/tree/hot_fix

Using the hot_fix, it's working

Hot fix #183