Skip to content
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

Update quickstart and the analysis module #229

Merged
merged 4 commits into from
May 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions brainpy/analysis/lowdim/lowdim_analyzer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-

import warnings
from functools import partial

import numpy as np
Expand Down Expand Up @@ -152,6 +152,10 @@ def __init__(self,
for key, lim in self.target_pars.items():
self.resolutions[key] = bm.linspace(*lim, 20)
elif isinstance(resolutions, float):
warnings.warn('The `resolutions` is specified to all parameters and variables. '
'Analysis computation may occupy too much memory if `resolutions` is small. '
'Please specify `resolutions` by dict, such as resolutions={"V": 0.1}.',
category=UserWarning)
for key, lim in self.target_vars.items():
self.resolutions[key] = bm.arange(*lim, resolutions)
for key, lim in self.target_pars.items():
Expand All @@ -163,7 +167,7 @@ def __init__(self,
if key in self.target_par_names:
continue
raise errors.AnalyzerError(f'The resolution setting target "{key}" is not found in '
f'the target variables {self.target_var_names} and '
f'the target variables {self.target_var_names} or '
f'the target parameters {self.target_par_names}.')
for key in self.target_var_names + self.target_par_names:
if key not in resolutions:
Expand Down
2 changes: 1 addition & 1 deletion brainpy/analysis/utils/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def model_transform(model):
if not isinstance(intg, ODEIntegrator):
raise errors.AnalyzerError(f'Must be the instance of {ODEIntegrator}, but got {intg}')
elif isinstance(model, DynamicalSystem):
model = tuple(model.ints().subset(ODEIntegrator).unique().values())
model = tuple(model.nodes(level=-1).subset(ODEIntegrator).unique().values())
else:
raise errors.UnsupportedError(f'Dynamics analysis by symbolic approach only supports '
f'list/tuple/dict of {ODEIntegrator} or {DynamicalSystem}, '
Expand Down
Binary file added docs/_static/dmnet_diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
459 changes: 433 additions & 26 deletions docs/quickstart/simulation.ipynb

Large diffs are not rendered by default.

227 changes: 140 additions & 87 deletions docs/tutorial_analysis/lowdim_analysis.ipynb

Large diffs are not rendered by default.