Open pramodk opened 4 years ago
There was a very early proposal described in an issue in neuronsimulator/nrn
:
https://github.com/neuronsimulator/nrn/issues/239
To my shame I was unaware of neuronsimulator/nrn#239 . It looks very good and very clean. No VERBATIM blocks remain! And I think similar things could be done with
VECTOR vec
This could be implemented in nocmodl but if new nmodl is coming to NEURON sooner rather than later...
The ticket on the neuron repo has been quite a bit extended with lots of details towards having a complete specification.
As a first step I will try to add the parsing of such declarations
RANDOM DISTRIBUTION(param_1, ..., param_n) varname_1, ..., varname_m
Some implementation notes for the discussion:
Considering the example:
RANDOM UNIFORM(0.0, 1.0) ur1, ur2
neuron_statement RANDOM NAME_PTR "(" expression_list ")" random_var_list
RandomVar
we are not storing any information about the distribution type etc.Seems sufficient to begin an implementation. Note that I presume this will NOT make use of the interpreter Random. Currently, nrnran123.h supports
DiscreteUniform( 0 to 2**32 - 1)
Uniform(0.0 to 1.0) (I'm not sure but I think there are either 2**32 or (2**32 - 1)distinct values)
/* nrnran123_dblpick minimum value is 2.3283064e-10 and max value is 1-min */
NegExp (mean 1.0)
/* nrnran123_negexp min value is 2.3283064e-10, max is 22.18071 */
Normal (mean 0.0, stddev 1.0)
Correct, this will not use interpreter random, but the distribution arguments can be set via parameters. Thanks for sharing the available distributions in random123, then we'll make sure to support those directly. Actually a start of an implementation is already in a branch. Will report back when this gets a bit further along...
Here's also a gist with example code the way it could look like when generated: https://gist.github.com/ohm314/1d47a6cfecc6f71d238161358aaf59d1
@ohm314 : During Yale visit last year we put together a draft PR (or temporary branch). Could you link that here?