Skip to content

Commit 3bbce65

Browse files
authored
Update correlation.py
`pos_drown` was a recent change in the autocorr_shape and hadn't been updated in the config yaml file to reflect this. As with all other functions and parameter settings in pyhctsa, this is supposed to be camel case (to match the pythonic naming conventions.
1 parent ff10cc3 commit 3bbce65

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

pyhctsa/operations/correlation.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1742,7 +1742,7 @@ def get_window(step_ind: int):
17421742

17431743
return np.std(qs, ddof=1)/np.std(y, ddof=1)
17441744

1745-
def autocorr_shape(y: ArrayLike, stop_when: Union[int, str] = 'posDrown') -> dict:
1745+
def autocorr_shape(y: ArrayLike, stop_when: Union[int, str] = 'pos_drown') -> dict:
17461746
"""
17471747
How the autocorrelation function changes with the time lag.
17481748
@@ -1755,7 +1755,7 @@ def autocorr_shape(y: ArrayLike, stop_when: Union[int, str] = 'posDrown') -> dic
17551755
The input time series.
17561756
stop_when : str or int, optional
17571757
The criterion for the maximum lag to measure the ACF up to.
1758-
Default is ``'posDrown'``.
1758+
Default is ``'pos_drown'``.
17591759
17601760
Returns
17611761
--------
@@ -1777,10 +1777,10 @@ def autocorr_shape(y: ArrayLike, stop_when: Union[int, str] = 'posDrown') -> dic
17771777
acf = autocorr(y, taus, 'Fourier')
17781778
n_drown = stop_when
17791779

1780-
elif stop_when in ['posDrown', 'drown', 'doubleDrown']:
1780+
elif stop_when in ['pos_drown', 'drown', 'double_drown']:
17811781
# Compute ACF up to a given threshold:
17821782
n_drown = 0 # the point at which ACF ~ 0
1783-
if stop_when == 'posDrown':
1783+
if stop_when == 'pos_drown':
17841784
# stop when ACF drops below threshold, th
17851785
for i in range(1, N+1):
17861786
acf_val = autocorr(y, i-1, 'Fourier')[0]
@@ -1811,7 +1811,7 @@ def autocorr_shape(y: ArrayLike, stop_when: Union[int, str] = 'posDrown') -> dic
18111811
acf.append(acf_val)
18121812
break
18131813
acf.append(acf_val)
1814-
elif stop_when == 'doubleDrown':
1814+
elif stop_when == 'double_drown':
18151815
# Stop at 2*tau, where tau is the lag where ACF ~ 0 (within 1/sqrt(N) threshold)
18161816
for i in range(1, N+1):
18171817
acf_val = autocorr(y, i-1, 'Fourier')[0]
@@ -1838,7 +1838,7 @@ def autocorr_shape(y: ArrayLike, stop_when: Union[int, str] = 'posDrown') -> dic
18381838
# Basic stats on the ACF
18391839
out['sumacf'] = np.sum(acf)
18401840
out['meanacf'] = np.mean(acf)
1841-
if stop_when != 'posDrown':
1841+
if stop_when != 'pos_drown':
18421842
out['meanabsacf'] = np.mean(np.abs(acf))
18431843
out['sumabsacf'] = np.sum(np.abs(acf))
18441844

@@ -1879,7 +1879,7 @@ def autocorr_shape(y: ArrayLike, stop_when: Union[int, str] = 'posDrown') -> dic
18791879
fit_success = False
18801880
min_pts_to_fit_exp = 4 # (need at least four points to fit exponential)
18811881

1882-
if stop_when == 'posDrown' and nac >= min_pts_to_fit_exp:
1882+
if stop_when == 'pos_drown' and nac >= min_pts_to_fit_exp:
18831883
# Fit exponential decay to (absolute) ACF:
18841884
# (kind of only makes sense for the first positive period)
18851885
exp_func = lambda x, b : np.exp(-b * x)

0 commit comments

Comments
 (0)