Skip to content

Commit

Permalink
Fix docstring (#191)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiroaki Imoto authored Sep 6, 2022
1 parent 7fc8a6a commit 0101941
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
12 changes: 6 additions & 6 deletions biomass/construction/text2model.py
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,7 @@ def register_word(
Parameters
----------
terminology : Dict[str, List[str]], optional
Rule to which users register a new rule word and list of user-defined rule words.
Pair of reaction rule and user-defined rule words.
Examples
--------
Expand Down Expand Up @@ -967,7 +967,7 @@ def static_plot(
) -> None:
"""Saves a static image of the network.
Static image is created using pygraphviz.
Static image is created using ``pygraphviz``.
Parameters
----------
Expand Down Expand Up @@ -1019,17 +1019,17 @@ def dynamic_plot(
which_controls: Optional[List[str]] = None,
) -> None:
"""Saves a dynamic and interactive image of the network graph.
Graph is read by pyvis. Using pyvis a dynamic and interactive representation of the biological network
Graph is read by ``pyvis``. Using ``pyvis`` a dynamic and interactive representation of the biological network
is created in html format.
Parameters
----------
show: bool, default=True
If true the plot will immediately be displayed in the webbrowser.
If :obj:`True` the plot will immediately be displayed in the webbrowser.
annotate_nodes : bool, default=True
If true nodes will be scaled according to number of edges and hovering over a node will show interaction partners.
If :obj:`True` nodes will be scaled according to number of edges and hovering over a node will show interaction partners.
show_controls : bool, default=False
If true control buttons will be displayed.
If :obj:`True` control buttons will be displayed.
which_controls : List(str), optional, default=None
Used to specify which control buttons should be displayed. If empty all buttons will be displayed.
Expand Down
10 changes: 5 additions & 5 deletions biomass/estimation/optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ class Optimizer(object):
Examples
--------
>>> from scipy.optimize import differential_evolution
>>> from biomass import Model
>>> from biomass.estimation import ExternalOptimizer
>>> from biomass import create_model
>>> from biomass.estimation import Optimizer
>>> from biomass.models import Nakakuki_Cell_2010
>>> model = Model(Nakakuki_Cell_2010.__package__).create()
>>> model = create_model(Nakakuki_Cell_2010.__package__)
>>> param_idx = 1
>>> optimizer = ExternalOptimizer(model, differential_evolution, param_idx)
>>> optimizer = Optimizer(model, differential_evolution, param_idx)
>>> def obj_fun(x):
... '''Objective function to be minimized.'''
... return optimizer.get_obj_val(x)
Expand Down Expand Up @@ -217,7 +217,7 @@ def generate(self, n_proc: int = 1, progress: bool = False) -> np.ndarray:
Returns
-------
population : numpy.ndarray
population : ``numpy.ndarray``
Array specifying the initial population.
The array should have shape (M, len(x)),
where M is the total population size and len(x) is the number of parameters.
Expand Down
16 changes: 8 additions & 8 deletions biomass/model_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ class ModelObject(object):
Examples
--------
>>> from biomass import Model
>>> from biomass import create_model
>>> from biomass.models import mapk_cascade
>>> model = Model(mapk_cascade.__package__).create()
>>> model = create_model(mapk_cascade.__package__)
>>> type(model)
<class 'biomass.exec_model.ModelObject'>
<class 'biomass.model_object.ModelObject'>
>>> print('Parameters:', len(model.parameters))
Parameters: 22
>>> print('Species:', len(model.species))
Expand Down Expand Up @@ -73,7 +73,7 @@ def get_individual(self, paramset_id: int) -> np.ndarray:
Returns
-------
best_individual : numpy.ndarray
best_individual : ``numpy.ndarray``
Estimated parameter values.
"""
best_generation = np.load(
Expand Down Expand Up @@ -105,7 +105,7 @@ def load_param(self, paramset: int) -> OptimizedValues:
Returns
-------
optimized_values : OptimizedValues
optimized_values : :class:`biomass.model_object.OptimizedValues`
Optimized parameter/initial values.
"""
best_individual = self.get_individual(paramset)
Expand Down Expand Up @@ -151,12 +151,12 @@ def gene2val(self, indiv_gene: np.ndarray) -> np.ndarray:
Parameters
----------
indiv_gene : ``numpy.ndarray```
indiv_gene : ``numpy.ndarray``
Individual gene.
Returns
-------
indiv_values : ``numpy.ndarray```
indiv_values : ``numpy.ndarray``
Corresponding values.
"""
bounds = self.problem.get_region()
Expand All @@ -169,7 +169,7 @@ def get_obj_val(self, indiv_gene: np.ndarray) -> float:
Parameters
----------
indiv_gene : numpy.ndarray
indiv_gene : ``numpy.ndarray``
Genes, not parameter values.
Returns
Expand Down

0 comments on commit 0101941

Please sign in to comment.