original_docstring: Plots the visibility amplitude against delay.
  
      For a given visibility Fourier transformed along the frequency axis,
      plots the amplitude against delay and calculates the location of the
      fringe peak in delay.  Returns the peak delay for each visibility,
      which can be used to calculate the antenna delays.
  
      Parameters
      ----------
      vis_ft : ndarray
          The complex visibilities, dimensions (visibility type, baselines,
          delay). Note that the visibilities must have been Fourier transformed
          along the frequency axis and scrunched along the time axis before being
          passed to `plot_delays`.
      labels : list
          The labels of the types of visibilities passed.  For example,
          ``['uncalibrated', 'calibrated']``.
      delay_arr : ndarray
          The center of the delay bins in nanoseconds.
      bname : list
          The baseline labels.
      nx : int
          The number of plots to tile along the horizontal axis. If `nx` is
          given a value of ``None``, this is set to the number of baselines or 5,
          if there are more than 5 baselines.
      outname : str
          The base to use for the name of the png file the plot is saved to. The
          plot will be saved to `outname`_delays.png if an outname is provided.
          If `outname` is given a value of ``None``, no plot will be saved.
          Defaults ``None``.
      show : boolean
          If `show` is given a value of ``False`` the plot will be closed.
          Otherwise, the plot will be left open. Defaults ``True``.
  
      Returns
      -------
      delays : ndarray
          The peak delay for each visibility, in nanoseconds.
      
docstring: Plots the visibility amplitude against delay.
  For a given visibility Fourier transformed along the frequency axis,
  plots the amplitude against delay and calculates the location of the
  fringe peak in delay.  Returns the peak delay for each visibility,
  which can be used to calculate the antenna delays.
  
  Parameters
  
  vis_ft : ndarray
  The complex visibilities, dimensions (visibility type, baselines,
  delay). Note that the visibilities must have been Fourier transformed
  along the frequency axis and scrunched along the time axis before being
  passed to `plot_delays`.
  labels : list
  The labels of the types of visibilities passed.  For example,
  ``['uncalibrated', 'calibrated']``.
  delay_arr : ndarray
  The center of the delay bins in nanoseconds.
  bname : list
  The baseline labels.
  nx : int
  The number of plots to tile along the horizontal axis.
  
  Returns
  
  delays : ndarray
  The peak delay for each visibility, in nanoseconds.
