Open NEURON in a new terminal together with arguments

Post Reply
MBeining
Posts: 32
Joined: Thu Apr 03, 2014 8:18 am

Open NEURON in a new terminal together with arguments

Post by MBeining » Sat May 13, 2017 5:49 pm

Hello there,
I am having currently a trouble in opening NEURON together with arguments in a new terminal.

For example I want to tell NEURON to open without banner and to run a hoc file called "test.hoc".

I tried

Code: Select all

open -a terminal nrniv -nobanner test.hoc
but this is not working because the arguments are not given to nrniv but to the terminal (also --args does not work).
Another hack I did was to make a temporary shell script and start it:

Code: Select all

echo "cd  NEURONPATH; nrniv -nobanner HOCPATH/test.hoc" > tmp.sh; chmod +x tmp.sh; open -a terminal tmp.sh; rm tmp.sh
This actually starts NEURON in a new terminal and runs it, however it closes at the moment the simulation run is over because shell scripts are instantly closed after execution.

Any ideas what could help?

You might ask why I want to do this. Actually I want to start NEURON from Matlab together with arguments. This works perfectly on Windows with the system call but does not work on Mac because no terminal is opened (only the nrngui menu bar is visible).

PS: If someone knows how this works on Linux, I would also be interested in knowing ;-)

Thanks alot!

ted
Site Admin
Posts: 5091
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Open NEURON in a new terminal together with arguments

Post by ted » Sun May 14, 2017 12:00 pm

Code: Select all

echo "cd  NEURONPATH; nrniv -nobanner HOCPATH/test.hoc" > tmp.sh; chmod +x tmp.sh; open -a terminal tmp.sh; rm tmp.sh
This actually starts NEURON in a new terminal and runs it, however it closes at the moment the simulation run is over because shell scripts are instantly closed after execution.
I'd expect that changing

Code: Select all

nrniv -nobanner HOCPATH/test.hoc
to

Code: Select all

nrniv -nobanner HOCPATH/test.hoc -
would prevent NEURON from exiting after executing test.hoc. Or is it your aim for NEURON to exit but leave the terminal open with its working directory being the directory that contains test.hoc?

MBeining
Posts: 32
Joined: Thu Apr 03, 2014 8:18 am

Re: Open NEURON in a new terminal together with arguments

Post by MBeining » Mon May 15, 2017 4:37 am

Thanks Ted for the fast reply and help!
My goal is that NEURON stays open. Indeed, the minus sign helps!
First I did not suceed using it because it seems to not be possible to copy the Std and Error output of nrniv to a txt file at the same time (using "> outp.txt 2> error.txt") but as the user should see this output anyway in the NEURON terminal, I can leave this out ;-)

Post Reply