Skip to content

Commit

Permalink
Merge pull request #35 from seeq12/33-bug-attributeerror-when-using-s…
Browse files Browse the repository at this point in the history
…ignal-with-data-gaps

improved pre-processed data handling of index gaps
  • Loading branch information
jameshiggie authored Aug 29, 2023
2 parents 243f931 + 3749e81 commit dae5efb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
9 changes: 7 additions & 2 deletions seeq/addons/correlation/_cross_correlations.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,13 @@ def lags_coeffs(df, max_time_shift, time_output_unit):
"""
_validate_df(df)
grid: float = pd.to_timedelta(to_offset(pd.infer_freq(df.index))).total_seconds()
sampling = pd.Timedelta(f'{grid}s')

try:
grid: float = pd.to_timedelta(to_offset(pd.infer_freq(df.index))).total_seconds()
sampling = pd.Timedelta(f'{grid}s')
except:
grid: float = pd.to_timedelta(np.diff(df.index).min()).total_seconds()
sampling = pd.Timedelta(f'{grid}s')

if not df.spy.grid:
df.spy.grid = f'{grid}s'
Expand Down
1 change: 1 addition & 0 deletions seeq/addons/correlation/_seeq_add_on.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class CorrelationHeatmap:

def __init__(self, sdl_notebook_url=None, df=None, datasource=None, seeq_url=None):
display(HTML("<style>#appmode-leave {display: none;}"))
spy.options.compatibility = 188.3
if sdl_notebook_url is None and not isinstance(df, pd.DataFrame):
raise ValueError('Need either the SDL url or a pd.DataFrame with the signals to analyze')
if sdl_notebook_url is None and isinstance(df, pd.DataFrame):
Expand Down

0 comments on commit dae5efb

Please sign in to comment.