Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Meanfield model #1136

Open
wants to merge 51 commits into
base: meanfield_model
Choose a base branch
from

Conversation

garandel
Copy link

I would like put this on the meanfield_model branch.
That's working in the first order except that sigma_V is not yet to the sqrtk().
I couldn't add sqrtk() because otherwise I overflowed ITCM.

Garandel and others added 30 commits July 28, 2021 11:23
…correct_spikearray_waring

fixed the check for early spikes
…extract_iobuf_during_run

remove extract_iobuf_during_run flag
There's apparently also a crash, but I can't reproduce that locally
…send_sync_repeat

allow for mutliple send_sync
change real error function for an erzate
Do an approxiamtion of 2 over sqrt(pi)
in order to remove the error due to the sqrtk() function.
Start to remove division in the threshold_func().
	modified:   meanfield/models/meanfield_model_impl.h
Set threshold_func() add and remove r_squared() because don't implemented yet.
No removing of division yet.
	modified:   ../../spynnaker/pyNN/models/neuron/builds/meanfield_base.py
	modified:   ../../spynnaker/pyNN/models/neuron/implementations/meanfield_impl_standard.py
	modified:   ../../spynnaker/pyNN/models/neuron/neuron_models/config.py
	modified:   ../../spynnaker/pyNN/models/neuron/neuron_models/meanfield_model_eitn.py

ADD Vi and put it like state_variables
CHANGE muV from state_variables to parameters
	modified:   ../../spynnaker/pyNN/models/neuron/builds/meanfield_base.py
	modified:   ../../spynnaker/pyNN/models/neuron/implementations/meanfield_impl_standard.py
	modified:   ../../spynnaker/pyNN/models/neuron/neuron_models/config.py

pbl when add Vi obtain DIBBY0 error but now clue where.
	modified:   meanfield/models/meanfield_model_impl.c
	modified:   meanfield/models/meanfield_model_impl.h
	modified:   ../../spynnaker/pyNN/models/neuron/builds/meanfield_base.py
	modified:   ../../spynnaker/pyNN/models/neuron/implementations/meanfield_impl_standard.py
	modified:   ../../spynnaker/pyNN/models/neuron/neuron_models/meanfield_model_eitn.py

try to solved the error DIVBY0 and pass from 10 vars recorded to 5.
	modified:   ../../src/meanfield/models/meanfield_model_impl.c
	modified:   ../../../spynnaker/pyNN/models/neuron/implementations/meanfield_impl_standard.py
	modified:   ../../../spynnaker/pyNN/models/neuron/neuron_models/meanfield_model_eitn.py
	modified:   ../../../spynnaker8/extra_models/__init__.py

OK problem don't comming from printing data but I guess from creating them.
I will change some C code in meanfield_impl_standard.h
PBL is like if Ve and g_syn are ok to be create but not Vi and Fout_th for a
 5 vars recorded
Need to add Vi really to tyhe implementation and so to meanfield_model_impl.h
and .c and to meanfield_model.h
so if need comme back here
	modified:   ../../src/meanfield/models/meanfield_model.h
	modified:   ../../src/meanfield/models/meanfield_model_impl.c

Ok that working a priori, it's not the most beautiful but it's working
Just one comment is : the numbers between Ve and Vi are not treat as the same,
	don't understadn why??
	modified:   src/meanfield/models/meanfield_model.h
	modified:   src/meanfield/models/meanfield_model_impl.c

a priori that's work for Ve, Vi and Fout_th
->will add an other TF() and so an other threshold_function() in order to have
	a MF
	modified:   config.h
	modified:   meanfield_model.h
	modified:   meanfield_model_impl.c

Add in the c code the inhibitory contribution of the MF and so the
 differenciation btw Exc and Inh.
Names of some variables and params will be change in order to don't induce
misunderstanding.
Garandel added 21 commits October 26, 2021 12:33
	modified:   Makefile
	modified:   ../../../src/meanfield/implementations/meanfield_impl_standard.h
	renamed:    ../../../src/meanfield/models/Vthre_params.h -> ../../../src/meanfield/models/P_fit_polynomial.h
	modified:   ../../../src/meanfield/models/meanfield_model.h
	modified:   ../../../src/meanfield/models/meanfield_model_impl.c
	modified:   ../../../../spynnaker/pyNN/models/neuron/abstract_pynn_meanfield_model_standard.py
	modified:   ../../../../spynnaker/pyNN/models/neuron/builds/meanfield_base.py

