# spacepy.poppy.PPro

class spacepy.poppy.PPro(process1, process2, lags=None, winhalf=None, verbose=False)

  PoPPy point process object

  Initialize object with series1 and series2. These should be timeseries of events, given as lists, arrays, or lists of datetime objects. Includes method to perform association analysis of input series

  Output can be nicely plotted with `plot()`.

  `aa_ci`(inter[, n_boots, seed]) | Get bootstrap confidence intervals for association number
  `assoc`([u, h]) | Perform association analysis on input series
  `assoc_mult`(windows[, inter, n_boots, seed]) | Association analysis w/confidence interval on multiple windows
  `plot`([figsize, dpi, asympt, show, norm, ...]) | Create basic plot of association analysis.
  `plot_mult`(windows, data[, min, max, ...]) | Plots a 2D function of window size and lag
  `swap`() | Swaps process 1 and process 2

  aa_ci(inter, n_boots=1000, seed=None)

    Get bootstrap confidence intervals for association number

    Requires input of desired confidence interval, e.g.:

          >>> obj.aa_ci(95)

    Upper and lower confidence limits are added to `ci`.

    After calling, `conf_above` will contain the confidence (in percent) that the association number at that lag is above the asymptotic association number. (The confidence of being below is 100 - conf_above) For minor variations in conf_above to be meaningful, a large number of bootstraps is required. (Rougly, 1000 to be meaningful to the nearest percent; 10000 to be meaningful to a tenth of a percent.) A conf_above of 100 usually indicates an insufficient sample size to resolve, not perfect certainty.

    Note also that a 95% chance of being above indicates an exclusion from the 90% confidence interval!

    Parameters
      inter float

        percentage confidence interval to calculate

      n_boots int, optional

        number of bootstrap iterations to run

      seed int, optional

        seed for the random number generator. If not specified, Python code will use numpy’s RNG and its current seed; C code will seed from the clock.

    Warning

    If `seed` is specified, results may not be reproducible between systems with different sizes for C long type. Note that 64-bit Windows uses a 32-bit long and so results will be the same between 64 and 32-bit Windows, but not between 64-bit Windows and other 64-bit operating systems. If `seed` is not specified, results are not reproducible anyhow.

  assoc(u=None, h=None)

    Perform association analysis on input series

    Parameters
      u list, optional

        the time lags to use

      h

        association window half-width, same type as process1

  assoc_mult(windows, inter=95, n_boots=1000, seed=None)

    Association analysis w/confidence interval on multiple windows

    Using the time sequence and lags stored in this object, perform full association analysis, including bootstrapping of confidence intervals, for every listed window half-size

    Parameters
      windows sequence

        window half-size for each analysis

      inter float, optional

        desired confidence interval, default 95

      n_boots int, optional

        number of bootstrap iterations, default 1000

      seed int, optional

        Random number generator seed. It is STRONGLY recommended not to specify (i.e. leave None) to permit multithreading.

    Returns
      out three numpy array

        Three numpy arrays, (windows x lags), containing (in order) low values of confidence interval, high values of ci, percentage confidence above the asymptotic association number

    Warning

    This function is likely to take a LOT of time.

  ci

    Contains the upper and lower confidence limits for the association number as a function of lag. The first element is the array of lower limits; the second, the array of upper limits. Not available until after calling `aa_ci()`.

  conf_above

    Contains the confidence that the association number, as a function of lag, is above the asymptotic association number. (The confidence of being below is 100 - `conf_above`.) Not available until after calling `aa_ci()`.

  plot(figsize=None, dpi=80, asympt=True, show=True, norm=True, xlabel='Time lag', xscale=None, ylabel=None, title=None, transparent=True)

    Create basic plot of association analysis.

    Uses object attributes created by `assoc()` and, optionally, `aa_ci()`.

    Parameters
      figsize, optional

        passed through to matplotlib.pyplot.figure

      dpi int, optional

        passed through to matplotlib.pyplot.figure

      asympt boolean, optional

        True to overplot the line of asymptotic association number

      show boolean, optional

        Show the plot? (if false, will create without showing)

      norm boolean, optional

        Normalize plot to the asymptotic association number

      title string, optional

        label/title for the plot

      xlabel string, optional

        label to put on the X axis of the resulting plot

      xscale float, optional

        scale x-axis by this factor (e.g. 60.0 to convert seconds to minutes)

      ylabel string, optional

        label to put on the Y axis of the resulting plot

      transparent boolean, optional

        make c.i. patch transparent (default)

  plot_mult(windows, data, min=None, max=None, cbar_label=None, figsize=None, dpi=80, xlabel='Lag', ylabel='Window Size')

    Plots a 2D function of window size and lag

    Parameters
      windows list

        list of window sizes (y axis)

      data list

        list of data, dimensioned (windows x lags)

      min float, optional

        clip L{data} to this minimum value

      max float, optional

        clip L{data} to this maximum value

  swap()

    Swaps process 1 and process 2