Skip to content

feat!(crosscorr): options to compute negative lags and normalise

Arin Wongprommoon requested to merge issue-030 into dev

WHY IS THIS CHANGE NEEDED?:

  • negative lags needed for cross-correlation (in contrast to autocorrelation, in which the autocorrelation function is symmetrical)

HOW DOES THE CHANGE SOLVE THE PROBLEM?:

  • stole from https://git.ecdf.ed.ac.uk/swain-lab/wela/-/blob/master/autocrosscorr.py#L84
  • use 'normalised' and 'only_pos' as parameters according to parameters-processes paradigm
  • return statement: treat 'corr' in wela as the content of the sole output DataFrame and 'lags' in wela as the column names -- interpreting wela.autocrosscorr returning two variables as a limitation of using numpy arrays as the main datatype (which using pandas DataFrames here can solve)

WHAT SIDE EFFECTS DOES THIS CHANGE HAVE?:

  • existing uses (hopefully) shouldn't be affected, but structure of DataFrame should change and must be inspected

EVIDENCE THAT COMMIT WORKS:

  • tested on example described in docs (ultimately derived from the wela implementation), ran without errors and output was as expected (a sinusoid).

REFERENCES:

Merge request reports