This file contains hidden or 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 json2table(json_file, **kwds): | |
import pandas | |
df = pandas.read_json(json_file, **kwds) | |
df = df.set_index(df.columns[0]) | |
with pandas.option_context("display.max_rows", None, | |
"display.max_columns", None): | |
print(df) | |
def make_parser(doc=__doc__): |
This file contains hidden or 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 contextlib import contextmanager | |
import sys | |
@contextmanager | |
def capturing_locals(depth=1): | |
""" | |
Capture the local variables of a function upon exception. | |
>>> def fun(): |
This file contains hidden or 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 ctypes | |
class OpenMPRuntime(object): | |
""" | |
Interface to OpenMP Runtime Library Routines. | |
>>> gnu = OpenMPRuntime('libgomp.so') | |
>>> gnu.omp_set_num_threads(3) |
This file contains hidden or 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 functools | |
import itertools | |
def coroutine_send(func): | |
@functools.wraps(func) | |
def start(*args, **kwds): | |
cr = func(*args, **kwds) | |
next(cr) | |
return cr.send |
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 hidden or 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
module LyapunovExponentsWithForwardDiff | |
using DifferentialEquations | |
using ForwardDiff | |
using ParameterizedFunctions | |
using ProgressMeter | |
using RecipesBase | |
type LyapunovExponentsResult | |
sol_p |
This file contains hidden or 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 sympy | |
def recfactor(expr, deep=False): | |
"""Recursively factorize `expr` including additive terms.""" | |
if isinstance(expr, (sympy.Mul, sympy.Add)): | |
cls = type(expr) | |
return cls(*[ | |
recfactor(a, deep=deep).factor(deep=deep) | |
for a in expr.args |
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 hidden or 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
#!/bin/bash -e | |
bin="${BASH_SOURCE[0]%.*}" | |
go build -o "$bin" "$bin.go" | |
for file in "$@" | |
do | |
for rev in $(git log --format='format:%H' "$file" | head -n-1) | |
do |
This file contains hidden or 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 configure(conf): | |
# https://waf.io/apidocs/tools/tex.html | |
conf.load('tex') | |
if not conf.env.LATEX: | |
conf.fatal('The program LaTeX is required') | |
if conf.options.synctex: | |
conf.env.PDFLATEXFLAGS = ['-synctex=1'] | |
def build(bld): |