spacepy.seapy

SeaPy – Superposed Epoch in Python.

This module contains superposed epoch class types and a variety of functions for using on superposed epoch objects. Each instance must be initialized with (assuming import seapy as se):

>>> obj = se.Sea(data, times, epochs)

To perform a superposed epoch analysis

>>> obj.sea()

To plot

>>> obj.plot()

If multiple SeaPy objects exist, these can be combined into a single object

>>> objdict = seadict([obj1, obj2],['obj1name','obj2name'])

and then used to create a multipanel plot

>>> multisea(objdict)

For two-dimensional superposed epoch analyses, initialize an Sea2d() instance

>>> obj = se.Sea2d(data, times, epochs, y=[4., 12.])

All object methods are the same as for the 1D object. Also, the multisea() function should accept both 1D and 2D objects, even mixed together. Currently, the plot() method is recommended for 2D SEA.

–++– By Steve Morley –++–

smorley@lanl.gov Los Alamos National Laboratory

Copyright 2010 Los Alamos National Security, LLC.

Functions

multisea(dictobj[, n_cols, epochline, ...])

Function to create multipanel plot of superposed epoch analyses.

readepochs(fname[, iso, isofmt])

Read epochs from text file assuming YYYY MM DD hh mm ss format

sea_signif(obj1, obj2[, test, show, xquan, ...])

Test for similarity between distributions at each lag in two 1-D SEAs

seadict(objlist, namelist)

Function to create dictionary of SeaPy.Sea objects.

Classes

Sea(data, times, epochs[, window, delta, ...])

SeaPy Superposed epoch analysis object

Sea2d(data, times, epochs[, window, delta, ...])

SeaPy 2D Superposed epoch analysis object

SeaBase(data, times, epochs, **kwargs)

SeaPy Superposed epoch analysis base class

spacepy.seapy.multisea(dictobj, n_cols=1, epochline=True, usrlimx=[], usrlimy=[], xunits='', show=True, zunits='', zlog=True, figsize=None)[source]

Function to create multipanel plot of superposed epoch analyses.

Parameters:
Dictionary of Sea objects (from superposedepoch.seadict()).
Returns:
Plot of input object median and bounds (ci, mad, quartiles - see sea()).
If keyword ‘show’ is False, output is a plot object.
Other Parameters:
- epochline (default = True) - put vertical line at zero epoch.
- usrlimy (default = []) - override automatic y-limits on plot (same for all plots).
- show (default = True) - shows plot; set to false to output plot object to variable
- x/zunits - Units for labeling x and z axes, if required
- figsize - tuple of (width, height) in inches
- dpi (default=300) - figure resolution in dots per inch
- n_cols - Number of columns: not yet implemented.
spacepy.seapy.readepochs(fname, iso=False, isofmt='%Y-%m-%dT%H:%M:%S')[source]

Read epochs from text file assuming YYYY MM DD hh mm ss format

Parameters:
Filename (include path)
Returns:
epochs (type=list)
Other Parameters:
iso (default = False), read in ISO date format
isofmt (default is YYYY-mm-ddTHH:MM:SS, code is %Y-%m-%dT%H:%M:%S)
spacepy.seapy.sea_signif(obj1, obj2, test='KS', show=True, xquan='Time Since Epoch', yquan='', xunits='', yunits='', epochline=True, usrlimy=[])[source]

Test for similarity between distributions at each lag in two 1-D SEAs

Parameters:
obj1Sea

First instance for comparison

obj2Sea

Second instance for comparison

Other Parameters:
test

(default = ‘KS’) Test to apply at each lag: KS is 2-smaple Kolmogorov-Smirnov; U is Mann-Whitney U-test

show

(default = True)

xquan

(default = ‘Time since epoch’ (None)) - x-axis label.

yquan

(default = ‘Time since epoch’ (None)) - y-axis label.

xunits

(default = None (None)) - x-axis units.

yunits

(default = None (None)) - y-axis units.

epochline

(default = True) - put vertical line at zero epoch.

usrlimy

(default = []) - override automatic y-limits on plot.

Examples

>>> obj1 = seapy.Sea(data1, times1, epochs1)
>>> obj2 = seapy.Sea(data2, times2, epochs2)
>>> obj1.sea(storedata=True)
>>> obj2.sea(storedata=True)
>>> seapy.sea_signif(obj1, obj2)
spacepy.seapy.seadict(objlist, namelist)[source]

Function to create dictionary of SeaPy.Sea objects.

Parameters:
- objlist: List of Sea objects.
- namelist: List of variable labels for input objects.
Other Parameters:
namelist = List containing names for y-axes.