PoPPy - Point Processes in Python¶
PoPPy – Point Processes in Python.
This module contains point process class types and a variety of functions for association analysis. The routines given here grew from work presented by Morley and Freeman (Geophysical Research Letters, 34, L08104, doi:10.1029/ 2006GL028891, 2007), which were originally written in IDL. This module is intended for application to discrete time series of events to assess statistical association between the series and to calculate confidence limits. Any mis-application or mis-interpretation by the user is the user’s own fault.
>>> import datetime as dt >>> import spacepy.time as spt
Since association analysis is rather computationally expensive, this example shows timing.
>>> t0 = dt.datetime.now() >>> onsets = spt.Ticktock(onset_epochs, 'CDF') >>> ticksR1 = spt.Ticktock(tr_list, 'CDF')
Each instance must be initialized
>>> lags = [dt.timedelta(minutes=n) for n in range(-400,401,2)] >>> halfwindow = dt.timedelta(minutes=10) >>> pp1 = poppy.PPro(onsets.UTC, ticksR1.UTC, lags, halfwindow)
To perform association analysis
>>> pp1.assoc() Starting association analysis calculating association for series of length [3494, 1323] at 401 lags >>> t1 = dt.datetime.now() >>> print("Elapsed: " + str(t1-t0)) Elapsed: 0:35:46.927138
Note that for calculating associations between long series at a large number of lags is SLOW!!
>>> pp1.plot(dpi=80) Error: No confidence intervals to plot - skipping
To add 95% confidence limits (using 4000 bootstrap samples)
>>> pp1.aa_ci(95, n_boots=4000)
The plot method will then add the 95% confidence intervals as a semi- transparent patch.
Copyright 2010 Los Alamos National Security, LLC.
PoPPy point process object
Overplots two PPro objects
Construct bootstrap confidence interval
Find the percentile of a particular value in a sequence