Add the other transfert function for inhibitors in C code,
-> take parameters from config.h to an other Opaque structure P_fit_polynomial.h
that's compile
	modified:   Makefile
	modified:   ../../../src/meanfield/implementations/meanfield_impl_standard.h
	modified:   ../../../src/meanfield/models/meanfield_model.h
	modified:   ../../../src/meanfield/models/meanfield_model_impl.c
	renamed:    ../../../src/meanfield/models/config.h -> ../../../src/meanfield/models/params_from_network.h

renames config.h to params_from_network.h in order to be more precise in the
correspondance btw code and litterature.
change names of types, arrays and structure.
compilation is ok
	modified:   ../../../src/meanfield/models/params_from_network.h

was changeing mathsbox.h for estimate_err_func.h but go back bcs I don't
know if I will implement other function inside mathsbox and not just error
function
	modified:   builds/meanfield_base.py
	modified:   implementations/meanfield_impl_standard.py
	renamed:    neuron_models/config.py -> neuron_models/params_from_network.py

change name config.py for params_from_network.py and so in files
	modified:   builds/meanfield_base.py
	new file:   neuron_models/p_fit_polynomial.py
	modified:   neuron_models/params_from_network.py

add an other struct file to implemente params from fit of single neuron for
Vthre polynome
…dard.h

	modified:   ../../../src/meanfield/models/params_from_network.h
	modified:   ../../../../spynnaker/pyNN/models/neuron/builds/meanfield_base.py
	modified:   ../../../../spynnaker/pyNN/models/neuron/implementations/meanfield_impl_standard.py
	modified:   ../../../../spynnaker/pyNN/models/neuron/neuron_models/__init__.py
	modified:   ../../../../spynnaker/pyNN/models/neuron/neuron_models/p_fit_polynomial.py
	modified:   ../../../../spynnaker/pyNN/models/neuron/neuron_models/params_from_network.py

A priori meanfield_model_cond.dict says that I'm out of DTCM.
	That's why I get the error:
	"Population meanfield_model_cond does not have parameter p0"
Go back to the past commit without inh implemented, just to see.
…base.py

	modified:   ../../../../spynnaker/pyNN/models/neuron/implementations/meanfield_impl_standard.py
	renamed:    ../../../../spynnaker/pyNN/models/neuron/neuron_models/p_fit_polynomial.py -> ../../../../spynnaker/pyNN/models/neuron/neuron_models/P_fit_polynomial_exc.py
	new file:   ../../../../spynnaker/pyNN/models/neuron/neuron_models/P_fit_polynomial_inh.py
	modified:   ../../../../spynnaker/pyNN/models/neuron/neuron_models/__init__.py

CHECK POINT
That's compile and work in virtual mode for c and python.
ERROR : DIVBY0 when reel mode
	modified:   ../../../../spynnaker/pyNN/models/neuron/builds/meanfield_base.py

DIVBY0 error is solved, due to put state var in local but don't go back to
struct so all the time 0.
RESUME :
	- TF for exc and inh with
	- some name changed in the files and in variables
WILL:
	- Change MeanfieldModelEitn in python
	- add adaptation W ODE
	- change Fout_th for W in output
	modified:   __init__.py
	renamed:    meanfield_model_eitn.py -> meanfield_of_adex_network.py

Change the name from meanfield_model_eitn.py to meanfield_of_adex_network.py
…dard.h

	modified:   ../../../src/meanfield/models/meanfield_model_impl.c
	modified:   ../../../src/meanfield/models/meanfield_model_impl.h
	modified:   ../../../../spynnaker/pyNN/models/neuron/builds/meanfield_base.py
	modified:   ../../../../spynnaker/pyNN/models/neuron/implementations/meanfield_impl_standard.py
	modified:   ../../../../spynnaker/pyNN/models/neuron/neuron_models/meanfield_of_adex_network.py

Add the structure for adaptation W, that's work but give non-sense results.
Need to add a start value and the real ODE.
	modified:   ../../../../spynnaker/pyNN/models/neuron/builds/meanfield_base.py
	modified:   ../../../../spynnaker/pyNN/models/neuron/neuron_models/meanfield_of_adex_network.py

