nessai.proposal.rejection
=========================

.. py:module:: nessai.proposal.rejection

.. autoapi-nested-parse::

   Proposal method for initial sampling when priors are not analytical.

   ..
       !! processed by numpydoc !!


Classes
-------

.. autoapisummary::

   nessai.proposal.rejection.RejectionProposal


Module Contents
---------------

.. py:class:: RejectionProposal(*args, **kwargs)

   Bases: :py:obj:`nessai.proposal.analytic.AnalyticProposal`


   
   Object for rejection sampling from the priors.

   See parent for explanation of arguments and keyword arguments.

   Will be used when ``nessai`` is called with ``analytic_priors=False``. This
   is the default behaviour.

   Relies on :py:meth:`nessai.model.Model.new_point` to draw new points and
   :py:meth:`nessai.model.Model.new_point_log_prob` when computing the
   probability of each new point.















   ..
       !! processed by numpydoc !!

   .. py:method:: draw_proposal(N=None)

      
      Draw new point(s).


      :Parameters:

          **N** : int, optional
              Number of samples to draw. If not specified ``poolsize`` will be
              used.



      :Returns:

          structured_array
              Array of N new points











      ..
          !! processed by numpydoc !!


   .. py:method:: log_proposal(x)

      
      Log proposal probability. Calls                 :meth:`nessai.model.Model.new_point_log_prob`


      :Parameters:

          **x** : structured_array
              Array of new points



      :Returns:

          :obj:`numpy.ndarray`
              Array of log-probabilities.











      ..
          !! processed by numpydoc !!


   .. py:method:: compute_weights(x, return_log_prior=False)

      
      Get weights for the samples.

      Computes the log weights for rejection sampling sampling but does not
      normalize the weights.

      :Parameters:

          **x** :  structured_array
              Array of points

          **return_log_prior: bool**
              If true, the log-prior probability is also returned.



      :Returns:

          **log_w** : :obj:`numpy.ndarray`
              Array of log-weights rescaled such that the maximum value is zero.











      ..
          !! processed by numpydoc !!


   .. py:method:: populate(N=None)

      
      Populate the pool by drawing from the proposal distribution and
      using rejection sampling.

      Will also evaluate the likelihoods if the proposal contains a
      multiprocessing pool.

      :Parameters:

          **N** : int, optional
              Number of samples to draw. Not all samples will be accepted to
              the number of samples saved will be less than N. If not specified
              ``poolsize`` will be used.














      ..
          !! processed by numpydoc !!


