original_docstring: 
      Plots posterior distributions over rebits, including covariance ellipsoids
  
      :param qinfer.smc.SMCUpdater updater: Posterior distribution over rebits.
      :param qinfer.tomography.DensityOperatorDistribution: Prior distribution
          over rebit states.
      :param np.ndarray true_state: Model parameters for "true" state to plot
          as comparison.
      :param float n_std: Number of standard deviations out from the mean
          at which to draw the covariance ellipse. Only used if
          region_est_method is ``'cov'``.
      :param float level: Credibility level to use for computing
          region estimators from convex hulls.
      :param list rebit_axes: List containing indices for the :math:`x`
          and :math:`z` axes.
      :param str region_est_method: Method to use to draw region estimation.
          Must be one of None, ``'cov'`` or ``'hull'``.
      
docstring: Plots posterior distributions over rebits, including covariance ellipsoids
docstring_tokens: Plots posterior distributions over rebits including covariance ellipsoids
code: def plot_rebit_posterior(updater, prior=None, true_state=None, n_std=3, rebit_axes=REBIT_AXES, true_size=250,
              legend=True,
              level=0.95,
              region_est_method='cov'
      ):
      """
      Plots posterior distributions over rebits, including covariance ellipsoids
  
      :param qinfer.smc.SMCUpdater updater: Posterior distribution over rebits.
      :param qinfer.tomography.DensityOperatorDistribution: Prior distribution
          over rebit states.
      :param np.ndarray true_state: Model parameters for "true" state to plot
          as comparison.
      :param float n_std: Number of standard deviations out from the mean
          at which to draw the covariance ellipse. Only used if
          region_est_method is ``'cov'``.
      :param float level: Credibility level to use for computing
          region estimators from convex hulls.
      :param list rebit_axes: List containing indices for the :math:`x`
          and :math:`z` axes.
      :param str region_est_method: Method to use to draw region estimation.
          Must be one of None, ``'cov'`` or ``'hull'``.
      """
      pallette = plt.rcParams['axes.color_cycle']
  
      plot_rebit_modelparams(updater.particle_locations,
          c=pallette[0],
          label='Posterior',
          s=12 * np.sqrt(updater.particle_weights * len(updater.particle_weights)),
          rebit_axes=rebit_axes,
          zorder=-10
      )
  
      plot_rebit_modelparams(true_state,
          c=pallette[1],
          label='True', marker='*', s=true_size,
          rebit_axes=rebit_axes
      )
  
      if prior is not None:
          plot_rebit_modelparams(
              prior._basis.state_to_modelparams(prior._mean)[None, :],
              edgecolors=pallette[3], s=250, facecolors='none', linewidth=3,
              label='Prior Mean',
              rebit_axes=rebit_axes
          )
      plot_rebit_modelparams(
          updater.est_mean()[None, :],
          edgecolors=pallette[2], s=250, facecolors='none', linewidth=3,
          label='Posterior Mean',
          rebit_axes=rebit_axes
      )
  
      if region_est_method == 'cov':
          # Multiplying by sqrt{2} to rescale to Bloch ball.
          cov = 2 * updater.est_covariance_mtx()
          # Use fancy indexing to cut out all but the desired submatrix.
          cov = cov[rebit_axes, :][:, rebit_axes]
          plot_cov_ellipse(
              cov, updater.est_mean()[rebit_axes] * np.sqrt(2),
              nstd=n_std,
              edgecolor='k', fill=True, lw=2,
              facecolor=pallette[0],
              alpha=0.4,
              zorder=-9,
              label='Posterior Cov Ellipse ($Z = {}$)'.format(n_std)
          )
  
      elif region_est_method == 'hull':
          # Find the convex hull from the updater, projected
          # on the rebit axes.
          faces, vertices = updater.region_est_hull(level, modelparam_slice=rebit_axes)
          polygon = Polygon(vertices * np.sqrt(2),
              facecolor=pallette[0], alpha=0.4, zorder=-9,
              label=r'Credible Region ($\alpha = {}$)'.format(level),
              edgecolor='k', lw=2, fill=True
          )
          # TODO: consolidate add_patch code with that above.
          plt.gca().add_patch(polygon)
  
          
      plot_decorate_rebits(updater.model.base_model._basis,
          rebit_axes=rebit_axes
      )
  
      if legend:
          plt.legend(loc='lower left', ncol=4, scatterpoints=1)
