def dummy_ts(self):
     return timeseries.TimeSeries(np.linspace(0, 10, 10),
                                  dims=("x", ),
                                  coords={
                                      "x": range(10),
                                      "samplerate": 1
                                  })
 def setup_class(cls):
     times = np.linspace(0, 1, 1000)
     ts = np.sin(8 * times) + np.sin(16 * times) + np.sin(32 * times)
     cls.timeseries = timeseries.TimeSeries(data=ts,
                                            dims=('time'),
                                            coords={
                                                'time': times,
                                                'samplerate': 1000
                                            })
def time_series():
    times = np.linspace(0, 1, 1000)
    ts = np.sin(8 * times) + np.sin(16 * times) + np.sin(32 * times)
    return timeseries.TimeSeries(data=ts,
                                 dims=('time'),
                                 coords={
                                     'time': times,
                                     'samplerate': 1000
                                 })
 def setup_class(self):
     self.times = times = np.linspace(0, 1, 1000)
     self.data = np.sin(8 * times) + np.sin(16 * times) + np.sin(32 * times)
     self.freqs = np.array([10, 20], dtype=float)
     self.timeseries = timeseries.TimeSeries(data=self.data[None, :],
                                             coords={
                                                 'offsets': [0],
                                                 'time': self.times,
                                                 'samplerate': 1000
                                             },
                                             dims=('offsets', 'time'))
    def test_non_double(self):
        """Test that we can use a TimeSeries that starts out as a dtype other
        than double.

        """
        lim = 10000
        data = np.random.uniform(-lim, lim, (100, 1000)).astype(np.int16)

        ts = timeseries.TimeSeries(data=data,
                                   dims=("x", "time"),
                                   coords={
                                       "x":
                                       np.linspace(0, data.shape[0],
                                                   data.shape[0]),
                                       "time":
                                       np.arange(data.shape[1]),
                                       "samplerate":
                                       1,
                                   })

        mwf = MorletWaveletFilter(ts,
                                  np.array(range(70, 171, 10)),
                                  output="power")
        mwf.filter()