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 Simulator initials_dict when set by array #377

Merged
merged 2 commits into from Oct 18, 2018

Conversation

Projects
None yet
3 participants
@alubbock
Member

alubbock commented Sep 14, 2018

The Simulator class method initials_dict returns initial conditions
as a dictionary, mostly for use by network-free simulators like NFsim.
When initial conditions are set by an array or a list, species which
were not explicitly set using Initial() in the model are ignored.

This only affects users of the BngSimulator, which uses this
method, or anyone who called this method directly after setting
initials with an array or list.

This PR fixes the issue by returning a dictionary with values from the
array. This requires a species list for the model, so a ValueError
is raised where this is not available/generate_equations hasn't been
called yet.

Fixes: #376

Fix Simulator initials_dict when set by array
The `Simulator` class method `initials_dict` returns initial conditions
as a dictionary, mostly for use by network-free simulators like NFsim.
When initial conditions are set by an array or by a list, species which
were not explicitly set using `Initial()` in the model are ignored.

This would only affect users of the `BngSimulator`, which uses this
method, or anyone who called this method directly after setting
initials with an array or list.

This PR fixes the issue by returning a dictionary with values from the
array. This requires a species list for the model, so a `ValueError`
is raised where this is not available/`generate_equations` hasn't been
called yet.
@coveralls

This comment has been minimized.

coveralls commented Sep 14, 2018

Coverage Status

Coverage increased (+0.04%) to 79.216% when pulling ad0076b on alubbock:initial_dict_fix into b1284a7 on pysb:master.

@alubbock alubbock merged commit 11cb658 into pysb:master Oct 18, 2018

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.04%) to 79.216%
Details

@alubbock alubbock deleted the alubbock:initial_dict_fix branch Oct 18, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment