Shape(ptr)
array_polar(shape, n, center=(0, 0))
Iterates a shape about an optional center position
array_polar_z(shape, n, center=(0, 0))
Iterates a shape about an optional center position
array_x(shape, nx, dx)
Iterates a part in a 1D array
array_xy(shape, nx, ny, delta)
Iterates a part in a 2D array
array_xyz(shape, nx, ny, nz, delta)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Adapted from https://hodgkin-huxley-tutorial.readthedocs.io/en/latest/_static/Hodgkin%20Huxley.html | |
%matplotlib inline | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from scipy.integrate import solve_ivp | |
C_m = 1.0 | |
g_Na = 120.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<meta charset="utf-8"> | |
<div id=live style='overflow-wrap: break-word; font-family: monospace'></div> | |
<script> | |
class Controller { | |
constructor(ip) { | |
this.ip = ip | |
this.connect() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import random | |
import time | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from matplotlib import cm | |
import numba | |
@numba.jit(fastmath=True, cache=True, nopython=True) | |
def simulate(transient=10, seconds=1, delta=0.015, record_every=10): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import arbor | |
class master_recipe(arbor.recipe): | |
def __init__(self, *recipes): | |
arbor.recipe.__init__(self) | |
self.recipes = list(recipes) | |
self.setup_master_recipe() | |
### :::THIS IS THE ONLY PROBLEM::: | |
### global_properties() can not be specified up to subrecipe level | |
### which means catalogue mechanism names can not collide |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Dirichlet bc eliminated | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import scipy.sparse as sp | |
import scipy.sparse.linalg as spla | |
N = 64 | |
sources = [ | |
(0.3, 0.3, 15), | |
(0.7, 0.7, 25) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import ast | |
import sys | |
import requests | |
from bs4 import BeautifulSoup | |
import dbm | |
import unidecode | |
import subprocess |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
def to_float32(exponent, significand): | |
assert exponent.dtype == np.uint8 | |
assert significand.dtype == np.uint8 | |
negative = ((exponent & 128) >> 7) == 1 | |
exponent = (exponent & 127).astype(float)-64 | |
value = 2.0**exponent * (1.0 + significand.astype(float) / 256.0) | |
value[negative] *= -1 | |
return value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import tensorflow as tf | |
import tflite_runtime.interpreter as tflite | |
# Fib function | |
@tf.function | |
def fibonacci(n): | |
a = 0 | |
b = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Automatically saves all you matplotlib plot using pickle to a sqlite database | |
such that you can open them later, interactively. | |
Put this file somewhere on your PYTHONPATH and add this to your .bashrc | |
export PYTHONPATH="/path/to/directory" | |
export MPLBACKEND="module://autosave_mpl_background" | |
''' |