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

setSeed and getSeed functions are updated according to the latest roadrunner changes #585

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Python Tests and Wheel

on:
pull_request:
branches:
- '*'
push:
branches:
- develop

jobs:
test-and-build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.11

- name: Install libncurses.so.5
run: |
sudo apt-get update
sudo apt-get install -y libncurses5

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt

- name: Run Python Tests
run: |
pytest tellurium/tests

- name: Build Wheel if Tests Pass
if: success()
run: |
python setup.py bdist_wheel

- name: Upload to PyPI
if: success() && github.event_name == 'push' && github.ref == 'refs/heads/develop'
run: |
python -m pip install --upgrade pip
pip install twine
twine upload dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
29 changes: 2 additions & 27 deletions tellurium/roadrunner/extended_roadrunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,40 +369,15 @@ def show(self, reset=True):
# ---------------------------------------------------------------------
# Stochastic Simulation Methods
# ---------------------------------------------------------------------
def getSeed(self, integratorName="gillespie"):
""" Current seed used by the integrator with integratorName.
Defaults to the seed of the gillespie integrator.

:param integratorName: name of the integrator for which the seed should be retured
:type integratorName: str
:returns: current seed
:rtype: float
"""
integrator = self.getIntegratorByName(integratorName)
return integrator.getValue('seed')

@property
def seed(self):
""" Getter for Gillespie seed. """
""" Getter for global Configuration seed. """
return self.getSeed()

def setSeed(self, seed, integratorName="gillespie"):
""" Set seed in integrator with integratorName.
Defaults to the seed of the gillespie integrator.

Raises Error if integrator does not have key 'seed'.

:param seed: seed to set
:param integratorName: name of the integrator for which the seed should be retured
:type integratorName: str
"""
# there are some issues converting big Python (greater than 4,294,967,295) integers
# to C integers on 64 bit machines. If its converted to float before, works around the issue.
self.setIntegratorSetting(integratorName=integratorName, settingName="seed", value=float(seed))

@seed.setter
def seed(self, value):
""" Setter for Gillespie seed. """
""" Setter for model and global Configuration option seed. """
return self.setSeed(value)

def gillespie(self, *args, **kwargs):
Expand Down
Loading