def _show_model_figure(model_name, model_class, dt, **kwargs): # Do some stuff that tests or makes use of this module... LOG.info("Testing {} model...".format(model_name)) # Check that the docstring examples, if there are any, are accurate. import doctest doctest.testmod() # Initialize Models in their default state model = model_class(**kwargs) LOG.info("Model initialized in its default state without error...") LOG.info("Testing phase plane interactive...") # Check the Phase Plane integrator = HeunDeterministic(dt=dt) ppi_fig = PhasePlaneInteractive(model=model, integrator=integrator) ppi_fig.show()
# WW.number_of_modes)) # traj[0, :] = state # WW.update_derived_parameters() # for step in range(TRAJ_STEPS): # #import pdb; pdb.set_trace() # state = scheme(state, WW.dfun, no_coupling, 0.0, 0.0) # traj[step+1, :] = state # xx = traj[:, svx_ind, 0, 0] # yy = traj[:, svy_ind, 0, 0] # distances = numpy.square((xx[:-1]-xx[1:])**2 + (yy[:-1]-yy[1:])**2) # steps = (distances >threshold).sum() # if counter%10==0: # print(counter) # print(distances) # print((distances > threshold).sum()) # dataset.append([x,y,xx[-1],yy[-1],steps,threshold,xx,yy,distances]) # import pandas as pd # datadf = pd.DataFrame(dataset,columns=['S1_i','S2_i','S1_f','S_2_f','steps','threshold_distances','raw s1','raw s2','raw_distances']) # datadf.to_csv('dataset_activations.csv') # plt.scatter(x,y,s=42,c='g',marker='o') # plt.scatter(xx,yy) # plt.show() # plt.scatter(range(len(distances)),distances) # plt.show() #import pdb;pdb.set_trace() #print('initializing') ppi_fig = PhasePlaneInteractive(model=WW, integrator=INTEGRATOR) ppi_fig.show()
e = self.e f = self.f beta = self.beta alpha = self.alpha lc_0 = local_coupling*V ## numexpr dV = ev('d * tau * (alpha * W - f * V**3 + e * V**2 + I + c_0 + lc_0)') dW = ev('d * (a + b * V + c * V**2 - beta * W) / tau') self.derivative = numpy.array([dV, dW]) return self.derivative if __name__ == "__main__": #Initialise Model in their default state: G2D_MODEL = Generic2dOscillator() LOG.info("Model initialised in its default state without error...") LOG.info("Testing phase plane interactive ... ") # Check local dynamics from tvb.simulator.plot.phase_plane_interactive import PhasePlaneInteractive import tvb.simulator.integrators as integrators INTEGRATOR = integrators.HeunDeterministic(dt=2**-4) ppi_fig = PhasePlaneInteractive(model=G2D_MODEL, integrator=INTEGRATOR) ppi_fig.show()
from tvb.simulator.plot.phase_plane_interactive import PhasePlaneInteractive ppi_fig = PhasePlaneInteractive() ppi_fig.show()
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Fri Jun 29 23:04:19 2018 @author: virati This file essentially replaces the version I made a while back. Can mess around with phase portraits of 2D oscillatory """ from tvb.simulator.lab import * from tvb.simulator.plot.phase_plane_interactive import PhasePlaneInteractive oscillator = models.Generic2dOscillator() #oscillator = models.HopfNet() #oscillator = models.Kuramoto() ppi_fig = PhasePlaneInteractive(model=oscillator) ppi_fig.show()