docstring_tokens: Plots the visibility amplitude against delay . For a given visibility Fourier transformed along the frequency axis plots the amplitude against delay and calculates the location of the fringe peak in delay . Returns the peak delay for each visibility which can be used to calculate the antenna delays . Parameters vis_ft : ndarray The complex visibilities dimensions ( visibility type baselines delay ) . Note that the visibilities must have been Fourier transformed along the frequency axis and scrunched along the time axis before being passed to ` plot_delays ` . labels : list The labels of the types of visibilities passed . For example ` ` [ ' uncalibrated ' ' calibrated ' ] ` ` . delay_arr : ndarray The center of the delay bins in nanoseconds . bname : list The baseline labels . nx : int The number of plots to tile along the horizontal axis . Returns delays : ndarray The peak delay for each visibility in nanoseconds .
code: def plot_delays(vis_ft, labels, delay_arr, bname, nx=None, outname=None,
                  show=True):
      """Plots the visibility amplitude against delay.
  
      For a given visibility Fourier transformed along the frequency axis,
      plots the amplitude against delay and calculates the location of the
      fringe peak in delay.  Returns the peak delay for each visibility,
      which can be used to calculate the antenna delays.
  
      Parameters
      ----------
      vis_ft : ndarray
          The complex visibilities, dimensions (visibility type, baselines,
          delay). Note that the visibilities must have been Fourier transformed
          along the frequency axis and scrunched along the time axis before being
          passed to `plot_delays`.
      labels : list
          The labels of the types of visibilities passed.  For example,
          ``['uncalibrated', 'calibrated']``.
      delay_arr : ndarray
          The center of the delay bins in nanoseconds.
      bname : list
          The baseline labels.
      nx : int
          The number of plots to tile along the horizontal axis. If `nx` is
          given a value of ``None``, this is set to the number of baselines or 5,
          if there are more than 5 baselines.
      outname : str
          The base to use for the name of the png file the plot is saved to. The
          plot will be saved to `outname`_delays.png if an outname is provided.
          If `outname` is given a value of ``None``, no plot will be saved.
          Defaults ``None``.
      show : boolean
          If `show` is given a value of ``False`` the plot will be closed.
          Otherwise, the plot will be left open. Defaults ``True``.
  
      Returns
      -------
      delays : ndarray
          The peak delay for each visibility, in nanoseconds.
      """
      nvis = vis_ft.shape[0]
      nbl = vis_ft.shape[1]
      npol = vis_ft.shape[-1]
      if nx is None:
          nx = min(nbl, 5)
      ny = nbl//nx
      if nbl%nx != 0:
          ny += 1
  
      alpha = 0.5 if nvis > 2 else 1
      delays = delay_arr[np.argmax(np.abs(vis_ft), axis=2)]
      # could use scipy.signal.find_peaks instead
      for pidx in range(npol):
          _, ax = plt.subplots(ny, nx, figsize=(8*nx, 8*ny), sharex=True)
          ax = ax.flatten()
          for i in range(nbl):
              ax[i].axvline(0, color='black')
              for j in range(nvis):
                  ax[i].plot(delay_arr, np.log10(np.abs(vis_ft[j, i, :, pidx])),
                             label=labels[j], alpha=alpha)
                  ax[i].axvline(delays[j, i, pidx], color='red')
              ax[i].text(0.1, 0.9, '{0}: {1}'.format(bname[i], 'A' if pidx == 0
                                                     else 'B'),
                         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('delay (ns)')
          if outname is not None:
              plt.savefig(
                  '{0}_{1}_delays.png'.format(
                      outname, 'A' if pidx == 0 else 'B'
                  ),
                  bbox_inches='tight'
              )
          if not show:
              plt.close()
  
      return delays
code_tokens: def plot_delays ( vis_ft , labels , delay_arr , bname , nx = None , outname = None , show = True ) : nvis = vis_ft . shape [ 0 ] nbl = vis_ft . shape [ 1 ] npol = vis_ft . shape [ - 1 ] if nx is None : nx = min ( nbl , 5 ) ny = nbl // nx if nbl % nx != 0 : ny += 1 alpha = 0.5 if nvis > 2 else 1 delays = delay_arr [ np . argmax ( np . abs ( vis_ft ) , axis = 2 ) ] for pidx in range ( npol ) : _ , ax = plt . subplots ( ny , nx , figsize = ( 8 * nx , 8 * ny ) , sharex = True ) ax = ax . flatten ( ) for i in range ( nbl ) : ax [ i ] . axvline ( 0 , color = 'black' ) for j in range ( nvis ) : ax [ i ] . plot ( delay_arr , np . log10 ( np . abs ( vis_ft [ j , i , : , pidx ] ) ) , label = labels [ j ] , alpha = alpha ) ax [ i ] . axvline ( delays [ j , i , pidx ] , color = 'red' ) ax [ i ] . text ( 0.1 , 0.9 , '{0}: {1}' . format ( bname [ i ] , 'A' if pidx == 0 else 'B' ) , 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 ( 'delay (ns)' ) if outname is not None : plt . savefig ( '{0}_{1}_delays.png' . format ( outname , 'A' if pidx == 0 else 'B' ) , bbox_inches = 'tight' ) if not show : plt . close ( ) return delays
short_docstring: Plots the visibility amplitude against delay.
short_docstring_tokens: Plots the visibility amplitude against delay .
comment: """Plots the visibility amplitude against delay.
  
      For a given visibility Fourier transformed along the frequency axis,
      plots the amplitude against delay and calculates the location of the
      fringe peak in delay.  Returns the peak delay for each visibility,
      which can be used to calculate the antenna delays.
  
      Parameters
      ----------
      vis_ft : ndarray
          The complex visibilities, dimensions (visibility type, baselines,
          delay). Note that the visibilities must have been Fourier transformed
          along the frequency axis and scrunched along the time axis before being
          passed to `plot_delays`.
      labels : list
          The labels of the types of visibilities passed.  For example,
          ``['uncalibrated', 'calibrated']``.
      delay_arr : ndarray
          The center of the delay bins in nanoseconds.
      bname : list
          The baseline labels.
      nx : int
          The number of plots to tile along the horizontal axis. If `nx` is
          given a value of ``None``, this is set to the number of baselines or 5,
          if there are more than 5 baselines.
      outname : str
          The base to use for the name of the png file the plot is saved to. The
          plot will be saved to `outname`_delays.png if an outname is provided.
          If `outname` is given a value of ``None``, no plot will be saved.
          Defaults ``None``.
      show : boolean
          If `show` is given a value of ``False`` the plot will be closed.
          Otherwise, the plot will be left open. Defaults ``True``.
  
      Returns
      -------
      delays : ndarray
          The peak delay for each visibility, in nanoseconds.
      """$SEP$# could use scipy.signal.find_peaks instead