CoreNeuron
CoreNeuron copied to clipboard
Make sure patternstim input file has gid as integers
See this internal JIRA ticket :
User has input file:
/scatter
1000.15876308 221273.0
1000.16120151 221145.0
1000.1612057 221043.0
The second column is gid and it should be integer form i.e.
1000.15876308 221273
1000.16120151 221145
1000.1612057 221043
We should change implementation in https://github.com/BlueBrain/CoreNeuron/blob/5f1c036c14535ef225470d8bba16036dbfd64374/coreneuron/mechanism/patternstim.cpp#L140
Possible solutions:
- if not an integer, throw an error
- read as double, if it's integer then it's fine. Otherwise thrown an error
Hi Pramod sir, could I work on this?
What we have to do?Ccannot understand please help.SIr
hello @muhdmud @singhshivansh244,
sorry for delay here. Let me explain how to reproduce and fix the issue:
- build coreneuron:
# clone repo, create build dir and compile coreneuron
git clone https://github.com/BlueBrain/CoreNeuron coreneuron
mkdir coreneuron/build && cd coreneuron/build
cmake .. -DCMAKE_INSTALL_PREFIX=`pwd`/install -DCORENRN_ENABLE_MPI=OFF
make -j
- create sample pattern.dat stimulus input file:
echo "/scatter" > pattern.dat
echo "10.15876308 221273.0" >> pattern.dat
echo "1000.16120151 221145.0" >> pattern.dat
note that second column is floating point value instead of integer:
$ cat pattern.dat
/scatter
10.15876308 221273.0
1000.16120151 221145.0
- now we can run coreneuron with pattern.dat from build directory:
./bin/x86_64/special-core --tstop 100 --datpath=../tests/integration/ring/ --pattern=./pattern.dat
- now if you look at https://github.com/BlueBrain/CoreNeuron/blob/5f1c036c14535ef225470d8bba16036dbfd64374/coreneuron/mechanism/patternstim.cpp#L140, the second value is read as integer with
%d
. In our case, the second column is float (containing integer value) and parsing this with %d is error prone.
So what one can do is:
- read the value as double (%lf)
- if the value read is non-integer : throw an error and abort program
- if value contains integer then static_cast it to int and push to spikes vector
(I think std::modf can be used?)
So,Sir what I have to do is,change "%d" to "%lf" and add if condition to check var is int or float?? If yes then I can do it.