Skip to content

Commit

Permalink
Merge branch 'master' into parallel_odeint
Browse files Browse the repository at this point in the history
  • Loading branch information
alubbock committed Dec 11, 2018
2 parents 1c1466b + 3f65185 commit aceec38
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 20 deletions.
3 changes: 2 additions & 1 deletion pysb/examples/cupsoda/run_michment_cupsoda.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ def run():
tspan = np.linspace(0, 50, 501)
# run_cupsoda returns a 3D array of species and observables trajectories
trajectories = run_cupsoda(model, tspan, initials=initials,
atol=1e-10, rtol=1e-4, verbose=True)
integrator_options={'atol': 1e-10, 'rtol': 1e-4},
verbose=True)
# extract the trajectories for the 'Product' into a numpy array and
# transpose to aid in plotting
x = np.array([tr['Product'] for tr in trajectories]).T
Expand Down
3 changes: 2 additions & 1 deletion pysb/examples/cupsoda/run_tyson_oscillator_cupsoda.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ def run():
n_sims = 100
vol = model.parameters['vol'].value
tspan = np.linspace(0, 500, 501)
sim = CupSodaSimulator(model, tspan, vol=vol, verbose=True,
sim = CupSodaSimulator(model, tspan, verbose=True,
integrator_options={'atol' : 1e-12,
'rtol' : 1e-6,
'vol': vol,
'max_steps' :20000})

# Rate constants
Expand Down
2 changes: 1 addition & 1 deletion pysb/examples/run_robertson.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
t = linspace(0, 40)
# Simulate the model
print("Simulating...")
y = ScipyOdeSimulator(model, rtol=1e-4, atol=[1e-8, 1e-14, 1e-6]).run(
y = ScipyOdeSimulator(model, integrator_options=dict(rtol=1e-4, atol=[1e-8, 1e-14, 1e-6])).run(
tspan=t).all
# Gather the observables of interest into a matrix
yobs = array([y[obs] for obs in ('A_total', 'B_total', 'C_total')]).T
Expand Down
2 changes: 1 addition & 1 deletion pysb/examples/run_tutorial_a.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
t = [0, 10, 20, 30, 40, 50, 60]
simulator = ScipyOdeSimulator(model, tspan=t)
simresult = simulator.run()
print(simresult.species[:, 1])
print(simresult.species)
30 changes: 16 additions & 14 deletions pysb/pathfinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
import sys
import sysconfig

# Set to False to not utilize the system PATH environment variable
use_path = 'PYSB_PATHFINDER_IGNORE_PATH' not in os.environ

_path_config = {
'bng': {
'name': 'BioNetGen',
Expand Down Expand Up @@ -126,14 +129,13 @@ def get_path(prog_name):
path_conf['name'],
_get_executable(prog_name)))

# If this is anaconda, check the anaconda binary dir
if _is_anaconda():
try:
_path_cache[prog_name] = _validate_path(prog_name,
_get_anaconda_bindir())
return _path_cache[prog_name]
except ValueError:
pass
# Check the Anaconda environment, if applicable, or BINDIR
try:
_path_cache[prog_name] = _validate_path(prog_name,
_get_anaconda_bindir())
return _path_cache[prog_name]
except ValueError:
pass

# Check default paths for this operating system
if os.name not in path_conf['search_paths'].keys():
Expand All @@ -147,6 +149,10 @@ def get_path(prog_name):
set_path.__name__))

search_paths = path_conf['search_paths'][os.name]
if use_path:
search_paths = list(search_paths) + os.environ.get('PATH', '').split(
os.pathsep)

for search_path in search_paths:
try:
_path_cache[prog_name] = _validate_path(prog_name, search_path)
Expand Down Expand Up @@ -186,10 +192,6 @@ def set_path(prog_name, full_path):
_path_cache[prog_name] = _validate_path(prog_name, full_path)


def _is_anaconda():
""" Identify if this is an anaconda environment """
return 'conda' in sys.version


def _get_anaconda_bindir():
""" Get the binary path from python build time (for anaconda) """
Expand All @@ -198,7 +200,7 @@ def _get_anaconda_bindir():
if conda_env:
return os.path.join(conda_env, 'Scripts' if os.name == 'nt' else 'bin')

# Otherwise, use the default anaconda bin directory
# Otherwise, try the default anaconda/python bin directory
bindir = sysconfig.get_config_var('BINDIR')
if os.name == 'nt':
# bindir doesn't point to scripts directory on Windows
Expand Down Expand Up @@ -236,7 +238,7 @@ def _validate_path(prog_name, full_path):
if not os.path.isfile(full_path):
# On anaconda, check batch file on Windows, if applicable
batch_file = _get_batch_file(prog_name)
if _is_anaconda() and os.name == 'nt' and batch_file:
if os.name == 'nt' and batch_file:
try:
return _validate_path(prog_name,
os.path.join(full_path, batch_file))
Expand Down
2 changes: 1 addition & 1 deletion pysb/simulator/scipyode.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def __init__(self, model, tspan=None, initials=None, param_values=None,
"installing a package for compiling the ODEs to C code: "
"'weave' (recommended for Python 2) or "
"'cython' (recommended for Python 3). This warning can "
"be suppressed by specifying compiler_mode='python'.")
"be suppressed by specifying compiler='python'.")
self._logger.debug('Equation mode set to "%s"' % self._compiler)
else:
self._compiler = compiler_mode
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def main():
setup_requires=['nose'],
tests_require=['coverage', 'pygraphviz', 'matplotlib', 'pexpect',
'pandas', 'theano', 'h5py', 'mock', 'cython',
'libsbml', 'roadrunner'],
'python-libsbml', 'roadrunner'],
cmdclass=cmdclass,
keywords=['systems', 'biology', 'model', 'rules'],
classifiers=[
Expand Down

0 comments on commit aceec38

Please sign in to comment.