Dynamic parameters

18 views
Skip to first unread message

JESUS CABRERA ALVAREZ

unread,
Mar 11, 2025, 10:18:37 AMMar 11
to TVB Users
Dear all,

Is it possible in TVB to define time-dependent parameters? I mean, to use an array of values to define the change of a parameter across time, instead of using a static value for that parameter. 

Thanks in advance,

Best,

WOODMAN Michael

unread,
Mar 17, 2025, 11:26:42 AMMar 17
to tvb-...@googlegroups.com

hi Jesus,


During the simulation loop you can update the values of the parameters on the model object.  


cheers,

Marmaduke


From: 'JESUS CABRERA ALVAREZ' via TVB Users <tvb-...@googlegroups.com>
Sent: Tuesday, March 11, 2025 3:18:37 PM
To: TVB Users
Subject: [RESEAUX SOCIAUX] [TVB] Dynamic parameters
 

Ce mail provient de l'extérieur, restons vigilants

--
You received this message because you are subscribed to the Google Groups "TVB Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tvb-users+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/tvb-users/39f5f46b-ea0a-4ee2-ad84-7d424e6241d5n%40googlegroups.com.
Message has been deleted

JESUS CABRERA ALVAREZ

unread,
Mar 28, 2025, 1:37:10 AMMar 28
to TVB Users
Thank you for the answer, Marmaduke,

Could you provide me with a code example? 

I want to preset the change in the parameter before running the simulation. For instance, could I set parameter "a" to an array with shape [nº regions x timepoints] determining its value for each timepoint?

Best,

WOODMAN Michael

unread,
Mar 28, 2025, 2:25:45 AMMar 28
to tvb-...@googlegroups.com
From: 'JESUS CABRERA ALVAREZ' via TVB Users <tvb-...@googlegroups.com>
Sent: Tuesday, March 25, 2025 11:41:54 AM
To: TVB Users
Subject: [RESEAUX SOCIAUX] Re: [RESEAUX SOCIAUX] [TVB] Dynamic parameters
 

JESUS CABRERA ALVAREZ

unread,
Mar 29, 2025, 8:27:45 AMMar 29
to TVB Users
Oh, yes. Now I see it. 

I never used this type of meta-loop, but it does very well the trick. I leave the idea also here for accessibility:

# Configure the simulation with the length of interest to implement the changes in the "dynamic" parameter
sim = simulator.Simulator( connectivity=connectivity.Connectivity.from_file(), integrator=integrators.HeunDeterministic(dt=0.01), model=models.MontbrioPazoRoxin(), monitors=[monitors.TemporalAverage(period=0.1)], simulation_length=1.0).configure() 

t = [] y = []
for i in range(10):  # Simulate in loop changing the parameter and gather the data
    sim.model.eta = sim.model.eta + 0.3    # Change the parameter of interest
    (t_, y_) = sim.run()    # Run the simulation from the state conditions where it was left last iteration
    t.append(t_)   # Gather the data
    y.append(y_)


Thank you very much!
Cheers,




Reply all
Reply to author
Forward
0 new messages