Skip to content

Commit

Permalink
automatic model characterisation and doc generator
Browse files Browse the repository at this point in the history
  • Loading branch information
C.A.P. Linssen committed May 14, 2024
1 parent 0e2a980 commit 877ef4f
Show file tree
Hide file tree
Showing 110 changed files with 7 additions and 5 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
12 changes: 7 additions & 5 deletions extras/nestml_model_doc_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@ class NESTMLModelDocGenerator:

def __init__(self):
self.model_doc_rst = ""
self.base_dir = os.path.join("doc", "models_library")
os.mkdir(self.base_dir)

def generate_all_models(self):
codegen_opts = {}

generate_nest_target(input_path=["models/neurons"],
target_path="/tmp/nestml-autodoc",
target_path=os.path.join(self.base_dir, "nestml-autodoc-target"),
logging_level="DEBUG",
module_name="nestml_autodoc_module",
suffix="_nestml",
Expand Down Expand Up @@ -141,15 +143,15 @@ def _test_model_current_pulse(self, model_name, I_min=-100E-12, I_max=500E-12, N

ax[-1].set_xlabel("Time [ms]")

plt.savefig("/tmp/nestml_current_pulse_response_[" + model_name + "].png")
plt.savefig(os.path.join(self.base_dir, "nestml_current_pulse_response_[" + model_name + "].png"))
plt.close(fig)


def _test_model_fI_curve(self, model_name, model_opts=None, model_initial_state=None):
r"""Make f-I curve"""
t_stop = 1000. # [ms]

I_stim_vec = np.linspace(10E-12, 1E-9, 20) # [A] XXX: should be 100 points
I_stim_vec = np.linspace(10E-12, 1E-9, 100) # [A]
rate = float("nan") * np.ones_like(I_stim_vec)
for i, I_stim in enumerate(I_stim_vec):
nest.ResetKernel()
Expand Down Expand Up @@ -195,7 +197,7 @@ def _test_model_fI_curve(self, model_name, model_opts=None, model_initial_state=
ax[0].set_xlabel(r"$I_\text{stim}$ [pA]")
plt.tight_layout()

plt.savefig("/tmp/nestml_fI_curve_[" + model_name + "]" + fname_snip + ".png")
plt.savefig(os.path.join(self.base_dir, "nestml_fI_curve_[" + model_name + "]" + fname_snip + ".png"))
plt.close(fig)

def _test_model_psp(self, model_name, max_weight: float = 10., model_opts=None,
Expand Down Expand Up @@ -245,7 +247,7 @@ def _test_model_psp(self, model_name, max_weight: float = 10., model_opts=None,
ax[0].set_ylabel("$V_m$ [mV]")
plt.tight_layout()

plt.savefig("/tmp/nestml_psp_[" + model_name + "]" + fname_snip + ".png")
plt.savefig(os.path.join(self.base_dir, "nestml_psp_[" + model_name + "]" + fname_snip + ".png"))
plt.close(fig)

def generate_synapse_models_documentation(self, models):
Expand Down

0 comments on commit 877ef4f

Please sign in to comment.