Code Monkey home page Code Monkey logo

multihist's People

Contributors

jelleaalbers avatar joranangevaare avatar kdund avatar pelssers avatar plt109 avatar scotthaselschwardt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

multihist's Issues

TProfile like options

Something like

mh.Histdd(...)
means, errors = mh.profile(axis=0)

and

mh.profileplot(axis=0)

maybe even some fitting shortcuts?

Multihist bug in assert len(coordinate_arrays) == self.dimensions

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)]

Floating point error in the j2000 event time

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.

Clip to range option

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.