Skip to content

Instantly share code, notes, and snippets.

View dagss's full-sized avatar

Dag Sverre Seljebotn dagss

  • mCASH AS and University of Oslo
  • Oslo
View GitHub Profile
@dagss
dagss / gist:5008118
Last active September 20, 2017 01:33
marked_yaml
"""
A PyYAML loader that annotates position in source code.
The loader is based on `SafeConstructor`, i.e., the behaviour of
`yaml.safe_load`, but in addition:
- Every dict/list/unicode is replaced with dict_node/list_node/unicode_node,
which subclasses dict/list/unicode to add the attributes `start_mark`
and `end_mark`. (See the yaml.error module for the `Mark` class.)
{
"metadata": {
"name": "Multigrid Sinv"
},
"nbformat": 3,
"worksheets": [
{
"cells": [
{
"cell_type": "code",
@dagss
dagss / gist:5151234
Last active December 14, 2015 21:28
class PlanckUniversalColormap(Colormap):
name = "planckuniv"
def __init__(self, cmap):
Colormap.__init__(self, "planckuniv-" + cmap.name, cmap.N)
self.cmap = cmap
self.N = self.cmap.N
def __call__(self, xi, alpha=1.0, **kw):
x = xi * (1e7+1e3) - 1e3
yi = self.modsinh(x)
{
"cursor": "0|10",
"items": [
{
"meta": {
"timestamp": "2013-11-18 16:27:39",
"labels": [
"timeline"
],
"uri": "message\/fm:815deaa8721a48f1a76577d6c21f5863:2\/",
from __future__ import division
import numpy as np
import math
for n in [2**50, 2**55., 2**60.]:
print
print '===', n
print
m = 1e10 * 1e2 * 365 * 1e2
print m, '%e' % 2**60