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
""" | |
Create a custom list of colors for use in data visualization | |
""" | |
import matplotlib.pyplot as plt | |
import numpy as np | |
# create n data points | |
n = 20 | |
xData = np.linspace(0,n,n) |
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
/* | |
Code to change the strings used for TAxis bin labels in ROOT. | |
Ref: | |
https://root.cern.ch/doc/master/classTAxis.html | |
*/ | |
#include <map> | |
#include <string> | |
#include <iostream> |
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
""" | |
Plotting a matplotlib.pyplot.barh from the left or right of axes | |
Ref: | |
https://matplotlib.org/api/_as_gen/matplotlib.pyplot.barh.html | |
https://matplotlib.org/examples/lines_bars_and_markers/barh_demo.html | |
""" | |
import numpy as np | |
import matplotlib.pyplot as plt |
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
""" | |
A chi-square test for the difference between two data sets. | |
_count() method is from SciPy's https://github.com/scipy/scipy/blob/v0.14.0/scipy/stats/stats.py#L3467 | |
A version of this function is in NRC, and related functions are in SciPy: | |
NRC: chstwo(bins1, bins2, nbins, knstrn, df, chsq, prob) | |
SciPy: power_divergence(f_obs, f_exp=None, ddof=0, axis=0, lambda_=None) | |
""" | |
import numpy as np |
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
""" | |
Marginalize a 2-dimensional distribution evaluated over a numpy meshgrid. | |
-The Distribution class holds the distribution, the marginalization method, | |
and the grid parameters to be used for the integration. | |
-The Marginalize() method allows specification of the axis you would like to marginalize. | |
The marginalization is done via simple grid integration, using rectangular Riemann | |
sum approximation of integral. | |
There is similar code in scipy's scipy/stats/tests/test_multivariate.py::test_marginalization() |
NewerOlder