:py:mod:`nessai.proposal.rejection` =================================== .. py:module:: nessai.proposal.rejection .. autoapi-nested-parse:: Proposal method for initial sampling when priors are not analytical. .. !! processed by numpydoc !! Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: nessai.proposal.rejection.RejectionProposal .. 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(self, 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(self, 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(self, x) Get weights for the samples. Computes the log weights for rejection sampling sampling such that that the maximum log probability is zero. :Parameters: **x** : structured_array Array of points :Returns: **log_w** : :obj:`numpy.ndarray` Array of log-weights rescaled such that the maximum value is zero. .. !! processed by numpydoc !! .. py:method:: populate(self, 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 !!