nodes: 0, module; 1, function_definition; 2, function_name:run; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, if_statement; 10, if_statement; 11, identifier:N; 12, integer:1; 13, identifier:trace_sort; 14, False; 15, string; 16, comparison_operator:N == 0; 17, block; 18, identifier:trace_sort; 19, block; 20, else_clause; 21, string_content:Run the sampler, store the history of visited points into
          the member variable ``self.samples`` and the importance weights
          into ``self.weights``.
  
          .. seealso::
              :py:class:`pypmc.tools.History`
  
          :param N:
  
              Integer; the number of samples to be drawn.
  
          :param trace_sort:
  
              Bool; if True, return an array containing the responsible
              component of ``self.proposal`` for each sample generated
              during this run.
  
              .. note::
  
                  This option only works for proposals of type
                  :py:class:`pypmc.density.mixture.MixtureDensity`
  
              .. note::
  
                  If True, the samples will be ordered by the components.; 22, identifier:N; 23, integer:0; 24, return_statement; 25, expression_statement; 26, expression_statement; 27, return_statement; 28, block; 29, integer:0; 30, assignment; 31, call; 32, identifier:origin; 33, expression_statement; 34, expression_statement; 35, pattern_list; 36, call; 37, attribute; 38, argument_list; 39, assignment; 40, call; 41, identifier:this_samples; 42, identifier:origin; 43, attribute; 44, argument_list; 45, identifier:self; 46, identifier:_calculate_weights; 47, identifier:this_samples; 48, identifier:N; 49, identifier:this_samples; 50, call; 51, attribute; 52, argument_list; 53, identifier:self; 54, identifier:_get_samples; 55, identifier:N; 56, keyword_argument; 57, attribute; 58, argument_list; 59, identifier:self; 60, identifier:_calculate_weights; 61, identifier:this_samples; 62, identifier:N; 63, identifier:trace_sort; 64, True; 65, identifier:self; 66, identifier:_get_samples; 67, identifier:N; 68, keyword_argument; 69, identifier:trace_sort; 70, False
code: def run(self, N=1, trace_sort=False):
          '''Run the sampler, store the history of visited points into
          the member variable ``self.samples`` and the importance weights
          into ``self.weights``.
  
          .. seealso::
              :py:class:`pypmc.tools.History`
  
          :param N:
  
              Integer; the number of samples to be drawn.
  
          :param trace_sort:
  
              Bool; if True, return an array containing the responsible
              component of ``self.proposal`` for each sample generated
              during this run.
  
              .. note::
  
                  This option only works for proposals of type
                  :py:class:`pypmc.density.mixture.MixtureDensity`
  
              .. note::
  
                  If True, the samples will be ordered by the components.
  
          '''
          if N == 0:
              return 0
  
          if trace_sort:
              this_samples, origin = self._get_samples(N, trace_sort=True)
              self._calculate_weights(this_samples, N)
              return origin
          else:
              this_samples = self._get_samples(N, trace_sort=False)
              self._calculate_weights(this_samples, N)