original_docstring: r"""Plots visibilities against frequency.
  
      Creates plots of the amplitude and phase of the visibilities `vis` as a
      function of frequency `fobs`. Two separate figures are opened, one for the
      amplitude and one for the phases.  If `outname` is passed, these are saved
      as `outname`\_amp_freq.png and `outname`\_phase_freq.png
  
      Parameters
      ----------
      vis : ndarray
          The visibilities to plot.  Dimensions (baseline, time, freq,
          polarization).
      fobs : ndarray
          The center frequency of each channel in GHz.
      bname : list
          The name of each baseline in the visibilities.
      outname : str
          If provided and not set to ``None``, the plots will be saved to the
          files `outname`\_amp_freq.png and `outname`\_phase_freq.png Defaults to
          ``None``.
      show : boolean
          If set to ``False`` the plot will be closed after rendering.  If set to
          ``True`` the plot is left open. Defaults to ``True``.
      nx : int
          The number of subplots in the horizontal direction of the figure.  If
          not provided, or set to ``None``, `nx` is set to the minimum of 5 and
          the number of baselines in the visibilities.  Defaults to ``None``.
      
docstring: r"""Plots visibilities against frequency.
  Creates plots of the amplitude and phase of the visibilities `vis` as a
  function of frequency `fobs`. Two separate figures are opened, one for the
  amplitude and one for the phases.
  
  Parameters
  
  vis : ndarray
  The visibilities to plot.  Dimensions (baseline, time, freq,
  polarization).
  fobs : ndarray
  The center frequency of each channel in GHz.
  bname : list
  The name of each baseline in the visibilities.
docstring_tokens: r " " " Plots visibilities against frequency . Creates plots of the amplitude and phase of the visibilities ` vis ` as a function of frequency ` fobs ` . Two separate figures are opened one for the amplitude and one for the phases . Parameters vis : ndarray The visibilities to plot . Dimensions ( baseline time freq polarization ) . fobs : ndarray The center frequency of each channel in GHz . bname : list The name of each baseline in the visibilities .
code: def plot_vis_freq(vis, fobs, bname, outname=None, show=True, nx=None):
      r"""Plots visibilities against frequency.
  
      Creates plots of the amplitude and phase of the visibilities `vis` as a
      function of frequency `fobs`. Two separate figures are opened, one for the
      amplitude and one for the phases.  If `outname` is passed, these are saved
      as `outname`\_amp_freq.png and `outname`\_phase_freq.png
  
      Parameters
      ----------
      vis : ndarray
          The visibilities to plot.  Dimensions (baseline, time, freq,
          polarization).
      fobs : ndarray
          The center frequency of each channel in GHz.
      bname : list
          The name of each baseline in the visibilities.
      outname : str
          If provided and not set to ``None``, the plots will be saved to the
          files `outname`\_amp_freq.png and `outname`\_phase_freq.png Defaults to
          ``None``.
      show : boolean
          If set to ``False`` the plot will be closed after rendering.  If set to
          ``True`` the plot is left open. Defaults to ``True``.
      nx : int
          The number of subplots in the horizontal direction of the figure.  If
          not provided, or set to ``None``, `nx` is set to the minimum of 5 and
          the number of baselines in the visibilities.  Defaults to ``None``.
      """
      nbl = vis.shape[0]
      if nx is None:
          nx = min(nbl, 5)
      ny = nbl//nx
      if nbl%nx != 0:
          ny += 1
  
      dplot = vis.mean(1)
      x = fobs
  
      _, ax = plt.subplots(ny, nx, figsize=(8*nx, 8*ny))
      ax = ax.flatten()
      for i in range(nbl):
          ax[i].plot(x, np.abs(dplot[i, :, 0]), label='A')
          ax[i].plot(x, np.abs(dplot[i, :, 1]), label='B')
          ax[i].text(0.1, 0.9, '{0}: amp'.format(bname[i]),
                     transform=ax[i].transAxes,
                     size=22)
      plt.subplots_adjust(wspace=0.1, hspace=0.1)
      ax[0].legend()
      for i in range((ny-1)*nx, ny*nx):
          ax[i].set_xlabel('freq (GHz)')
      if outname is not None:
          plt.savefig('{0}_amp_freq.png'.format(outname))
      if not show:
          plt.close()
  
      _, ax = plt.subplots(ny, nx, figsize=(8*nx, 8*ny))
      ax = ax.flatten()
      for i in range(nbl):
          ax[i].plot(x, np.angle(dplot[i, :, 0]), label='A')
          ax[i].plot(x, np.angle(dplot[i, :, 1]), label='B')
          ax[i].text(0.1, 0.9, '{0}: phase'.format(bname[i]),
                     transform=ax[i].transAxes, size=22)
      plt.subplots_adjust(wspace=0.1, hspace=0.1)
      ax[0].legend()
      for i in range((ny-1)*nx, ny*nx):
          ax[i].set_xlabel('freq (GHz)')
      if outname is not None:
          plt.savefig('{0}_phase_freq.png'.format(outname))
      if not show:
          plt.close()