Correct some error but have an error when calculating EDO with RK2_midpoint.
maybe "error" come from recorder.py and constant.py
will do some test so if need come back here
	modified:   ../../../src/meanfield/models/meanfield_model_impl.h
	modified:   ../../../../spynnaker/pyNN/models/neuron/builds/meanfield_base.py
	modified:   ../../../../spynnaker/pyNN/models/neuron/implementations/meanfield_impl_standard.py
	modified:   ../../../../spynnaker/pyNN/models/neuron/neuron_models/meanfield_of_adex_network.py
	modified:   ../../../../spynnaker/pyNN/models/recorder.py
	modified:   ../../../../spynnaker/pyNN/utilities/constants.py

do some modification aparently without effect of
recorder and constant in rder to integrate Ve, Vi and W.
Will modify meanfield_t
because Vthre left in it but not anymore in meanfield_t and so modif
 meanfield_f_adex_network.py
	modified:   ../../../../spynnaker/pyNN/models/neuron/builds/meanfield_base.py
	modified:   ../../../../spynnaker/pyNN/models/neuron/neuron_models/meanfield_of_adex_network.py

remove nbr from meanfielf_t and to meanfield_of_adex_network.py
	modified:   ../../../../spynnaker/pyNN/models/neuron/builds/meanfield_base.py
	modified:   ../../../../spynnaker/pyNN/models/neuron/neuron_models/meanfield_of_adex_network.py

No clue of why w return uint32 DataType and not S1615.
Will try in switching Vi and w
…dard.h

	modified:   ../../../src/meanfield/models/meanfield_model.h
	modified:   ../../../src/meanfield/models/meanfield_model_impl.c
	modified:   ../../../../spynnaker/pyNN/models/neuron/neuron_models/meanfield_of_adex_network.py

SAVE POINT
	now that's fonctionnaly work.
	NEED to optimise or doing real ode solver and error_function
	modified:   ../../../src/meanfield/models/meanfield_model_impl.c

modified error_function with midpoint methode for integration.
will do pregressively trapezoidale and Simpson if possible in ITCM
BUT try to have an homogeneous patern i.e. EULER and Midpoint integrale
for error function.
	modified:   ../../../../spynnaker/pyNN/models/neuron/builds/meanfield_base.py
Did some cleanning, correction and rewriting of euler, RK2, mu_Ge and modif TvN= Tv only because of the original paper.
Need to ask for that!!
Modif T_inv in value.
need to find a way to plot but plt.show don't work on the terminal.
	modified:   ../../../src/meanfield/models/meanfield_model_impl.c
	modified:   ../../../../spynnaker/pyNN/models/neuron/builds/meanfield_base.py

Do some clarification and try some method to remove the 'overflowed ITCM' message
because of sqrtk
sqrt function is not activated, so sV is on the square value.
Need to find a solution for sqrt without overflowed ITCM
too much changes, so will have too much conflict to fixe so merge with -s ours
…ld_model into meanfield_model

try to merge origin_MF with this local branch with -s ours option in order to remove conflict
Copy link
Contributor

@andrewgait andrewgait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks in general fine to me; there are a few considerations you can make (see comments) as to where you can avoid some divides. I don't think these will help hugely with making enough space to use sqrtk() - we may have to think of another way around that. But I would be happy to merge this once you've addressed the comments and we can discuss what might be possible for sqrtk() after that.

//return config->Vthre;

Vthre = P0\
+ P1*(muV-muV0)/DmuV0\
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DmuV0, DsV0 and DTvN0 are all parameters that come directly from constant values in python - you can avoid the divides here in this function by instead sending in 1/DmuV0 etc. and multiplying.

Tv += ACS_DBL_TINY;
}

pNetwork->TvN = Tv*Gl/Cm; // Thomas : Heu, useless no?? |resp-> TvN is a dimensional so usefull var
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth considering 1/Cm here too.


params->muV = (muGe*params->Ee+muGi*params->Ei+params->Gl*params->El); //fake one
pNetwork->muGn = muG/Gl;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here Gl is a constant, so again sending in 1/Gl and multiplying may help. (In this instance I think you probably need to send both Gl and 1/Gl).

@garandel
Copy link
Author

garandel commented Nov 29, 2021 via email

@garandel
Copy link
Author

garandel commented Nov 29, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants