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

Occaisonal "TypeError: argument of type ‘bool’ is not iterable" at function tauLeap (line 552) of module pygom.stochastic_simulation. #62

Closed
m-d-grunnill opened this issue May 9, 2022 · 1 comment

Comments

@m-d-grunnill
Copy link

m-d-grunnill commented May 9, 2022

When running certain stochastic simulation through SimulateOde.simulate_jump methods the error "TypeError: argument of type ‘bool’ is not iterable" occasionally occurs. This happens in line 552 in function tauLeap of module pygom.model.stochastic_simulation.
The error is caused by function _cy_test_tau_leap_safety (file pygom/model/_tau_leap.pyx). When failing to find a low enough tau/jump step _cy_test_tau_leap_safety returns the bool False. However, line 552 in the function tauLeap is expecting a numeric followed by a bool.

Changing _cy_test_tau_leap_safety return if fail from (lines 56-57 of file pygom/model/_tau_leap.pyx):

        if tau_scale*total_rate <= 1.0 or count > 256:
            return False

to:

        if tau_scale*total_rate <= 1.0 or count > 256:
            return tau_scale, False

Solves this issue.

@twomagpi
Copy link
Collaborator

twomagpi commented Aug 7, 2024

Yes, good catch. This has been updated for #114

@twomagpi twomagpi closed this as completed Aug 7, 2024
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