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
from pqdict import pqdict | |
from numpy import array, zeros, log, seterr | |
from numpy.random import rand | |
from collections import Counter | |
from matplotlib import pyplot as plt | |
seterr(divide="ignore") | |
class Reaction(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
from pqdict import pqdict | |
def dijkstra(graph, source, target=None): | |
dist = {} # lengths of the shortest paths to each node | |
pred = {} # predecessor node in each shortest path | |
# Store distance scores in a priority queue dictionary | |
pq = pqdict.minpq() | |
for node in graph: |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
CONDA_DIR="$HOME/miniconda" | |
alias workon='source $CONDA_DIR/bin/activate' | |
# function workon () { | |
# source "$CONDA_DIR/bin/activate" "$1" | |
# } | |
function __conda_user_setup () { | |
_workon_tab_completion_bash () { |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
def lexbisect(arrays, values, side='left', lo=0, hi=None): | |
""" | |
Bisection search on lexically sorted arrays. | |
Parameters | |
---------- | |
arrays : sequence of k 1-D array-like | |
Each "array" can be any sequence that supports scalar integer indexing, | |
as long as the arrays have the same length and their values are | |
lexsorted from left to right. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
"""Run Length Encoding utilities for NumPy arrays. | |
Authors | |
------- | |
- Nezar Abdennur | |
- Anton Goloborodko | |
""" | |
from __future__ import division, print_function | |
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
def set_postmortem_hook(): | |
import sys, traceback, ipdb | |
def _excepthook(exc_type, value, tb): | |
traceback.print_exception(exc_type, value, tb) | |
print() | |
ipdb.pm() | |
sys.excepthook = _excepthook |
OlderNewer