[SciPy-User] Request for usage examples on scipy.stats.rv_continuous and scipy.ndimage.grey_dilate(structure)

Robert Kern robert.kern@gmail....
Mon Mar 22 09:50:23 CDT 2010


On Mon, Mar 22, 2010 at 09:44, Christoph Deil
<Deil.Christoph@googlemail.com> wrote:
> Hi,
>
> I am having some trouble figuring out how to use the following two aspects of scipy:
>
> 1) How can I  create a random distribution given by some python formula, e.g. pdf(x) = x**2 in the range x = 1 to 2.
>
> The example given in the rv_continuous docstring doesn't work for me:
> In [1]: import matplotlib.pyplot as plt
> In [2]: numargs = generic.numargs
> AttributeError: type object 'numpy.generic' has no attribute 'numargs'
>
> Is it also possible to use rv_continuous for multidimensional distributions, say pdf(x,y)=x*y in the range x = 1 to 2 and y = 0 to 3?
> Or for pdfs that are just given numerically on a grid (say as the result of a gaussian_kde() ), not by a python function?
>
> It would be nice if someone could add a few examples that show rv_continuous usage to the docstring or tutorial.

rv_continuous is a base class. You do not use it directly. The reason
the docstring doesn't work is because it is used as a template to
build the docstrings for the subclasses. If you want to subclass from
it to make your own distribution class, read the source of the other
distribution classes for examples.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco


More information about the SciPy-User mailing list