time_series

Submodules

arte.time_series.time_series module

class arte.time_series.time_series.TimeSeries(sampling_interval)

Bases: object

Base class for implementing operations on data representing time series.

Derived classes must implement a _get_not_indexed_data() method that returns a numpy array of shape (n_time_elements, n_ensemble_elements).

Derived classes must also implement a get_index_of() method to add ensemble indexing with arbitrary *args and **kwargs parameters (e.g. returning of partial subset based on indexes or names).

Originally implemented as part of the ARGOS codebase.

delta_time

Property with the interval between samples (astropy units)

ensemble_average(times=None, *args, **kwargs)

Average across series at each sampling time

ensemble_median(times=None, *args, **kwargs)

Median across series at each sampling time

ensemble_size()

Number of distinct series in this time enseble

ensemble_std(times=None, *args, **kwargs)

Standard deviation across series at each sampling time

frequency()
get_data(*args, **kwargs)

Raw data as a matrix [time, series]

get_index_of(*args, **kwargs)
help(search='', prefix='')

Interactive help

Prints on stdout a list of methods that match the search substring or all of them if search is left to the default value of an empty string, together with a one-line help taken from the first line of their docstring, if any.

The prefix argument is prepended to the method name and is used for recursive help of every class member.

last_cutted_frequency()
plot_cumulative_spectra(from_freq=None, to_freq=None, segment_factor=None, overplot=False, *args, **kwargs)

Plot the cumulative PSD across specified series

plot_spectra(from_freq=None, to_freq=None, segment_factor=None, overplot=False, label=None, *args, **kwargs)

Plot the PSD across specified series

power(from_freq=None, to_freq=None, segment_factor=None, window='boxcar', *args, **kwargs)

PSD across specified series

time_average(times=None, *args, **kwargs)

Average value over time for each series

time_median(times=None, *args, **kwargs)

Median over time for each series

time_std(times=None, *args, **kwargs)

Standard deviation over time for each series

class arte.time_series.time_series.TimeSeriesWithInterpolation(sampling_interval)

Bases: arte.time_series.time_series.TimeSeries

TimeSeries with automatic interpolation of missing data.

Missing data points are detected from a jump in the frame counter, and are linearly interpolated between valid data points.

In addition to the methods defined by TimeSeries, the derived class must also implement a _get_counter() method that returns the (potentially incomplete) frame counter array. The frame counter can be of any integer or floating point type, and can increase by any amount at each time step, as long as it is regular, and can start from any value. These are all valid frame counters (some have gaps in them):

[0,1,2,3,4,5,6]
[-6, -3, 0, 3, 6, 9, 15]
[1.0, 1.2, 1.4, 2.0, 2.2, 2.4]

Interpolation is an expensive operation and is not automatic. The derived class must call the interpolation routine in the _get_not_indexed_data() method explicitly. The data array passed to interpolate_missing_data() must not include the missing points: if the “theoretical” shape is (100,n) but one frame is missing, the data array must have shape (99,n) and the frame counter (99,). The interpolated data and frame counter will have the correct dimensions.

For example:

def _get_counter(self):
    return fits.getdata('file_with_incomplete_frame_counter.fits')

def _get_not_indexed_data(self):
    raw_data = fits.getdata('file_with_incomplete_data.fits')
    return self.interpolate_missing_data(raw_data)

Since interpolation can be slow, it is recommended that some form of caching strategy is implemented in the _get_not_indexed_data() method.

get_counter()

Returns the interpolated frame counter array

get_original_counter()

Returns the original frame counter array

interpolate_missing_data(data)

Interpolate missing data.

Parameters:data (ndarray) – the original data
Returns:the interpolated array
Return type:ndarray
Raises:ValueError – if the frame counter first dimension does not have the same length as the data first dimension.

arte.time_series.multi_time_series module

class arte.time_series.multi_time_series.MultiTimeSeries(*args)

Bases: arte.time_series.time_series.TimeSeries

Join multiple TimeSeries objects with incompatible time sampling.

After being initialized with a list of TimeSeries objects, which can have different ensemble sizes and length, it behaves as if all the data was part of a single ensemble. Operations that make calculations time-wise (like time_std()) work in any case. The ensemble-wise ones (like ensemble_std()) only work if deltaTime is the same across all series, and raise an Exception otherwise.

add_series(series)

Adds a new series to this MultiTimeSeries instance

Parameters:series (TimeSeries or TimeSeriesWithInterpolation instance) – the series to be added
delta_times(*args, **kwargs)

Returns a vector of delta times

ensemble_average(times=None, *args, **kwargs)

Average across series at each sampling time

ensemble_median(times=None, *args, **kwargs)

Standard deviation across series at each sampling time

ensemble_size()

Returns the total ensemble size

ensemble_std(times=None, *args, **kwargs)

Standard deviation across series at each sampling time

is_homogeneous(*args, **kwargs)

Returns True if all selected series have the same delta_time

arte.time_series.indexer module

class arte.time_series.indexer.Indexer

Bases: object

static myrange(*args, maxrange)
xy(*args, **kwargs)

default: coord Accepted keywords: coord= x and/or y

class arte.time_series.indexer.ModeIndexer(max_mode=None)

Bases: arte.time_series.indexer.Indexer

modes(*args, **kwargs)

default: all modes mode = single mode modes = list of modes from_mode = first mode to_mode = last mode

Module contents