Skip to content

Commit

Permalink
Fixed small mistakes
Browse files Browse the repository at this point in the history
  • Loading branch information
jofmi committed Oct 17, 2020
1 parent 7a65e4a commit 22baf8c
Show file tree
Hide file tree
Showing 12 changed files with 110 additions and 132 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# IPython Notebook Checkpoints
**/.ipynb_checkpoints
**/__pycache__

# Documentation builds
**/_build
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Agentpy is a package for the development and analysis of agent-based models in P

**Documentation:** https://agentpy.readthedocs.io

**Tutorials:** https://agentpy.readthedocs.io/tutorials.html
**Tutorials:** https://agentpy.readthedocs.io/en/latest/tutorials.html

**Requirements:** Python 3, NumPy, scipy, matplotlib, networkx, pandas, SALib, and ipywidgets.

Expand Down
31 changes: 20 additions & 11 deletions agentpy/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,19 @@

class experiment():

""" Experiment for an agent-based model. Can also be called as exp().
""" Experiment for an agent-based model.
Allows for multiple iterations, parameter samples, and distict scenarios.
Arguments:
model(class): The model that the experiment should use.
parameters(dict or list): Parameters or parameter sample.
name(str,optional): Name of the experiment. Takes model name at default.
scenarios(str or list,optional): Scenarios that should be tested, if any.
iterations(int,optional): How often to repeat the experiment. Default 1.
iterations(int,optional): How often to repeat the experiment (default 1).
output_vars(bool,optional): Whether to record dynamic variables. Default False.
display(bool,optional): Whether to display simulation progress. Default False.
Attributes:
output(data_dict): Recorded experiment data
"""

Expand Down Expand Up @@ -67,8 +70,16 @@ def __init__( self,

def run(self, display=True):

""" Performs the experiment and generates `output`. """
""" Executes the simulation of the experiment.
It will run the model once for each set of parameters,
and will repeat this process for each iteration.
Arguments:
display(bool,optional): Whether to display simulation progress (default True).
Returns:
data_dict: Recorded experiment data, also stored in `experiment.output`.
"""
parameter_sample = make_list(self.parameters,keep_none=True)
scenarios = make_list(self.scenarios,keep_none=True)
runs = parameter_sample * self.iterations
Expand Down Expand Up @@ -183,13 +194,11 @@ def sample(param_ranges,mode='discrete',**kwargs):
"""
Returns parameter sample (list of dict)
Arguments
---------
param_ranges: dict
mode: str
'discrete' - tuples are given of style (value1,value2,...)
'saltelli' - tuples are given of style (min_value,max_value)
Arguments:
param_ranges(dict)
mode(str): Sampling method. Options are:
'discrete' - tuples are given of style (value1,value2,...);
'saltelli' - tuples are given of style (min_value,max_value)
"""

if mode == 'discrete': parameters = create_sample_discrete(param_ranges,**kwargs)
Expand Down
Loading

0 comments on commit 22baf8c

Please sign in to comment.