Package gmisclib :: Module tsops
[frames] | no frames]

Module tsops

source code

Do mathematical operations on time series, where the two operands don't necessarily have the same sampling times. It finds a common sampling time and sampling interval, then interpolates as necessary to bring the data onto the common time axis.

Classes
  axis
This class represents a time axis for a time series.
Functions
 
time(datasets, start=None, end=None) source code
 
time2(a, b) source code
 
test_fig() source code
 
interp_fill(a, t, fill) source code
 
interpN_fill(a, t, fill) source code
numpy array.
interp(a, t)
Interpolate to a specified time axis.
source code
 
test_interp1() source code
 
test_interp2() source code
 
test_interp3() source code
 
interpN(a, t)
Interpolate to a specified time axis via nearest-neighbor interpolation.
source code
list(numpy.ndarray) where the first ndarray is 1-D and the rest are two dimensional.
common(data_sets, start=None, end=None)
Computes a common time axis for several datasets.
source code
 
commonN(data_sets, start=None, end=None)
Put several data sets on a common time axis.
source code
 
mul(a, b, hdr_op=None) source code
 
copy_interval(a, t0, t1, hdr_op=None, mode='rr')
This copies the part of the time-series in a where t0 < t < t1.
source code
 
apply(fcn, a, hdrfcn=<function <lambda> at 0x5e5f938>)
Apply a function, point-by-point to the data in a.
source code
 
resample(a, dt) source code
 
test() source code
Variables
  __package__ = 'gmisclib'

Imports: math, Num, NG, gpkimgclass


Function Details

interp(a, t)

source code 

Interpolate to a specified time axis. This does a linear interpolation.

Parameters:
  • a (gpkimgclass.gpk_img) - data to be interpolated (a time series)
  • t (an array of times.)
Returns: numpy array.
data interpolated onto the specified time values.

interpN(a, t)

source code 

Interpolate to a specified time axis via nearest-neighbor interpolation. A is a gpkimgclass, and t is an array of times. Returns a Numeric array, not a gpkimgclass.

common(data_sets, start=None, end=None)

source code 

Computes a common time axis for several datasets. Linearly interpolate as needed. The data sets need not be the same width, and need not have the same sampling interval or a common starting time.

Parameters:
  • data_sets (list(gpkimgclass.gpk_img)) - this is a list of the data to be put on a common time axis.
  • start (float or None) - this allows you to restrict the output data to a smaller region.
  • end (float or None) - this allows you to restrict the output data to a smaller region.
Returns: list(numpy.ndarray) where the first ndarray is 1-D and the rest are two dimensional.
the time_axis (as a 1-D numpy array of time values), followed by a 2-D numpy array for each of the input data sets.

commonN(data_sets, start=None, end=None)

source code 

Put several data sets on a common time axis. Interpolate by choosing nearest neighbor.

copy_interval(a, t0, t1, hdr_op=None, mode='rr')

source code 

This copies the part of the time-series in a where t0 < t < t1. 'a' is a gpk_img object.