jelleaalbers / multihist Goto Github PK
View Code? Open in Web Editor NEWConvenience wrappers around numpy's histogram and histogram2d
License: MIT License
Convenience wrappers around numpy's histogram and histogram2d
License: MIT License
... it moves the error bands up or down as opposed to scaling them.
Would be a nice feature
Useful for making subplots
Something like
mh.Histdd(...)
means, errors = mh.profile(axis=0)
and
mh.profileplot(axis=0)
maybe even some fitting shortcuts?
With some update (of numpy, I believe), multihist failed at lookup (line 682) with:
682 assert len(coordinate_arrays) == self.dimensions
Casting hist_ravel spesifically as float avoids this problem, diff of my local fix:
@@ -610,7 +610,7 @@ class Histdd(MultiHistBase):
for i, f in enumerate(factors):
x = self.bin_edges[i]
mh.bin_edges[i] = np.interp(
- x=np.linspace(0, 1, (len(x) - 1) * f + 1),
+ x=np.linspace(0, 1, round((len(x) - 1) * f) + 1),
xp=np.linspace(0, 1, len(x)),
fp=x)
@@ -630,7 +630,8 @@ class Histdd(MultiHistBase):
bin_centers_ravel = np.array(np.meshgrid(*self.bin_centers(),
indexing='ij')).reshape(self.dimensions, -1).T
hist_ravel = self.histogram.ravel()
- hist_ravel = hist_ravel.astype(np.float) / np.nansum(hist_ravel)
+ hist_ravel = hist_ravel.astype(np.float)
+ hist_ravel = hist_ravel/ np.nansum(hist_ravel)
result = bin_centers_ravel[np.random.choice(len(bin_centers_ravel),
p=hist_ravel,
size=size)]
This results in a value of t
out of range of self.t_start
and self.t_end
. One solution is to do
np.clip(t, self.t_start, self.t_end)
to enforce t
to be in the correct range. Might add a warning before to check how far out of bounds t
is.
It would be nice if there was an option to clip input data that is out of range of the histogram to the nearest bin in range.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.