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

Fix BngSimulator when supplying initials as params #450

Merged
merged 1 commit into from Jun 28, 2019

Conversation

@alubbock
Copy link
Member

commented Jun 13, 2019

The Simulator class allows users to change initials by supplying
new underlying parameter values (if both initials and params are
supplied, initials take precedence).

This behaviour was broken in the BngSimulator, which uses a dict
for initials instead of arrays, as some its simulators (e.g. NFsim)
are network free and thus may not have an exhaustive species list.

This PR fixes the issue via the initials_dict implementation,
and also refactors the initials array code to use initials_dict as well,
helping to reduce code duplication.

Fix BngSimulator when supplying initials as params
The Simulator class allows users to change initials by supplying
new underlying parameter values (if both initials and params are
supplied, initials take precedence).

This behaviour was broken in the BngSimulator, which uses a dict
for initials instead of arrays, as some its simulators (e.g. NFsim)
are network free and thus may not have an exhaustive species list.

This PR fixes the issue by fixing the initials_dict implementation,
and also refactors the initials array code to use this code as well,
helping to reduce code duplication.

@alubbock alubbock added the bug label Jun 13, 2019

@coveralls

This comment has been minimized.

Copy link

commented Jun 13, 2019

Coverage Status

Coverage increased (+0.8%) to 79.384% when pulling 02f815c on alubbock:fix_bng_initials_as_params into 468e6cf on pysb:master.

@jmuhlich
Copy link
Member

left a comment

Whew, the params/initials/etc. part of the simulator classes has proven to be hard to get right. We should think about the big picture here when we work on v2.0.

@alubbock alubbock merged commit 69b1281 into pysb:master Jun 28, 2019

3 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage increased (+0.8%) to 79.384%
Details

@alubbock alubbock deleted the alubbock:fix_bng_initials_as_params branch Jun 28, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.