Reputation: 415
I struggle to find out how to feed a time-series that consists of a one-column .txt file into pyunicorn’s timeseries.surrogates
. My one-column .txt file contains many numerical datapoints that constitute the time-series.
Pyunicorn offers several examples how to apply its surrogate methods in this link: http://www.pik-potsdam.de/~donges/pyunicorn/api/timeseries/surrogates.html
Paradigmatically, the last surrogate option in the link above, namely for white_noise_surrogates(original_data)
, Pyunicorn offers the following explanatory code.
ts = Surrogates.SmallTestData().original_data
surrogates = Surrogates.SmallTestData().white_noise_surrogates(ts)
Clearly, the example data SmallTestData()
is part of pyunicorn. But how would I have to enter my data, that is, Data_2
, into the code above? The code
surrogates = Surrogates.white_noise_surrogates(Data_2)
returns the message
TypeError: Surrogates.correlated_noise_surrogates() missing 1 required positional argument: 'original_data'
Trying the code in another try
TS = Surrogates.Data_2().original_data
Surrogate = Surrogates.correlated_noise_surrogates(TS)
returns into the message
AttributeError: type object 'Surrogates' has no attribute 'Data_2'
I assume that there is a simple solution, but I cannot figure it out. Here is an overview of my code:
from pyunicorn.timeseries import Surrogates
import pyunicorn as pn
Data_2 = np.loadtxt("/path-to-data.txt")
# Surrogate time-series
TS = Surrogates.Data_2().original_data
Surrogate = Surrogates.correlated_noise_surrogates(TS)
Does anyone understand how to properly feed or insert a time-series into pyunicorn’s timeseries.surrogates
options?
Upvotes: 1
Views: 194
Reputation: 21
You need to instantiate the class Surrogates
with your data
TS = Surrogates(original_data=Data_2)
my_surr = TS.correlated_noise_surrogates(Data_2)
Upvotes: 2