Re: [RESEAUX SOCIAUX] [TVB] PowerSpectraInteractive() not working anymore?

4 views
Skip to first unread message

WOODMAN Michael

unread,
Jul 8, 2024, 7:51:03 AMJul 8
to tvb-...@googlegroups.com

hi,


Those viewers are deprecated. Please use plain plotting tools like `specgram`.


cheers,

Marmaduke


From: tvb-...@googlegroups.com <tvb-...@googlegroups.com> on behalf of Lorenzo Prione <prione...@gmail.com>
Sent: Tuesday, June 4, 2024 11:33:39 AM
To: TVB Users
Subject: [RESEAUX SOCIAUX] [TVB] PowerSpectraInteractive() not working anymore?
 

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

I've used for a bit this function, and despite it being a bit buggy and giving the deprecation warning (Call to deprecated class PowerSpectraInteractive. (Use from tvb.contrib.scripts.plot PowerSpectraCoherenceInteractive)) was working fine before. But now for some reasons it does not anymore, and gives an empty window output with written <matplotlib.backends.backend_agg.FigureCanvasAgg at 0x1e7c1e3f7f0>. There is no module such as tvb.contrib.scripts.plot. Can you help me?

%matplotlib widget
%matplotlib inline
from tvb.datatypes.time_series import TimeSeriesRegion
import tvb.simulator.plot.power_spectra_interactive as ps_int
import matplotlib.pyplot as plt
from tvb.simulator.lab import *
from tvb.simulator.plot.tools import *
import numpy as np
import sys
import scipy.stats
import time as tm
import utils
#LOG = get_logger('demo')

conn1 = connectivity.Connectivity.from_file('connectivity_66.zip') #by putting inside 'filename.zip' you can upload your data

#Configure, to compute derived data, such as number_of_nodes and delays
nregions = len(conn1.region_labels)
conn1.weights = conn1.weights - conn1.weights * np.eye((nregions)) #remove self-connection
conn1.weights = conn1.weights / np.max(conn1.weights)              #normalised by maximum weight  
conn1.speed = np.array([np.inf])                               #no time delays => velocity ->∞
conn1.configure()
conn1.summary_info



sim = simulator.Simulator(
    model=models.Generic2dOscillator(a=numpy.array([0.3]), tau=numpy.array([2])),
    connectivity=conn1,
    coupling=coupling.Difference(a=numpy.array([7e-4])),
    integrator=integrators.HeunStochastic(dt=0.5, noise=noise.Additive(nsig=numpy.array([5e-5]))),
    monitors=(
        monitors.Raw(period=1.0),
        monitors.TemporalAverage(period = 1.0),
        ),
    simulation_length=24e3,).configure()

(raw_time, raw_data), (avg_time, avg_data), = sim.run()

# Discarded first seconds to avoid initial transient dynamics.
raw_time = raw_time[1000:24000]

# Build a TimeSeries Dataype.
tsr1 = TimeSeriesRegion(connectivity=conn1,
                       data=raw_data,                            #in TVB 4D format
                       sample_period=sim.monitors[0].period) #in ms
tsr1.configure()
tsr1

#Configure and ...
psi = ps_int.PowerSpectraInteractive()
psi.time_series=tsr1

#Analyze and launch the interactive visualiser.
psi.show()

--
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/a6f1e7fc-0c55-4f4f-bb91-fbf1c87ad879n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages