Example #1
0
def test_docformat():
    udd = doccer.unindent_dict(doc_dict)
    formatted = doccer.docformat(docstring, udd)
    yield assert_equal, formatted, filled_docstring
    single_doc = 'Single line doc %(strtest1)s'
    formatted = doccer.docformat(single_doc, doc_dict)
    # Note - initial indent of format string does not
    # affect subsequent indent of inserted parameter
    yield assert_equal, formatted, """Single line doc Another test
Example #2
0
def test_docformat():
    with suppress_warnings() as sup:
        sup.filter(category=DeprecationWarning)
        udd = doccer.unindent_dict(doc_dict)
        formatted = doccer.docformat(docstring, udd)
        assert_equal(formatted, filled_docstring)
        single_doc = 'Single line doc %(strtest1)s'
        formatted = doccer.docformat(single_doc, doc_dict)
        # Note - initial indent of format string does not
        # affect subsequent indent of inserted parameter
        assert_equal(formatted, """Single line doc Another test
   with some indent""")
Example #3
0
        x = _process_quantiles(x, self.dim)
        out = self._mnorm._logpdf(x, self.mean, self.prec_U, self._log_det_cov)
        return _squeeze_output(out)

    def pdf(self, x):
        return np.exp(self.logpdf(x))

    def rvs(self, size=1):
        return self._mnorm.rvs(self.mean, self.cov, size)

    def entropy(self):
        """
        Computes the differential entropy of the multivariate normal.

        Returns
        -------
        h : scalar
            Entropy of the multivariate normal distribution

        """
        return 1 / 2 * (self.dim * (_LOG_2PI + 1) + self._log_det_cov)


# Set frozen generator docstrings from corresponding docstrings in
# multivariate_normal_gen and fill in default strings in class docstrings
for name in ['logpdf', 'pdf', 'rvs']:
    method = multivariate_normal_gen.__dict__[name]
    method_frozen = multivariate_normal_frozen.__dict__[name]
    method_frozen.__doc__ = doccer.docformat(method.__doc__, docdict_noparams)
    method.__doc__ = doccer.docformat(method.__doc__, docdict_params)
Example #4
0
 def __init__(self):
     self.__doc__ = doccer.docformat(self.__doc__, docdict_params)
Example #5
0
        x = _process_quantiles(x, self.dim)
        out = self._mnorm._logpdf(x, self.mean, self.prec_U, self._log_det_cov)
        return _squeeze_output(out)

    def pdf(self, x):
        return np.exp(self.logpdf(x))

    def rvs(self, size=1):
        return self._mnorm.rvs(self.mean, self.cov, size)

    def entropy(self):
        """
        Computes the differential entropy of the multivariate normal.

        Returns
        -------
        h : scalar
            Entropy of the multivariate normal distribution

        """
        return 1/2 * (self.dim * (_LOG_2PI + 1) + self._log_det_cov)


# Set frozen generator docstrings from corresponding docstrings in
# multivariate_normal_gen and fill in default strings in class docstrings
for name in ['logpdf', 'pdf', 'rvs']:
    method = multivariate_normal_gen.__dict__[name]
    method_frozen = multivariate_normal_frozen.__dict__[name]
    method_frozen.__doc__ = doccer.docformat(method.__doc__, docdict_noparams)
    method.__doc__ = doccer.docformat(method.__doc__, docdict_params)
Example #6
0
 def __init__(self):
     super(conditional_mix_normal_gen, self).__init__()
     self.__doc__ = doccer.docformat(self.__doc__,
                                     mix_normal_docdict_params)
Example #7
0
 def __init__(self):
     super(conditional_student_gen, self).__init__()
     self.__doc__ = doccer.docformat(self.__doc__, student_docdict_params)
Example #8
0
 def __init__(self):
     super(invwishart_gen, self).__init__()
     self.__doc__ = doccer.docformat(self.__doc__, wishart_docdict_params)
Example #9
0
 def __init__(self):
     super(conditional_student_gen, self).__init__()
     self.__doc__ = doccer.docformat(self.__doc__, student_docdict_params)
Example #10
0
 def __init__(self):
     super(invwishart_gen, self).__init__()
     self.__doc__ = doccer.docformat(self.__doc__, wishart_docdict_params)
Example #11
0
 def __init__(self):
     super(multivariate_student_gen, self).__init__()
     self.__doc__ = doccer.docformat(self.__doc__, docdict_params)
Example #12
0
 def __init__(self, seed=None):
     super(multivariate_t_gen, self).__init__(seed)
     self.__doc__ = doccer.docformat(self.__doc__, mvt_docdict_params)
Example #13
0
 def __init__(self):
     super(markov_gen, self).__init__()
     self.__doc__ = doccer.docformat(self.__doc__, docdict_params)
Example #14
0
 def __init__(self):
     super(markov_gen, self).__init__()
     self.__doc__ = doccer.docformat(self.__doc__, docdict_params)
Example #15
0
 def __init__(self):
     self.__doc__ = doccer.docformat(self.__doc__, docdict_params)
Example #16
0
 def __init__(self):
     super(conditional_mix_normal_gen, self).__init__()
     self.__doc__ = doccer.docformat(self.__doc__, mix_normal_docdict_params)
Example #17
0
 def __init__(self):
     super(multivariate_student_gen, self).__init__()
     self.__doc__ = doccer.docformat(self.__doc__, docdict_params)