Skip to main content

Install

git clone https://github.com/stdogpkg/cukuramoto/ && cd cukuramoto && python setup.py install

Running

import igraph as ig
import numpy as np
from stdog.utils.misc import ig2sparse 

block_size=1024 # gpu parameter

num_couplings = 40
N = 10000

G = ig.Graph.Erdos_Renyi(N, 3/N)
adj = ig2sparse(G)
adj = adj.tocsr()
ptr, indices = adj.indptr, adj.indices


couplings = np.linspace(0, 4, num_couplings).astype("float32")
omegas = np.tan(( np.arange(1,N+1)*np.pi)/N - ((N+1.)*np.pi)/(2.0*N)  ).astype("float32")
phases = np.random.uniform(-np.pi, np.pi, int(num_couplings*N)).astype("float32")
import cukuramoto

dt = 0.1
num_temps = 100
simulation = cukuramoto.Heuns(
    N, block_size, omegas, phases, couplings, 
    indices, ptr)

simulation.heuns(num_temps, dt)
order_parameter_list = simulation.get_order_parameter(num_temps, dt)
order_parameter_list = order_parameter_list.reshape(num_couplings, num_temps)
    
r = np.mean(order_parameter_list, axis=1)
stdr = np.std(order_parameter_list, axis=1)
   
import matplotlib.pyplot as plt
plt.ion()
fig, ax1 = plt.subplots()
ax1.plot(couplings,r,'.-')
ax2 = ax1.twinx()
ax2.plot(couplings,stdr,'r.-')
plt.show()

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cukuramoto-1.0.0.tar.gz (24.5 kB view details)

Uploaded Source

File details

Details for the file cukuramoto-1.0.0.tar.gz.

File metadata

  • Download URL: cukuramoto-1.0.0.tar.gz
  • Upload date:
  • Size: 24.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.6.8

File hashes

Hashes for cukuramoto-1.0.0.tar.gz
Algorithm Hash digest
SHA256 7181dd820fc53c2018608579af299e483c227872463380f641cc143db6b23eb1
MD5 b79e712947420314f587702d3f3c7016
BLAKE2b-256 55d95426b105d8ada0a34f953329efa08fd8a9d739c949c8eca82378f8bc5d38

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.0 This release

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page