Skip to content

Commit

Permalink
Merge pull request #390 from DiODeProject/issue-389-385-graphics-params
Browse files Browse the repository at this point in the history
Close #389
  • Loading branch information
jarmarshall committed Mar 15, 2020
2 parents 987a162 + 97f148d commit b30e9ed
Show file tree
Hide file tree
Showing 4 changed files with 153 additions and 115 deletions.
34 changes: 30 additions & 4 deletions docs/MuMoTuserManual.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1141,7 +1141,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"##### Advanced options for `SSA`\n",
"##### Advanced options for `SSA` and `multiagent`\n",
"<a id='advoptionsSSA'></a>\n",
"\n",
"* `initialState`: proportion of each reactant at timestep zero: remember that the sum of all (non-constant) reactants must be 1.0\n",
Expand All @@ -1165,7 +1165,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"##### Advanced options for `multiagent`\n",
"##### Advanced options for `multiagent` only\n",
"<a id='advoptionsmulti'></a>\n",
"\n",
"`multiagent` views have all the options described above for the `SSA` simulations and, in addition:\n",
Expand All @@ -1176,7 +1176,7 @@
" * `barabasi-albert`: Random network with Barabasi-Albert topology. The widgets allow to specify:\n",
" * `netParam`: the number of edges every new node (during creation) is linked to\n",
" * `dynamic`: Simulation of moving particles in which agent move in a periodic space and interact locally. The widgets allow to specify:\n",
" * `netParam`: range of interaction of the agent\n",
" * `netParam`: range of interaction of the agent (radius)\n",
" * `motionCorrelatedness`: motion correlatedness of the agent. Correlatedness = 1 correponds to straight movement, Correlatedness = 0 corresponds to uncorrelated random walk.\n",
" * `particleSpeed`: speed of the agent, i.e. displacement in one timestep\n",
" * `showTrace`: flag to show the motion trajectory of the agents\n",
Expand Down Expand Up @@ -1271,6 +1271,7 @@
"\n",
"##### Keyword arguments for `SSA()` and `multiagent()`\n",
"\n",
"- valid for both methods:\n",
"\n",
" - `params = None`: list of parameters defined as pairs ('parameter name', value), see [Partial controllers](#partialcont). Rates defaults to `mumot.MuMoTdefault._initialRateValue`, system size defaults to `mumot.MuMoTdefault._systemSize`\n",
"\n",
Expand All @@ -1293,9 +1294,34 @@
" - `runs = 1`: number of simulation runs to be executed, must be strictly positive\n",
"\n",
" - `aggregateResults = True`: aggregate the results from multiple runs, accepts True or False\n",
" \n",
" - `legend_fontsize = 14`: specify fontsize of legend (type: integer)\n",
"\n",
" - `legend_loc = 'upper left'`: specify legend location: combinations like 'upper left', 'lower right', or 'center center' are allowed (9 options in total)\n",
"\n",
" - `fontsize = None`: specify fontsize for axis-labels, accepts integer, if not given fontsize is automatically derived from length of axis label\n",
"\n",
" - `xlab = 'time t'`: specify label on x-axis (type: str), if given replaces default\n",
"\n",
" - `ylab = 'noise correlations'`: specify label on y-axis (type: str), if given replaces default\n",
"\n",
" - `choose_xrange = None`: specify range plotted on x-axis; usage: `choose_xrange=[xmin, xmax]`, xmin and xmax are of type: float, if not given uses data values to set axis limits\n",
"\n",
" - `choose_yrange = None`: specify range plotted on y-axis; usage: `choose_xrange=[ymin, ymax]`, ymin and ymax are of type: float, if not given uses data values to set axis limits\n",
"\n",
" - `silent = False`: switch off widgets and plot, important for use with multicontrollers\n",
"\n",
"\n",
"- valid only for `multiagent()`:\n",
"\n",
" - `netType = 'full'`: type of network. Available types are: `full`, `erdos-renyi`, `barabasi-albert`, `dynamic` (see more information about their meaning above)\n",
" - `netParam`: this parameters has a specific meaning depending on the `netType`, see details above\n",
" - `motionCorrelatedness = 0.5`: (only for `netType`== `dynamic`) motion correlatedness of the agent. Correlatedness = 1 correponds to straight movement, Correlatedness = 0 corresponds to uncorrelated random walk.\n",
" - `particleSpeed = 0.01`: (only for `netType`== `dynamic`) speed of the agent, i.e. displacement in one timestep\n",
" - `showTrace = False`: (only for `netType`== `dynamic`) flag to show the motion trajectory of the agents\n",
" - `showInteractions = False`: (only for `netType`== `dynamic`) flag to show interactions; agents within communication range are liked through a line\n",
" - `timestepSize`: length of one timestep; the maximum timestep is determined by the rates\n",
"\n",
"##### Keyword arguments for `integrate()` and `noiseCorrelations()`\n",
"\n",
"- valid for both methods:\n",
Expand Down Expand Up @@ -1856,7 +1882,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.4"
"version": "3.7.4"
},
"toc": {
"base_numbering": 1,
Expand Down
15 changes: 15 additions & 0 deletions mumot/controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1023,6 +1023,21 @@ def __init__(self, controllers, params=None, initWidgets=None, **kwargs):
inputValue = kwargs.get(key)
ep1 = None
ep2 = None
if key == 'xlab':
for controller in controllers:
controller._view._xlab = kwargs.get('xlab')
if key == 'ylab':
for controller in controllers:
controller._view._ylab = kwargs.get('ylab')
if key == 'fontsize':
for controller in controllers:
controller._view._axes_font_size = kwargs.get('fontsize')
if key == 'legend_loc':
for controller in controllers:
controller._view._legend_loc = kwargs.get('legend_loc')
if key == 'legend_fontsize':
for controller in controllers:
controller._view._legend_fontsize = kwargs.get('legend_fontsize')
if key == 'choose_yrange':
for controller in controllers:
controller._view._chooseYrange = kwargs.get('choose_yrange')
Expand Down
24 changes: 23 additions & 1 deletion mumot/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ def integrate(self, showStateVars=None, initWidgets=None, **kwargs):
variables (at time t=0) sum up to 1, or not. Defaults to False.
legend_fontsize: int, optional
Specify fontsize of legend. Defaults to 14.
legend_loc : str
legend_loc : str, optional
Specify legend location: combinations like 'upper left' (default),
'lower right', or 'center center' are allowed (9 options in total).
fontsize : integer, optional
Expand Down Expand Up @@ -1461,6 +1461,18 @@ def multiagent(self, initWidgets=None, **kwargs):
(active only for netType='dynamic') flag to plot the trajectory of each reactant. Defaults to False.
showInteractions : bool, optional
(active only for netType='dynamic') flag to plot the interaction range between particles. Defaults to False.
legend_fontsize: int, optional
Specify fontsize of legend. Defaults to 14.
legend_loc : str, optional
Specify legend location: combinations like 'upper left' (default), 'lower right', or 'center center' are allowed (9 options in total).
fontsize : integer, optional
Specify fontsize for axis-labels. If not specified, the fontsize is automatically derived from the length of axis label.
xlab : str, optional
Specify label on x-axis. Defaults to 'time t'.
ylab : str, optional
Specify label on y-axis. Defaults to 'reactants'.
choose_xrange : list of float, optional
Specify range plotted on x-axis as a two-element iterable of the form [xmin, xmax]. If not given uses data values to set axis limits.
silent : bool, optional
Switch on/off widgets and plot. Important for use with multicontrollers. Defaults to False.
Expand Down Expand Up @@ -1625,6 +1637,16 @@ def SSA(self, initWidgets=None, **kwargs):
Number of simulation runs to be executed. Must be strictly positive. Defaults to 1.
aggregateResults : bool, optional
Flag to aggregate or not the results from several runs. Defaults to True.
legend_loc : str, optional
Specify legend location: combinations like 'upper left' (default), 'lower right', or 'center center' are allowed (9 options in total).
fontsize : integer, optional
Specify fontsize for axis-labels. If not specified, the fontsize is automatically derived from the length of axis label.
xlab : str, optional
Specify label on x-axis. Defaults to 'time t'.
ylab : str, optional
Specify label on y-axis. Defaults to 'reactants'.
choose_xrange : list of float, optional
Specify range plotted on x-axis as a two-element iterable of the form [xmin, xmax]. If not given uses data values to set axis limits.
silent : bool, optional
Switch on/off widgets and plot. Important for use with multicontrollers. Defaults to False.
Expand Down
Loading

0 comments on commit b30e9ed

Please sign in to comment.