basins_of_attraction¶
- compute_basins(attractors: dict, weak: bool = True, strong: bool = True, cycle_free: bool = True, fname_barplot: Optional[str] = None, fname_piechart: Optional[str] = None, minimize: bool = False) Optional[dict] ¶
Extends attractors with basin of attraction. Use fname_barplot and FnamePiechart to create plots of the basins, see create_barplot and basins_create_piechart.
- arguments:
attractors: json attractor data, see attractors_compute_json
weak: compute weak basins
strong: compute strong basins
cycle_free: compute cycle-free basins
fname_barplot: file name of bar plot
fname_piechart: file name of pie chart
minimize: minimize the Boolean expressions
example:
>>> primes = get_primes("raf") >>> attractors = compute_attractors(primes, update) >>> compute_basins(attractors)
- create_basins_of_attraction_barplot(attractors: dict, fname_image: str, title: Optional[str] = None, y_unit: Optional[str] = 'perc', y_max: Optional[str] = None, labels_map: Optional[callable] = None)¶
Creates a bar plot of the basins of attraction specified in attractors. Requires that attractors has been extended with basins information by compute_basins. Requires https://matplotlib.org.
- arguments:
attractors: json attractor data, see attractors_compute_json
fname_image: create image for bar plot
title: optional title of plot
Yunit: “perc” for percentage of state space and “size” for number of states
Ymax: y axis limit
LabelsMap (function): a map from minimal trap space dictionary of attractor to label str
example:
>>> attractors = compute_attractors(primes, update) >>> compute_basins(attractors) >>> create_basins_of_attraction_barplot(attractors, "barplot.pdf") created barplot.pdf
- create_basins_piechart(attractors: dict, fname_image: str, title: Optional[str] = None, y_unit: Optional[str] = 'perc', labels_map: Optional[callable] = None)¶
Creates a pie chart of the basins of attraction specified in attractors. Requires that attractors has been extended with basins information by compute_basins. Requires https://matplotlib.org.
- arguments:
attractors: json attractor data, see attractors_compute_json
fname_image: create image for pie chart
title: optional title of plot
y_unit: “perc” for percentage of state space and “size” for number of states
labels_map: a map from minimal trap space dictionary of attractor to label str
example:
>>> attractors = compute_attractors(primes, update) >>> compute_basins(attractors) >>> create_basins_piechart(attractors, "piechart.pdf") created piechart.pdf
- cycle_free_basin(primes: dict, update: str, subspace: Union[dict, str] = {}, minimize: bool = False)¶
Computes the cycle-free basin of subspace via the CTL query AG(EF(Subspace)), for details see Klarner2018.
arguments: * primes: prime implicants * update: the update strategy, one of “asynchronous”, “synchronous”, “mixed” * minimize: minimize the Boolean expressions * subspace: a subspace
returns: * basin: with keys “size”=number of states, “formula”=state formula and “perc”=percentage of state space
example:
>>> cycle_free_basin(primes, update, True, "0---1")
{“size”: 134, “formula”: “Erk & !Raf | Mek”, “perc”: 12.89338}
- strong_basin(primes, update, subspace: Union[dict, str] = {}, minimize: bool = False)¶
Computes the strong basin of subspace via the CTL query AG(EF(Subspace)), for details see Klarner2018.
- arguments:
primes: prime implicants
update: the update strategy, one of “asynchronous”, “synchronous”, “mixed”
minimize: minimize the Boolean expressions
subspace: a subspace
- returns:
basin: with keys “size”=number of states, “formula”=state formula and “perc”=percentage of state space
example:
>>> strong_basin(primes, update, True, "0---1") {"size": 134, "formula": "Erk & !Raf | Mek", "perc": 12.89338}
- weak_basin(primes: dict, update: str, subspace: Union[dict, str] = {}, minimize: bool = False)¶
Computes the weak basin of subspace via the CTL query AG(EF(Subspace)), for details see Klarner2018.
- arguments:
primes: prime implicants
update: the update strategy, one of “asynchronous”, “synchronous”, “mixed”
minimize: minimize the Boolean expressions
subspace: a subspace
- returns:
basin: with keys “size”=number of states, “formula”=state formula and “perc”=percentage of state space
example:
>>> weak_basin(primes, update, "0---1", True) {"size": 134, "formula": "Erk & !Raf | Mek", "perc": 12.89338}