code_tokens: def plot_rebit_posterior ( updater , prior = None , true_state = None , n_std = 3 , rebit_axes = REBIT_AXES , true_size = 250 , legend = True , level = 0.95 , region_est_method = 'cov' ) : pallette = plt . rcParams [ 'axes.color_cycle' ] plot_rebit_modelparams ( updater . particle_locations , c = pallette [ 0 ] , label = 'Posterior' , s = 12 * np . sqrt ( updater . particle_weights * len ( updater . particle_weights ) ) , rebit_axes = rebit_axes , zorder = - 10 ) plot_rebit_modelparams ( true_state , c = pallette [ 1 ] , label = 'True' , marker = '*' , s = true_size , rebit_axes = rebit_axes ) if prior is not None : plot_rebit_modelparams ( prior . _basis . state_to_modelparams ( prior . _mean ) [ None , : ] , edgecolors = pallette [ 3 ] , s = 250 , facecolors = 'none' , linewidth = 3 , label = 'Prior Mean' , rebit_axes = rebit_axes ) plot_rebit_modelparams ( updater . est_mean ( ) [ None , : ] , edgecolors = pallette [ 2 ] , s = 250 , facecolors = 'none' , linewidth = 3 , label = 'Posterior Mean' , rebit_axes = rebit_axes ) if region_est_method == 'cov' : cov = 2 * updater . est_covariance_mtx ( ) cov = cov [ rebit_axes , : ] [ : , rebit_axes ] plot_cov_ellipse ( cov , updater . est_mean ( ) [ rebit_axes ] * np . sqrt ( 2 ) , nstd = n_std , edgecolor = 'k' , fill = True , lw = 2 , facecolor = pallette [ 0 ] , alpha = 0.4 , zorder = - 9 , label = 'Posterior Cov Ellipse ($Z = {}$)' . format ( n_std ) ) elif region_est_method == 'hull' : faces , vertices = updater . region_est_hull ( level , modelparam_slice = rebit_axes ) polygon = Polygon ( vertices * np . sqrt ( 2 ) , facecolor = pallette [ 0 ] , alpha = 0.4 , zorder = - 9 , label = r'Credible Region ($\alpha = {}$)' . format ( level ) , edgecolor = 'k' , lw = 2 , fill = True ) plt . gca ( ) . add_patch ( polygon ) plot_decorate_rebits ( updater . model . base_model . _basis , rebit_axes = rebit_axes ) if legend : plt . legend ( loc = 'lower left' , ncol = 4 , scatterpoints = 1 )
short_docstring: Plots posterior distributions over rebits, including covariance ellipsoids
short_docstring_tokens: Plots posterior distributions over rebits including covariance ellipsoids
comment: """
      Plots posterior distributions over rebits, including covariance ellipsoids
  
      :param qinfer.smc.SMCUpdater updater: Posterior distribution over rebits.
      :param qinfer.tomography.DensityOperatorDistribution: Prior distribution
          over rebit states.
      :param np.ndarray true_state: Model parameters for "true" state to plot
          as comparison.
      :param float n_std: Number of standard deviations out from the mean
          at which to draw the covariance ellipse. Only used if
          region_est_method is ``'cov'``.
      :param float level: Credibility level to use for computing
          region estimators from convex hulls.
      :param list rebit_axes: List containing indices for the :math:`x`
          and :math:`z` axes.
      :param str region_est_method: Method to use to draw region estimation.
          Must be one of None, ``'cov'`` or ``'hull'``.
      """$SEP$# Multiplying by sqrt{2} to rescale to Bloch ball.$SEP$# Use fancy indexing to cut out all but the desired submatrix.$SEP$# Find the convex hull from the updater, projected$SEP$# on the rebit axes.$SEP$# TODO: consolidate add_patch code with that above.