Search found 217 matches

by ramcdougal
Tue May 12, 2020 9:08 am
Forum: NEURON + Python
Topic: range morphology and mechanism syntax for sections in python
Replies: 9
Views: 2298

Re: range morphology and mechanism syntax for sections in python

You'd have to do it with a for loop. Here's a generic function that does this for you: def range_assignment(sec, var, start, stop): """linearly assign values between start and stop to each segment.var in section""" import numpy as np for seg, val in zip(sec, np.linspace...
by ramcdougal
Fri May 08, 2020 5:02 pm
Forum: Other tools
Topic: convergence failed repeatedly or with |h|=hmin : err=-7
Replies: 1
Views: 945

Re: convergence failed repeatedly or with |h|=hmin : err=-7

The integration advance failed, even when it tried using a really tiny timestep. One possible cause of this is when some of your state variables have found themselves in an invalid place. You could try reducing the atol to see if that helps, because it'll force the system to more carefully track val...
by ramcdougal
Wed Apr 29, 2020 6:01 pm
Forum: NEURON + Python
Topic: using compiled mod files from python script in a different direcory
Replies: 2
Views: 2231

Re: using compiled mod files from python script in a different direcory

When you run nrnivmodl on macOS (and I assume Linux, but I didn't check), it puts the compiled version of the mod files in the x86_64/.libs/libnrnmech.so file. (You won't see this if you just do an "ls" because macOS and Linux hide file and folder names beginning with a . by default but yo...
by ramcdougal
Thu Apr 09, 2020 12:31 am
Forum: The GUI
Topic: PlotShape colormap
Replies: 1
Views: 999

Re: PlotShape colormap

The documentation says that colormaps are local by default. If they're not, maybe you could try explicitly setting/unsetting the global flag when you define the size of your colormap before setting its values. For what it's worth, you can change the default colormap for all of your plotshapes by edi...
by ramcdougal
Thu Apr 09, 2020 12:13 am
Forum: NEURON + Python
Topic: Record from multiple neurons
Replies: 2
Views: 795

Re: Record from multiple neurons

The basic sequence is to: (1) for each location, create a vector and do the record; (2) finitialize (this is done automatically if you use run() (h.run() in Python)); (3) simulate for some time; then (4) store the results as you wish. With respect to (1), you are only ever creating a single vector. ...
by ramcdougal
Tue Apr 07, 2020 7:45 am
Forum: OS X
Topic: NRNGUI not working from command line after switch to zsh
Replies: 10
Views: 2016

Re: NRNGUI not working from command line after switch to zsh

No.

nrngui is actually a script that begins by loading the compiled mod files (that's the x86_64/special file), if any, before giving you a prompt.
by ramcdougal
Sat Apr 04, 2020 4:55 pm
Forum: NEURON + Python
Topic: Copy a nrn object in Python?
Replies: 5
Views: 1262

Re: Copy a nrn object in Python?

Here's a simple example of using os.fork() to do the first part of a simulation once and then explore two different options; this launches a new process not a new thread, so the GIL does not apply: from neuron import h from neuron.units import ms, mV import matplotlib.pyplot as plt import os h.load_...
by ramcdougal
Fri Apr 03, 2020 5:56 pm
Forum: NEURON + Python
Topic: Copy a nrn object in Python?
Replies: 5
Views: 1262

Re: Copy a nrn object in Python?

If you're running a single process simulation on Linux or Mac, an alternative strategy is to just do an os.fork() once everything has been run for however long, and have each fork test a different variant afterwards. e.g. You might simulate for a 1000 * ms, then os.fork(), then in one fork simulate ...
by ramcdougal
Thu Apr 02, 2020 9:47 am
Forum: NEURON + Python
Topic: NetStim and NetCon
Replies: 3
Views: 1075

Re: NetStim and NetCon

Yes. If you're specifying each cell's inputs separately, as Ted pointed out, you can use VecStim (defined in vecevent.mod , which you'd have to include in your model and compile like any other mod file). Here's an example, showing three inputs, two of which are able to cause a spike, one of which oc...
by ramcdougal
Wed Apr 01, 2020 2:09 pm
Forum: OS X
Topic: NRNGUI not working from command line after switch to zsh
Replies: 10
Views: 2016

Re: NRNGUI not working from command line after switch to zsh

Looks like you need to recompile the mod files. It remembers the version of NEURON that was used to compile things.
by ramcdougal
Wed Mar 25, 2020 3:10 pm
Forum: Other questions
Topic: Problem with fscan (SOLVED)
Replies: 2
Views: 691

Re: Problem with fscan

fscan is a function used for a single file opened with the ropen function (File.ropen is different).

If you are instead using the File class, then you'll want the scanvar method instead.
by ramcdougal
Wed Mar 18, 2020 10:12 am
Forum: Getting started
Topic: Is Mersenne Twister RNG available in NEURON
Replies: 2
Views: 750

Re: Is Mersenne Twister RNG available in NEURON

Random123 is a high-quality PRNG available from Python/HOC/NMODL in NEURON. It has the additional advantage of providing a large number of independent random streams parameterized by 3 numbers; this is extremely convenient for creating reproducible randomness that works in a parallel computing envi...
by ramcdougal
Sun Mar 15, 2020 6:36 pm
Forum: Other questions
Topic: Action Potential propagation
Replies: 3
Views: 901

Re: Action Potential propagation

1. Point models are fine. If you want biophysical kinetics, just use a section with nseg=1. If you want something more like an integrate-and-fire type cell, use one of the built-in types (e.g. IntFire, IntFire2, IntFire4), find one on ModelDB, or create your own with a MOD file of type ARTIFICIAL_CE...
by ramcdougal
Sun Mar 15, 2020 11:32 am
Forum: Modeling networks
Topic: Incorporating a firing model to induce different stages of sleep
Replies: 14
Views: 1905

Re: Incorporating a firing model to induce different stages of sleep

Dereference a NEURON pointer using [0]. e.g.

Code: Select all

>>> from neuron import h
>>> h.t = 17
>>> print(h._ref_t[0])
17.0
This also works in C/C++; the way to think of it is that referring to an array is the same as referring to a block of memory.
by ramcdougal
Sun Mar 15, 2020 11:28 am
Forum: OS X
Topic: NRNGUI not working from command line after switch to zsh
Replies: 10
Views: 2016

Re: NRNGUI not working from command line after switch to zsh

Zsh has two things that are roughly equivalent to .bashrc (and .bash_profile): .zshrc and .zshenv (both of these files go in your home folder; they may or may not already be there). .zshrc is only used by interactive shells, and .zshenv is used by all shells, interactive or not. Thus you probably wa...