code_tokens: def plot_vis_freq ( vis , fobs , bname , outname = None , show = True , nx = None ) : nbl = vis . shape [ 0 ] if nx is None : nx = min ( nbl , 5 ) ny = nbl // nx if nbl % nx != 0 : ny += 1 dplot = vis . mean ( 1 ) x = fobs _ , ax = plt . subplots ( ny , nx , figsize = ( 8 * nx , 8 * ny ) ) ax = ax . flatten ( ) for i in range ( nbl ) : ax [ i ] . plot ( x , np . abs ( dplot [ i , : , 0 ] ) , label = 'A' ) ax [ i ] . plot ( x , np . abs ( dplot [ i , : , 1 ] ) , label = 'B' ) ax [ i ] . text ( 0.1 , 0.9 , '{0}: amp' . format ( bname [ i ] ) , transform = ax [ i ] . transAxes , size = 22 ) plt . subplots_adjust ( wspace = 0.1 , hspace = 0.1 ) ax [ 0 ] . legend ( ) for i in range ( ( ny - 1 ) * nx , ny * nx ) : ax [ i ] . set_xlabel ( 'freq (GHz)' ) if outname is not None : plt . savefig ( '{0}_amp_freq.png' . format ( outname ) ) if not show : plt . close ( ) _ , ax = plt . subplots ( ny , nx , figsize = ( 8 * nx , 8 * ny ) ) ax = ax . flatten ( ) for i in range ( nbl ) : ax [ i ] . plot ( x , np . angle ( dplot [ i , : , 0 ] ) , label = 'A' ) ax [ i ] . plot ( x , np . angle ( dplot [ i , : , 1 ] ) , label = 'B' ) ax [ i ] . text ( 0.1 , 0.9 , '{0}: phase' . format ( bname [ i ] ) , transform = ax [ i ] . transAxes , size = 22 ) plt . subplots_adjust ( wspace = 0.1 , hspace = 0.1 ) ax [ 0 ] . legend ( ) for i in range ( ( ny - 1 ) * nx , ny * nx ) : ax [ i ] . set_xlabel ( 'freq (GHz)' ) if outname is not None : plt . savefig ( '{0}_phase_freq.png' . format ( outname ) ) if not show : plt . close ( )
short_docstring: r"""Plots visibilities against frequency.
short_docstring_tokens: r " " " Plots visibilities against frequency .
comment: r"""Plots visibilities against frequency.
  
      Creates plots of the amplitude and phase of the visibilities `vis` as a
      function of frequency `fobs`. Two separate figures are opened, one for the
      amplitude and one for the phases.  If `outname` is passed, these are saved
      as `outname`\_amp_freq.png and `outname`\_phase_freq.png
  
      Parameters
      ----------
      vis : ndarray
          The visibilities to plot.  Dimensions (baseline, time, freq,
          polarization).
      fobs : ndarray
          The center frequency of each channel in GHz.
      bname : list
          The name of each baseline in the visibilities.
      outname : str
          If provided and not set to ``None``, the plots will be saved to the
          files `outname`\_amp_freq.png and `outname`\_phase_freq.png Defaults to
          ``None``.
      show : boolean
          If set to ``False`` the plot will be closed after rendering.  If set to
          ``True`` the plot is left open. Defaults to ``True``.
      nx : int
          The number of subplots in the horizontal direction of the figure.  If
          not provided, or set to ``None``, `nx` is set to the minimum of 5 and
          the number of baselines in the visibilities.  Defaults to ``None``.
      """