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
/* EXAMPLE: | |
var workerCode = function(){ | |
"use strict;" //this will become the first line of the worker | |
CalculateSomething(a,b,c,d){ | |
var v = a+b+c+d; //trivial calculation | |
main.DisplayResult(v,"hello"); | |
} | |
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
Worker = (function(){ | |
var nativeWorker = Worker; | |
var BlobWorker = function(){ | |
this.queuedCallList = []; | |
this.trueWorker = null; | |
this.onmessage = null; | |
} | |
BlobWorker.prototype.postMessage = function(){ | |
if(this.trueWorker) |
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
# -*- coding: utf-8 -*- | |
import sys | |
from types import ModuleType, ClassType | |
def can_reload_methods(klass): | |
klass.__CAN_RELOAD_METHODS__ = True | |
return klass | |
def reloadd(m): |
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
# -*- coding: utf-8 -*- | |
""" | |
The purpose of this module is to do monoprocessing for a single package when using multiprocessing. | |
It is designed with matplotlib in mind, but most of it is pretty general. | |
The idea is that you may have a block of code that you want to run in parallel | |
processes, but because of some "small" thing (i.e. something that isn't computationally expensive) | |
you can't do it easily without some major, ugly, alterations to your existing code. Monobrow.py | |
injects all the ugly stuff for you at the point you launch the processes, so you don't need to | |
alter your base code at all. |
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
# -*- coding: utf-8 -*- | |
""" | |
Created on Tue Feb 25 13:26:15 2014 | |
@author: daniel | |
""" | |
from functools import partial | |
class LazyDictProperty(object): | |
""" |
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
# -*- coding: utf-8 -*- | |
""" | |
This works but it's pretty ugly in places, the html/str representation specifically. | |
""" | |
from __future__ import print_function | |
import sys | |
import warnings | |
from traceback import format_list, extract_tb, extract_stack |
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 pso(func, lb, ub, ieqcons=[], f_ieqcons=None, args=(), kwargs={}, | |
func_takes_multiple=False, swarmsize=100, omega=0.5, phip=0.5, phig=0.5, | |
maxiter=100, minstep=1e-8, minfunc=1e-8, debug=False, info=True): | |
""" | |
Perform a particle swarm optimization (PSO) | |
Parameters | |
========== |
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
# -*- coding: utf-8 -*- | |
""" | |
Adapted from the Matlab code acompanying the following paper: | |
Climer, J. R., DiTullio, R., Newman, E. L., Hasselmo, M. E., Eden, U. T. | |
(2014), Examination of rhythmicity of extracellularly recorded neurons | |
in the entorhinal cortex. Hippocampus, Epub ahead of print. | |
doi: 10.1002/hipo.22383. | |
Matlab code take from: github.com/jrclimer/mle_rhythmicity, on 02-feb-2015. |
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
""" | |
!!!!!!SUPERSEDED BY ACTUAL REPOSITORY!!!!!! | |
https://github.com/ml31415/accumarray | |
!!!!!!SUPERSEDED BY ACTUAL REPOSITORY!!!!!! | |
""" | |
import numpy as np |
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
# -*- coding: utf-8 -*- | |
""" | |
Module contents: | |
# pearsonr_permutations | |
# pearsonr_sign_bootstrap | |
# permute_multi <-- used by pearsonr_permutations | |
DM, Feb 2015. | |
""" | |
import numpy as np |
OlderNewer