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

23 views
Skip to first unread message

WOODMAN Michael

unread,
Feb 23, 2024, 4:31:43 AMFeb 23
to tvb-...@googlegroups.com

hi


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.


cheers,

Marmaduke


From: tvb-...@googlegroups.com <tvb-...@googlegroups.com> on behalf of Szymon Tyras <szymon...@gmail.com>
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: https://github.com/the-virtual-brain/tvb-educase-braintumor/blob/master/TVB_braintumor.ipynb.  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):
    fc_matrix=np.arctanh(fc_matrix)
    fc_matrix2=np.arctanh(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/PAT02T1_TVB.zip')
    conn.configure()

    sim = simulator.Simulator(
        model=models.ReducedWongWang(),
        connectivity=conn,
        coupling=coupling.Linear(),
        integrator=integrators.HeunStochastic(dt=1, noise=noise.Additive(nsig=np.array([1e-5]))),
        monitors=[monitors.Bold(period=2100)]
    ).configure()

    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()
    BOLD=BOLD.T

    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 tvb-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tvb-users/ae6564b9-0de1-4616-a0fc-25e0463c7066n%40googlegroups.com.

Daniele Marinazzo

unread,
Feb 23, 2024, 5:31:43 AMFeb 23
to tvb-...@googlegroups.com
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 https://github.com/AmoghJohri/TVB-Tests/blob/master/convolved_vs_decvonolved.ipynb


Szymon Tyras

unread,
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, 
Szymon
Reply all
Reply to author
Forward
0 new messages