dnvgl / qats

Python library and GUI for efficient processing and visualization of time series.
MIT License
38 stars 10 forks source link

Bug when selecting peak from time series #106

Closed deancarloz closed 11 months ago

deancarloz commented 1 year ago

Hi, When selecting peaks (global maxima) array returned contains the first position as zero. image

I have added the specific time series that returns this results. Its strange because I have other time series for the same variable that were generated by other seed and this bug won't come up. example peaks.csv

eneelo commented 1 year ago

Hi, Thanks for including the time series in your bug report. Will have a look at it.

The following code reproduces and visualizes the reported issue using qats version 4.11.1:

from qats import TimeSeries
import matplotlib.pyplot as plt
import pandas as pd
# file with time series
fn = 'example.peaks.csv'
# load from csv using pandas, extract time and response arrays
t, x = pd.read_csv(fn).values.T
# initiate TimeSeries instance
ts = TimeSeries('FX', t, x)
# extract global maxima
maxima, maxtimes = ts.maxima(rettime=True)
# visualize time series and maxima
ts.plot()
ax = plt.gca()
ax.scatter(maxtimes, maxima, marker='o', s=10, color='tab:red')
ax.set_axisbelow(True)
deancarloz commented 1 year ago

Hi,

Thanks, not sure why it does that. Any ways I cannot fit Weibull when this happens