Commit 09287b3f authored by Michele Maris's avatar Michele Maris
Browse files

u

parent 1a60c8b5
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ class CumulativeOfData :
      """
      return np.interp(x,self._x,self._eff,left=0.,right=1.)
   #
   def sampled_pdf(self,x,method='hist') :
   def sampled_pdf(self,x,method='hist',density=False) :
      """returns the sample pdf for a list of x
         output: hh, xx

@@ -47,6 +47,8 @@ class CumulativeOfData :

         if method = 'hist' the pdf is calculated using an histogram like function (default)
         if method = 'tan' the pdf is calculated using the local tangent to the cdf

         if method = 'hist' and density = True, hh is normalized to the step size and represents an approximation of the local derivative
      """
      if not method in ['hist','tan'] :
         raise Exception("Error: method must be either 'hist' or 'tan'")
@@ -59,7 +61,7 @@ class CumulativeOfData :
            _x=np.sort(x)
         #
         yy=self.cdf(_x)
         hh=(yy[:-1]-yy[1:])/(_x[:-1]-_x[1:])
         hh=(yy[1:]-yy[:-1])/(_x[1:]-_x[:-1]) if density else yy[1:]-yy[:-1]
         return hh, _x
      elif method == 'tan' :
         h=(self._x[-1]-self._x[0])*eps