Skip to content

A Python script to determine when a given time series has reached a statistically stationary state and if the final signal is periodic.

Notifications You must be signed in to change notification settings

malcolmroberts/stationary

Repository files navigation

stationary

A Python script to determine when a given time series has reached a statistically stationary state and if the final signal is periodic.

Syntax:

./stationary.py -f <FILE> 

where the input file FILE has the index (as an integer) followed by a the value of the signal (as a float) separated by a tab. If the data is not in this format, it can be converted to this format by running

./change_format.py <IN> <OUT>

with the argument optionally specifying the output filename (the default output filename is .out).

Use:

stationary.py currently produces a variety of files:

  • data, which is the input with the linear regression removed,

  • data.ac, which is the autocorrelation of data,

  • data.fac, which is the magnituded of the modes of the DFT of the autocorrelation,

  • data.typ<#>, which are the typical cycles detected (<#> an ineger >= 0).

  • data.dif, which is the difference between the signal (with the linear regression already removed) and the signal as represented by the typical cycle. The program also outputs (to the terminal) the RMS difference between the signal and its represenatation by the typical cycle.

Viewing the output:

The output can be used with the included plot.asy file, which is opened with Asymtote (asymptote.sf.net). Running plot.asy with the command

asy plot.asy

The script then asks for the filenames, which is a comma-separated list of filenames (eg "data,data.typ", without the quotes), and then asks for a choice of scales and axis labels.

Scripts: The file run.sh take an input file and convert it into a sequence of (position,value) pairs, and then run stationary.py

The file run2.sh calls run.sh and then creates a PDF of the output, using asymptote and tex for visualization and typesetting.

About

A Python script to determine when a given time series has reached a statistically stationary state and if the final signal is periodic.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published