Closed dnao closed 6 years ago
@dnao I had a short look through your code. I think the problem is because you forgot the module files among the sources in CMakeLists.txt. Here, you need to add betacond.h
and betacond.cpp
. You also need to rename mymodule.cpp
to betacond.cpp
.
Another problem is in
betacond::commandstring()
:
const std::string
mynest::betacond::commandstring( void ) const
{
// Instruct the interpreter to load betacond-init.sli
return std::string( "(betacond-init) run" );
}
This tells NEST to run betacond-init.sli
when loading the module, but the file in your sli directory is called betacond.sli
. You should rename that file to betacond-init.sli
. But that does not cause the problem you describe, since the SLI initialization code is only run at a later stage.
The second type of error you get seems to be about PyNEST not properly handling non-ascii characters in error messages returned by the NEST core. I will open a separate issue for that.
If this solves the issue, please close it. If not, please try first to build and install the example MyModule
to see if the module mechanism works in principle on your machine. Also, please report your configuration. It might be a good idea to continue the discussion on the NEST User Mailing list.
Thank you @heplesser . I have implemented the changes you have suggested in betacond except now I have an error when I try to run "make" after running cmake.
leonardo:~/opt/betacond-build > make
[ 25%] Building CXX object CMakeFiles/betacond_lib.dir/betacond.cpp.o
/suphys/dnao/opt/nest-simulator/examples/betacond/betacond.cpp:160: error: two or more data types in declaration of ‘init’
make[2]: *** [CMakeFiles/betacond_lib.dir/betacond.cpp.o] Error 1
make[1]: *** [CMakeFiles/betacond_lib.dir/all] Error 2
make: *** [all] Error 2
I am running RHEL7.0 with Anaconda 2.5.0 (Python 2.7.11). I have compiled the latest version of NEST from the master branch. For the MyModule code, I am able to successfully cmake, make, make install and then run nest.Install('MyModule') to view the neuron and synapse models included in it.
There's a superfluous void
in line 155 of betacond.cpp
. Removing that should help.
Thank you @jougs I have implemented the changes in betacond. Hopefully I am nearly there but I have been stuck with this error:
Scanning dependencies of target betacond_lib
[ 25%] Building CXX object CMakeFiles/betacond_lib.dir/betacond.cpp.o
/suphys/dnao/opt/nest-simulator/examples/betacond/betacond.cpp: In member function ‘virtual void mynest::betacond::init(SLIInterpreter*)’:
/suphys/dnao/opt/nest-simulator/examples/betacond/betacond.cpp:164: error: ‘iaf_cond_beta’ was not declared in this scope
/suphys/dnao/opt/nest-simulator/examples/betacond/betacond.cpp:165: error: no matching function for call to ‘nest::ModelManager::register_node_model(const char [14])’
make[2]: *** [CMakeFiles/betacond_lib.dir/betacond.cpp.o] Error 1
make[1]: *** [CMakeFiles/betacond_lib.dir/all] Error 2
make: *** [all] Error 2
I am confused because the error appears to be caused by the iaf_cond_beta
model itself, which is only a slightly modified version of iaf_cond_alpha
(with some new variables). My reasoning behind this is that If I return to the original MyModule, replace of the .cpp/.h files of pif_psc_alpha
with iaf_cond_beta
and replace all references in other files to iaf_cond_beta
, then I still get the same error when i try to run make
. From trying to interpret this error it appears I need to declare iaf_cond_beta
in betacond.cpp, but this is not necessary with pif_psc_alpha
in mymodule.cpp.
@dnao I think this is a namespace problem. You place all declarations in iaf_cond_beta
into namespace nest
, but they should be in namespace mynest
, since they belong to your module. Even better, you should find a new namespace name for your module, so that you module could be loaded together with modules by other users without any name clashes. You need to use the same namespace in the betacond.*
and iaf_cond_beta.*
files.
Note that once you place the declarations and definitions in iaf_cond_beta.*
inside your own namespace, you will need to add nest::
namespace qualifiers to calls to the NEST kernel. Take a careful look at pif_psc_alpha.*
. It places all declarations and definitions in namespace mynest
and has the necessary nest::
qualifiers where needed to access kernel components.
@dnao @heplesser I think it should be easy to generate this sort of model with NESTML. @DimitriPlotnikov and I will do that.
Thank you @heplesser . I have been working through the two files and making namespace changes as appropriate. pif_psc_alpha
provides a good outline but there are a number of differences between the two models (such as the use of GSL and a dynamics function in iaf_cond
models) which have thrown me. My latest compilation runs into the following error which I find strange as the code for the two models is almost identical in this section:
[ 25%] Building CXX object CMakeFiles/betacond_lib.dir/betacond.cpp.o
/suphys/dnao/opt/nest-simulator/examples/betacond/betacond.cpp: In member function ‘virtual void mynest::betacond::init(SLIInterpreter*)’:
/suphys/dnao/opt/nest-simulator/examples/betacond/betacond.cpp:164: error: ‘iaf_cond_beta’ was not declared in this scope
/suphys/dnao/opt/nest-simulator/examples/betacond/betacond.cpp:165: error: no matching function for call to ‘nest::ModelManager::register_node_model(const char [14])’
Also I am wondering whether i need to replace all instances of double_t
with nest::double_t
in lines 174-188, 224, 274, 284, etc of iaf_cond_beta.h
@dnao You have moved everything in iaf_cond_beta.{h,cpp}
into namespace betanest
, but in betacond.{h,cpp}
, you still put things into namespace mynest
. You need to use the same namespace throughout your module.
Concerning double_t
and int_t
: You either need to prefix them with the nest::
namespace qualifier or you can simply replace them by plain C++ double
and int
.
@dnao @ingablundell
I did the initial mapping the iaf_psc_delta ( cf. https://github.com/nest/nestml/blob/master/models/iaf_cond_beta.nestml ) as I found in your fork ( https://github.com/dnao/nest-simulator/blob/condbeta/examples/betacond/iaf_cond_beta.h ). Attached is an example simulation of a single neuron that receives a spike after 200ms:
There is also a description how to use the tooling which is based on docker. Currently, there is a known issue that spikeevents are handled in the conductance based case not correctly ( i.e. in the negative case the weight must be multiplied by -1 )
void iaf_cond_beta_neuron::handle(nest::SpikeEvent &e) {
...
if (weight < 0.0) // inhibitory
{
get_spikeInh().add_value(
e.get_rel_delivery_steps(
nest::kernel().simulation_manager.get_slice_origin()),
weight * multiplicity);
}
}
If you find further problems/issues/improvements just add them the the NESTML issue tracker: https://github.com/nest/nestml/issues
And finally in case you are really use NESTML, it would be kind of you to fill out the following survey: https://www.surveymonkey.co.uk/r/N7LCP3Q
@DimitriPlotnikov Nice work! Could you plot the difference between the solutions to see if there are any minuscule numeric differences?
@heplesser Which solutions do you mean? Currently, more or less very similar code compared to that in NEST is generated (except that there is one unnecessary copy of the state vector before passing it into GSL solver, but it will be improved in during further development).
@DimitriPlotnikov It seemed to me that the plot you inserted above shows a blue and a green line superimposed, with one line from the original NEST code and one from NESTML-generated code. I was thinking of the difference between those two lines.
@heplesser Yes, there are two lines, but they are really same. Do I understand it right: the issues is about adding the iaf_cond_beta to NEST and it is currently not available in NEST? If so I can hardly to the desired comparison.
@DimitriPlotnikov I am confused: You created one line via NESTML and the other using the cond_beta-implementation proposed here, didn't you? When you say "really the same"---how same? Even a single data point differing by 1e-15 mV can in the long run make a difference in a chaotic system. So either the curves are identical (difference is zero everywhere) or they are different. I just want to be sure.
@heplesser the curves are identical.
@dnao what is the status of this issue?
@DimitriPlotnikov I was able to compile your nestML code and run a simulation. I compared it to the iaf_cond_alpha model and found that, when the synaptic time constants are identical (rise time = decay time), there is a small difference between the solutions of the two models. Perhaps this is consistent with the nature of numerical approximation. Here are some figures demonstrating:
Additionally, setting non-zero values for F_E and F_I (new external input parameters in the model) results in a single spike of activity, but no periodic oscillations as would be expected for constant external inputs (eg by setting I_e to some positive value or connecting a DC_generator to a neuron).
Regarding the non-ML version of the model, I have yet to successfully work through all the namespace issues. I can run cmake
but when I try to run make
I'm still getting a lot of errors: make_log
@heplesser Before I proceed with more detailed review, I would like to have an acknowledgment that the model is important enough to be included into NEST repository.
@DimitriPlotnikov Yes, I think we should include this model.
@golosio you already added a multisynapse version of the model. Can we close this issue or do still have problems and/or issues to discuss in this context?
@dnao Can we close this issue?
Closing due to long inactivity.
@dnao https://github.com/dnao I think that a more appropriate place to ask for help about your issue would be the nest user group. If you are not already subscribed you can do it from this page: http://www.nest-simulator.org/community/ If you'll send there your questions together with a link to your piece of code, some other user/developer could help you. I will also try to help you.
2018-06-24 19:08 GMT+02:00 dnao notifications@github.com:
It's been a while but decided to try and revisit this to see if I could make some headway.
One issue I found was that the normalisation factor in Roth and Van Rossum http://homepages.inf.ed.ac.uk/mvanross/reprints/roth_mvr_chap.pdf was not the correct one for my purposes. They normalise the beta function so that it's peak amplitude is 1.0. I need to normalise it so that the integral of the function is 1.0. That is, it needs to be g(t) = (exp(-t/tau_d)-exp(-t/tau_r))/(tau_d-tau_r).
I've got a semi-working version here: iaf_cond_beta.cpp https://github.com/dnao/nest-simulator/blob/master/models/iaf_cond_alpha.cpp but I still have a number of issues I can't resolve:
- Incoming excitatory/inhibitory spikes are flipped; a negative synaptic weight causes an excitatory spike and a positive synaptic weight causes an inhibitory spike, with the appropriate rise/decay time constants.
- Normalisation factor doesn't seem to work - and it seems like the GSL ODE solver is returning a different equation for excitatory and inhibitory conductances!
I find this very confusing because as far as I can tell the code is almost identical to that of iaf_cond_alpha apart from the extra variables.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/nest/nest-simulator/issues/405#issuecomment-399771647, or mute the thread https://github.com/notifications/unsubscribe-auth/ADrHOSGk9xIyY5bivQehKI6D2GAM0H4Mks5t_8ekgaJpZM4I8bTu .
-- Bruno Golosio, PhD Associate Professor of Applied Physics Coordinator of the School of Medical Physics Department of Physics University of Cagliari (Italy)
Hello,
Have finally gotten around to looking into this again. I've made a fork of the repository and created a new model iaf_cond_beta by modifying iaf_cond_alpha.
https://github.com/dnao/nest-simulator
I found this to be much easier than trying to use the other methods to add a new model to nest...
From my testing it seems to be working as required!
If you want to have the model included in the official NEST repository, you can still post a Pull Request. Many thanks and best regards!
I am trying to modify the iaf_cond_alpha module to include two synaptic time constants: the rise and decay time of the post-synaptic conductance, as well as external inputs modeled as a constant conductance term. I have committed these changes in my branch: iaf_cond_beta.cpp and iaf_cond_beta.h
As a first step to testing my code I have attempted to modify the MyModule code to suit this model. The full module is in betacond. I have manged to cmake, make, and install successfully to my nest directory, but I have the following errors when I try to run nest.Install('betacond') from Python:
Occasionally I get this error: