-
Notifications
You must be signed in to change notification settings - Fork 3
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
Process keywords #177
Process keywords #177
Changes from 4 commits
7de1759
70f7c72
8c2ef72
34f843a
879facb
3cdb1e9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,11 +22,22 @@ class GrowthRate(Process): | |
""" A Vivarium process that models exponential growth of biomass """ | ||
|
||
name = NAME | ||
defaults = { | ||
'default_growth_rate': 0.0005, | ||
'default_growth_noise': 0.0, | ||
'variables': ['mass'] | ||
} | ||
# defaults = { | ||
# 'default_growth_rate': 0.0005, | ||
# 'default_growth_noise': 0.0, | ||
# 'variables': ['mass'] | ||
# } | ||
|
||
def __init__( | ||
self, | ||
default_growth_rate=0.0005, | ||
default_growth_noise=0.0, | ||
variables=('mass',), | ||
**base_parameters): | ||
|
||
parameters = locals().copy() | ||
base_parameters = parameters.pop('base_parameters') | ||
self.initialize(parameters, base_parameters) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know I helped create this thing, but on reflection I feel the cost here for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we can make this optional? If people want function keywords, they can follow this template. But the previous |
||
|
||
def ports_schema(self): | ||
return { | ||
|
@@ -73,13 +84,16 @@ def next_update(self, timestep, states): | |
def test_growth_rate(total_time=1350): | ||
initial_mass = 100 | ||
growth_rate = 0.0005 | ||
config = { | ||
'variables': ['mass'], | ||
'default_growth_rate': growth_rate, | ||
'time_step': 2, | ||
} | ||
|
||
growth_rate_process = GrowthRate(config) | ||
# config = { | ||
# 'variables': ['mass'], | ||
# 'default_growth_rate': growth_rate, | ||
# 'timestep': 2, | ||
# } | ||
|
||
growth_rate_process = GrowthRate( | ||
default_growth_rate=growth_rate, | ||
timestep=5.0, | ||
variables=('mass',)) | ||
initial_state = {'variables': {'mass': initial_mass}} | ||
experiment = process_in_experiment( | ||
growth_rate_process, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
timestep
change is good, maybe a separate PR?