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
# author: Nicolas Tessore <n.tessore@ucl.ac.uk> | |
# license: MIT | |
'''meta-module that imports all modules from its namespace package | |
Package this module in your namespace. Then use ``import mynamespace.all`` and | |
every module in the namespace will be available under the import. | |
''' | |
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 | |
import healpy as hp | |
import matplotlib.pyplot as plt | |
import matplotlib as mpl | |
def plot_hp3d(ax, m, r=1.0, vmin=None, vmax=None, cmap=None, norm=None, | |
alpha=None, shade=False, **kwargs): | |
m = np.asanyarray(m) | |
*nmaps, npix = m.shape |
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
# author: Nicolas Tessore <n.tessore@ucl.ac.uk> | |
# license: MIT | |
'''utility functions for numpy arrays''' | |
import numpy as np | |
def array_with_attributes(name, **attrs): | |
'''create an array subclass with given attributes''' |
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
# create and activate a new environment for flask | |
conda create -n flask | |
conda activate flask | |
# switch to the root of the environment | |
cd $CONDA_PREFIX | |
# use ONLY conda-forge for packages | |
echo 'channels: [conda-forge]' > .condarc |
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
// argsort(first, last, a_first, [compare]) | |
// --- | |
// Store the order of the input range [`first`, `last`) in the output range | |
// starting at `a_first`. Both iterator types must allow random access. | |
// | |
template<class ValueIt, class IndexIt, | |
class Op = std::less<typename std::iterator_traits<ValueIt>::value_type>> | |
void argsort(ValueIt first, ValueIt last, IndexIt a_first, Op compare = Op()) | |
{ | |
using T = typename std::iterator_traits<IndexIt>::value_type; |
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
// compute the logarithm of Bessel functions of large argument and order | |
// | |
// author: Nicolas Tessore <n.tessore@ucl.ac.uk> | |
// date: 6 Dec 2020 | |
// | |
#include <math.h> | |
// compute the Bessel function ratio J_{nu-1}(x)/J_nu(x) from a continued |
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 | |
from scipy.fft import rfft, irfft | |
from scipy.special import loggamma | |
# constants | |
LN_2 = np.log(2) | |
LN_10 = np.log(10) | |
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
# download file if not already downloaded | |
def dl(url, file=None): | |
from urllib.request import urlretrieve | |
from urllib.parse import urlparse | |
import os.path | |
if file is None: | |
file = os.path.basename(urlparse(url).path) | |
if not os.path.exists(file): | |
urlretrieve(url, file) | |
return file |
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
export FC='/opt/local/bin/gfortran-mp-4.8' | |
set -e | |
mkdir lensed | |
pushd lensed | |
git clone --depth=1 https://github.com/farhanferoz/MultiNest | |
pushd MultiNest/MultiNest_v3.11_cmake/multinest | |
mkdir build | |
pushd build |
NewerOlder