Re: [RESEAUX SOCIAUX] [TVB] Issue with Reproducing Results from TVB-EduCase-BrainTumor Tutorial

Skip to first unread message


Feb 23, 2024, 4:31:43 AMFeb 23


I might be reading this wrong, but there's a bug in the tutorial: it does not run new simulations for each value of G, but rather, it changes the G and continues the same simulation.  Your code appears to be correct, configuring a new simulator for each.  Perhaps you could introduce this bug in your code and see fi the plot looks similar to the tutorial.

Why would there be a bug in the tutorial?  It appears the original script used multiprocessing to run multiple G values, which would fork the process effectively copying the first simulation object and running it from the start.  But this is a (very) precarious approach: better to configure a new simulator for each value of G.



From: <> on behalf of Szymon Tyras <>
Sent: Saturday, February 17, 2024 11:43:59 AM
To: TVB Users
Subject: [RESEAUX SOCIAUX] [TVB] Issue with Reproducing Results from TVB-EduCase-BrainTumor Tutorial
Hello everyone, 

 I've been grappling with a non-TVB implementation of the Reduced Wong-Wang model in Python, but due to unsatisfactory results, I decided to switch to TVB.  

I followed the detailed example provided here:  I believe I've replicated the steps in the tutorial accurately (in my code below, the primary differences are that I didn't use all the monitors and opted for direct computation with numpy for statistics). 

However, my results differ from those in the tutorial. Specifically, I did not observe the expected drop in correlation values as the G parameter exceeds the optimal working point, and the optimal point itself appears to shift towards higher values. I've rerun the entire process several times, so I doubt the model's stochasticity is the cause.  

I would greatly appreciate any insights into potential missteps or misunderstandings on my part.  

def compute_fc_matrix (bold_timeseries):

    return np.corrcoef(bold_timeseries)

def comparisonFC(fc_matrix, fc_matrix2):
    return np.corrcoef(np.array([fc_matrix[np.triu_indices_from(fc_matrix, k=1)], fc_matrix2[np.triu_indices_from(fc_matrix2, k=1)]]))[0,1]

def simulated_BOLD (G):
    conn = Connectivity.from_file('/Users/szymontyras/Downloads/')

    sim = simulator.Simulator(
        integrator=integrators.HeunStochastic(dt=1, noise=noise.Additive(nsig=np.array([1e-5]))),

    sim.coupling.a = G
    bold_data = []
    for (bold_time, bold_signal), in sim(simulation_length=420000):
            bold_data.append(bold_signal[:, :, 0])
    BOLD = np.array(bold_data)
    BOLD = BOLD.squeeze()

    return BOLD

Thank you all once again, and I apologize for any inconvenience my query may cause.  Best regards, 
Szymon Tyras

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
To view this discussion on the web visit

Daniele Marinazzo

Feb 23, 2024, 5:31:43 AMFeb 23
Thanks Marmaduke for the insight, the tutorial could be generalized and adapted to become more efficient.

Regarding Szymon's results, they are ok. For some subjects the drop is more pronounced, for others there is a sort of reduced peak and then a plateau, see for example CON01 here

Szymon Tyras

Feb 24, 2024, 1:26:20 AMFeb 24
to TVB Users
Dear Marmaduke and Daniele Marinazzo,  

Thank you for your responses. Indeed, Marmaduke accurately diagnosed the problem. I also appreciate the reassurance regarding my code.  

Best regards, 
Reply all
Reply to author
0 new messages