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

lognorm distributions failing when using callable pars. #519

Closed
RHull-IDM opened this issue May 21, 2024 · 1 comment
Closed

lognorm distributions failing when using callable pars. #519

RHull-IDM opened this issue May 21, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@RHull-IDM
Copy link
Contributor

Both lognorm_ex and lognorm_im currently fail when passed a callable parameter.

To reproduce:

import starsim as ss
import sciris as sc
import numpy as np

sim = sc.prettyobj()
sim.n = 10
sim.people = sc.prettyobj()
sim.people.uid = np.arange(sim.n)
sim.people.slot = np.arange(sim.n)
sim.people.age = np.random.uniform(0, 90, size=sim.n)

def custom_mean(module, sim, uids):
    out = sim.people.age[uids]
    return out

testdist = ss.lognorm_ex(mean=custom_mean, stdev=2).initialize() # fails with TypeError: '<=' not supported between instances of 'function' and 'int'

testdist2 = ss.lognorm_im(mean=custom_mean, sigma=np.log(2)).initialize() # fails with TypeError: loop of ufunc does not support argument 0 of type function which has no callable exp method

@RHull-IDM RHull-IDM added the bug Something isn't working label May 21, 2024
@cliffckerr cliffckerr added this to the v0.5.x: Sim API bugfixes milestone May 22, 2024
@cliffckerr cliffckerr self-assigned this May 22, 2024
@cliffckerr cliffckerr added the MVP label May 22, 2024
@cliffckerr cliffckerr mentioned this issue May 28, 2024
4 tasks
@cliffckerr
Copy link
Contributor

Closed by #527

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

2 participants