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
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
{
"cursor": "0|10",
"items": [
{
"meta": {
"timestamp": "2013-11-18 16:27:39",
"labels": [
"timeline"
],
"uri": "message\/fm:815deaa8721a48f1a76577d6c21f5863:2\/",
@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)
{
"metadata": {
"name": "Multigrid Sinv"
},
"nbformat": 3,
"worksheets": [
{
"cells": [
{
"cell_type": "code",
@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.)
@dagss
dagss / gist:4996687
Last active December 14, 2015 00:09
Kent-Andre and Dag Sverre playing with simple linear system
from numpy import *
from scipy.linalg import eig, eigh
N = 100
M = 40
noise = 0.01
i = arange(M, dtype=float)
cinv = 1 + i**2
!/bin/sh
# start multi-line shebang
if "true" : '''\'; then
p=`pwd`; f="$0"; b=`basename $f`
while [ -L "$f" ]; do
f=`readlink $f`; cd `dirname $f`; f=`basename $f`
done
f=`pwd -P`
cd "$f/../../../../usr/bin"
i=`pwd -P`
from __future__ import division
import numpy as np
from matplotlib import pyplot as plt
import cPickle as pickle
import scipy.linalg as la
import scipy
from commander.sphere.mmajor import lm_to_idx
nside = 16
from __future__ import division
import numpy as np
import os
import commander as cm
#
# Parameters (just variables that are reused further down)\
#
output_filename = 'newmonodip-em7-%d.h5' % os.getpid()
from __future__ import division
import numpy as np
import os
import commander as cm
#
# Parameters (just variables that are reused further down)\
#
output_filename = 'sync-dust-priors-%d.h5' % os.getpid()