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 __future__ import print_function, division | |
import numpy as np | |
from scipy.signal import fftconvolve | |
import subprocess as sp | |
import os | |
import sys | |
import gzip | |
import h5py | |
from time import time |
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
""" | |
Example of integration of a function f(x) (for which a set of samples and integral estimate exist | |
e.g. through use of the Nested Sampling algorithm) multiplied by some other function g(x). NOTE: one | |
could use the expectatation value for this, but in some cases where there is sparse sampling over | |
the full allowed range of the function can cause problems. | |
The samples are passed through a KDE and then the kde object is passed to the GSL CQUAD | |
integration function | |
This requires the Cython, numpy, scikit-learn (v0.18 or greater) and the GSL library. |
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 matplotlib import pyplot as pl | |
x = np.random.randn(5000) | |
y = 0.2*np.random.randn(5000) + 3 | |
xbins = 20 | |
ybins = 20 | |
H, xedges, yedges = np.histogram2d(x, y, bins=(xbins, ybins)) |
NewerOlder