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

Small modifications to support BNG's 'stop_if' method #407

Merged
merged 4 commits into from Jan 25, 2019

Conversation

Projects
None yet
3 participants
@lh64
Copy link
Contributor

commented Jan 12, 2019

No description provided.

Some small modifications to support the 'stop_if' method in BNG, which
allows one to define a logical function that if True will terminate a
simulation. First problem is that BNG creates a new internal function
called '_stop_if' that gets output to the .gdat file. This was causing
problems in PySB since the number of defined Expressions wasn't matching
the number of functions in the .gdat file. Fixed this by explicitly
using the length of 'model.expressions' when reading in the .gdat file.
Second problem is that if 'stop_if' is satisfied at the outset BNG will
immediately quit, only outputting the initial state to the .cdat and
.gdat files. This meant that PySB was reading this in as a single numpy
array, rather than an array of arrays, which was causing a downstream
error. Fixed this by requiring the number of dimensions 'ndmin=2' in the
'numpy.loadtxt' calls. Also added a small test model to the validation
test suite called 'test_stop_if'.

@lh64 lh64 requested a review from alubbock Jan 12, 2019

@coveralls

This comment has been minimized.

Copy link

commented Jan 12, 2019

Coverage Status

Coverage increased (+0.1%) to 79.295% when pulling dae388f on stop_if into c267f1e on master.

@alubbock alubbock force-pushed the stop_if branch from beb0df8 to f454246 Jan 14, 2019

@alubbock alubbock force-pushed the stop_if branch from f454246 to c6250e0 Jan 15, 2019

@alubbock

This comment has been minimized.

Copy link
Member

commented Jan 15, 2019

Your PR brought to my attention that the Anaconda BNG release of SSA wasn't working properly on Windows. I've fixed this and published BNG 2.4.0 for all platforms on Anaconda.

I've also pushed a small change to support models with constant expressions. But otherwise, looks good to go.

@alubbock alubbock merged commit 470945e into master Jan 25, 2019

5 checks passed

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

@alubbock alubbock deleted the stop_if branch Jan 25, 2019

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